Undefine globals, not just shadow#43
Merged
rafaelfranca merged 3 commits intorails:masterfrom Jun 21, 2016
josh:undef-process
Merged
Undefine globals, not just shadow#43rafaelfranca merged 3 commits intorails:masterfrom josh:undef-process
rafaelfranca merged 3 commits intorails:masterfrom
josh:undef-process
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.clearInterval; | ||
| delete this.setImmediate; | ||
| delete this.clearImmediate; | ||
| result = program(); |
Contributor
Author
There was a problem hiding this comment.
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.
Member
There was a problem hiding this comment.
What is blocking us to change this right now? The version of node that support vm.Script?
Contributor
Author
There was a problem hiding this comment.
The version of node that support vm.Script?
It is well supported, but that change would be a substantial refactoring.
Contributor
Author
|
cc @arthurnn |
Contributor
Author
|
🎉 thanks @rafaelfranca! |
Member
|
Thank you. I'll release a new version later today. |
|
@rafaelfranca. Any chance of that new version this week? |
Member
|
Yes. I can do in a few minutes. |
tf
added a commit
to tf/video.js
that referenced
this pull request
May 25, 2021
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
tf
added a commit
to tf/video.js
that referenced
this pull request
May 25, 2021
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
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.