-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Browserified jsdom cannot execute <script> tags #1023
Conversation
I did a thing, it works, pls comment. See https://travis-ci.org/tmpvar/jsdom/builds/50547517 for the proper build with browser test. |
Wow, looks pretty awesome :D. Maybe add a test for async access within some nested scopes? |
|
||
var globals = findGlobals(ast); | ||
for (var i = 0; i < globals.length; ++i) { | ||
if (globals[i].name === "window") continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curlies and newline. JSHint should be catching this? Can we JSHint this file now?
f0e129c
to
5ef69ce
Compare
Fixed the nitpicks, but need to get some sleep before I add a test. Will do later tonight though. |
1674775
to
f75ee37
Compare
Added the async test. |
This dynamically rewrites the provided source code to always refer to window if it's a global variable. Caveats: * toString() of functions will return different results: a "window." prefix on global vars and whitespace modifications * Refering to undefined variables will not throw an error due to the window prefix for now. This might be fixable by throwing the error ourselves.
We can successfully run more parts of our node test suite on the browser too now! Also updated a few of the comments of the suites I've tried.
f75ee37
to
4546b8d
Compare
Fixed, at least somewhat, with 0ec0d0e. Will try to track down more cases as they pop up. |
Our contextify-shim.js doesn't even have a run function. I tried to add one, just
but this of course doesn't work since it's running the code in the global scope (e.g. in a worker), where variables like
window
anddocument
don't work right.