-
Notifications
You must be signed in to change notification settings - Fork 339
deps,src: workaround vm.runInContext issue with top level "var" #542
Conversation
Looks like OSX failed due to running out of disk. |
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.
Looks like there is a node test |
void CacheGlobalProperties(); | ||
void ResolveGlobalChanges(JsValueRef sandbox); | ||
|
||
|
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.
nit: extra newline
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.
Fixed
deps/chakrashim/lib/chakra_shim.js
Outdated
return true; | ||
} | ||
utils.afterContext = function (beforeDescriptors, contextGlobal, sandbox) { | ||
try{ |
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.
nit: spacing around braces. I think the linter on Windows should have caught it.
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.
Fixed.
e610a21
to
e772faf
Compare
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>
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>
e772faf
to
e7643d2
Compare
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>
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>
addresses #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.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes