Skip to content

Added Context to emulate node behaviour #8

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

Closed
wants to merge 3 commits into from
Closed

Added Context to emulate node behaviour #8

wants to merge 3 commits into from

Conversation

pluma
Copy link
Contributor

@pluma pluma commented Jan 18, 2014

Fixes #7.

@pluma
Copy link
Contributor Author

pluma commented Jan 18, 2014

Having the Context object adds some redundancy, but if node demands it, it's the right thing to do if we want to make sure code written for browserify remains compatible with node.

@pluma
Copy link
Contributor Author

pluma commented Jan 20, 2014

I've adjusted the behaviour to further mimic nodes behaviour. This seems to also fix #6.

@ghost
Copy link

ghost commented Jan 28, 2014

Published in 0.0.3. I had to tweak the code slightly to save the reference to win.eval() before calling it since the context copy from global was masking it.

@ghost ghost closed this Jan 28, 2014
@@ -63,11 +103,15 @@ Script.prototype.runInThisContext = function () {
return eval(this.code); // maybe...
Copy link

@marafee1243 marafee1243 Mar 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firefox : 65.0.1
throws error where as Chrome doesnt.

Content Security Policy: The page’s settings blocked the loading of a resource at eval (“script-src”).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are using a CSP header that does not allow eval as script-src, compliant browsers will throw an error and not let you use eval. This is working as intended.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also way to gravedig an unrelated PR with an issue that isn't even related to the project directly. Please don't do that.

This pull request was closed.
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.

Add "Context" constructor
2 participants