Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sandbox web languages using iframes #268

Merged
merged 5 commits into from
Apr 3, 2024
Merged

Sandbox web languages using iframes #268

merged 5 commits into from
Apr 3, 2024

Conversation

munshkr
Copy link
Owner

@munshkr munshkr commented Apr 3, 2024

Fixes #239

Load web libraries in separate pages and embed them using iframes. This way, these libraries do not pollute the global Window from the session page and there are no collisions between the globals each library define.

Incidentally, this also fixes #193: Because the web language libraries are only loaded inside the iframe and thus in a separate JS context, when unloading the Iframe DOM element, sound and visuals stop.

Strudel also adds some extensions to the Codemirror editor and has an animation frame to update decorators. For some reason, these updates need to run in the same context as the editor, and can't be modified from within the Iframe page.

@munshkr munshkr marked this pull request as ready for review April 3, 2024 22:35
@munshkr munshkr force-pushed the fix/239-sandboxes branch from 1e05bae to 8930c0f Compare April 3, 2024 22:36
@munshkr munshkr merged commit 205232c into main Apr 3, 2024
2 checks passed
@munshkr munshkr deleted the fix/239-sandboxes branch April 3, 2024 22:49
@tmhglnd
Copy link
Contributor

tmhglnd commented Apr 4, 2024

I would have to investigate but currently mercury-web throws a mercury error randomly when you evaluate but there is no clear indication why/where it is coming from and the code is actually still working and sound is running.

@munshkr
Copy link
Owner Author

munshkr commented Apr 4, 2024

I would have to investigate but currently mercury-web throws a mercury error randomly when you evaluate but there is no clear indication why/where it is coming from and the code is actually still working and sound is running.

Ah, yes, I know what this is about. Will fix it soon.

@munshkr
Copy link
Owner Author

munshkr commented Apr 4, 2024

@tmhglnd fixed now

@tmhglnd
Copy link
Contributor

tmhglnd commented Apr 4, 2024

Yes all good now!

@tmhglnd
Copy link
Contributor

tmhglnd commented Apr 4, 2024

Ah I spoke a bit too soon. Because now the m variable in Hydra that I made global for mercury audio analysis doesn't seem to work anymore. It gives ReferenceError: m is not defined

Edit: I see you already made an issue for this in #272

@munshkr
Copy link
Owner Author

munshkr commented Apr 4, 2024

Ah I spoke a bit too soon. Because now the m variable in Hydra that I made global for mercury audio analysis doesn't seem to work anymore. It gives ReferenceError: m is not defined

Edit: I see you already made an issue for this in #272

Ouch, I knew I was forgetting something. Yes, I noticed about this (was thinking of another case..), but I was planning on solving this in #272

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment