-
Notifications
You must be signed in to change notification settings - Fork 283
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
Undefine globals, not just shadow #43
Conversation
Node specific global should be normalized across environments
r? @schneems (@rails-bot has picked a reviewer for you, use r? to override) |
delete this.clearTimeout; | ||
delete this.clearInterval; | ||
delete this.setImmediate; | ||
delete this.clearImmediate; | ||
result = program(); |
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.
Someday we could move Nodes execution over to vm.Script
. We'd have full control over what globals were exposed to the v8 context. vm.Script
also has nice support for timeouts.
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.
What is blocking us to change this right now? The version of node that support vm.Script
?
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.
The version of node that support vm.Script?
It is well supported, but that change would be a substantial refactoring.
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.
Got it. Thanks.
cc @arthurnn |
🎉 thanks @rafaelfranca! |
Thank you. I'll release a new version later today. |
@rafaelfranca. Any chance of that new version this week? |
Yes. I can do in a few minutes. |
In some server side rendering environments (e.g., `execjs` since version 2.8.0 [1]) `setTimeout` is not available. Since `autoSetupTimeout` runs when Video.js is imported and tries to schedule `autoSetup`, this can lead to errors of the form in server side rendering: TypeError: scheduler is not a function `autoSetup` already bailed if run outside of a browser environment or if it has been globally disabled. To prevent calling `setTimeout`, we move the `Dom.isReal` check into `autoSetupTimeout`. Checking `options.autoSetup` has to remain in `autoSetup` to preserve backwards compatiblity with apps that set the option after Video.js has loaded but before the next tick. [1] rails/execjs#43
In some server side rendering environments (e.g., `execjs` since version 2.8.0 [1]) `setTimeout` is not available. Since `autoSetupTimeout` runs when Video.js is imported and tries to schedule `autoSetup`, this can lead to errors of the following form in server side rendering: TypeError: scheduler is not a function `autoSetup` already bailed out if run outside of a browser environment or if globally disabled. To prevent calling `setTimeout`, we already perform the `Dom.isReal` check in `autoSetupTimeout`. Checking `options.autoSetup` has to remain in `autoSetup` to preserve backwards compatiblity with apps that set the option after Video.js has loaded but before the next tick. [1] rails/execjs#43
Shadowed globals maybe also accessed via
this.console
. This normalizes these globals across all runners. See FAQ (https://github.com/rails/execjs#faq) for why these globals should not be exposed during evaluation.Related #42.