Skip to content

Fix a crash if the worker has the 'window' object defined #7231

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

Merged
merged 2 commits into from
Oct 10, 2018

Conversation

cobarx
Copy link
Contributor

@cobarx cobarx commented Oct 5, 2018

Fixes #7222

In some situations, the window object may be defined in a worker context, for example if window is defined for a polyfill. In these cases, the worker would report ENVIRONMENT_IS_WEB true and attempt to access document.currentScript. This would cause the worker to crash.

This PR inverts that check so that we check if we're a worker rather than web. This shouldn't cause any changes to functionality.

@kripken
Copy link
Member

kripken commented Oct 6, 2018

Thanks @cobarx! Looks good, please just add yourself to AUTHORS before we merge.

@kripken
Copy link
Member

kripken commented Oct 6, 2018

(CI failures here are due to #7232, can ignore them)

@cobarx
Copy link
Contributor Author

cobarx commented Oct 7, 2018

@kripken Thanks, all set!

@kripken kripken merged commit bcc63a6 into emscripten-core:incoming Oct 10, 2018
@kripken
Copy link
Member

kripken commented Oct 10, 2018

Thanks @cobarx!

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

Successfully merging this pull request may close these issues.

2 participants