-
Notifications
You must be signed in to change notification settings - Fork 384
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
Fix issue for running under node-webkit. #258
Conversation
Under node-webkit we have both contexts 'window' and 'global'. 'window' is default context then we should check for window first.
This was changed from We may need all three. Also, please include a test that fails without your change, or, indicate in the PR which tests failed. |
I think we can use self. Under node-webkit we have global and window context. Scripts running under window. |
@david-risney, can you weigh in on your change in 4e4dc69 versus this PR? |
I changed |
In other words, we may need a more reliable way to get to the global object than just checking for "global", "self", or "window". Thanks for confirming! |
A common pattern I see elsewhere obtains the global object generically like in es5 via checking this in the global context:
Afaik this is a feature of JavaScript regardless of use strict or the execution environment (browser, worker, node etc) |
In strict mode, "this" when not assigned is undefined, and does not refer to the global object. |
IIRC that's true generally but not for global code. In global code |
Under node-webkit we have both contexts 'window' and 'global'.
'window' is default context then we should check for window first.