forked from nodejs/node-chakracore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps,src: workaround vm.runInContext issue with top level "var"
addresses nodejs#420 ChakraCore doesn't handle global objects in the same way as v8, and in particular ChakraCore doesn't support all proxy interceptors there. We attempted to work around this via interceptors in the prototype chain, but that was an imperfect solution, and a top-level "var" declaration would end up adding a property to the global object in a context without going through the interceptors. To work around this in simple cases, we now take a snapshot of properties on the global before running in a context, and diff the changes at the end to patch up changes in the sandbox. This is NOT a complete solution, and in particular will not work if there is any sort of asynchronous operation that changes the state of the global object. It also has behavioral differences if the global object is writable but the sandbox object is not; in node-v8 this will result in the variable silently not being set in the context and instead the value from the sandbox being used, while here we discover the mismatch too late and the new value has been set on the global. PR-URL: nodejs#542 Reviewed-By: Seth Brenith <sethb@microsoft.com> Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
- Loading branch information
Showing
8 changed files
with
143 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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