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

Infinite loops can occur because of a bug in Safari #5

Open
lastmjs opened this issue Sep 19, 2018 · 4 comments
Open

Infinite loops can occur because of a bug in Safari #5

lastmjs opened this issue Sep 19, 2018 · 4 comments

Comments

@lastmjs
Copy link
Member

lastmjs commented Sep 19, 2018

I don't believe this library will work in Safari because of the following bug: https://bugs.webkit.org/show_bug.cgi?id=170075

@lastmjs
Copy link
Member Author

lastmjs commented Sep 19, 2018

Follow this thread as well, it looks like they're doing nearly exactly the same thing: mapbox/mapbox-gl-js#6058

@lastmjs
Copy link
Member Author

lastmjs commented Dec 14, 2018

To get around this, I'm going to get rid of the web worker for now. This removes one of the security properties we have, which is stopping infinite loops. But until the Safari bug is fixed, it doesn't seem like that is going to be possible. Once Safari does fix the bug, revert to this version: v0.3.3

@lastmjs
Copy link
Member Author

lastmjs commented Dec 14, 2018

The results of my research are that iframes run on the main JavaScript thread, and so no setTimeout callback can ever be called if there is an infinite loop within the iframe. There doesn't seem to be any generic way of running an iframe in a separate thread or process. Chromium seems to have a way to do it, but I don't believe it's the default behavior for normal iframes. So, we need to get the iframe to run on a separate thread. We can't use web workers within iframes in Safari, so what if we could get the iframe to run in the web worker? Well, you can't manipulate the dom and you don't have access to the window object, so you can't load an iframe within a web worker. Now we're left with just getting rid of the web worker. As far as I know the only extra security properties the web worker is providing us is stopping infinite loops, and an extra layer of security in accessing any kind of dom...though the dom that could be accessed would be the iframe dom, and I believe the sandbox attribute and hiding the iframe are enough there.

@lastmjs lastmjs changed the title Does not work in Safari Infinite loops can occur because of a bug in Safari Dec 14, 2018
@lastmjs
Copy link
Member Author

lastmjs commented Dec 14, 2018

But, perhaps living with infinite loops is okay. Now we should be able to have modules within our eval, and the environment will not be restricted like it would be within a web worker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant