diff options
author | Domenic Denicola <d@domenic.me> | 2015-05-22 19:41:28 -0400 |
---|---|---|
committer | Rod Vagg <rod@vagg.org> | 2015-08-04 11:56:11 -0700 |
commit | 659dadd410a2a0851dd16ca6f8f5e3103bfaf7da (patch) | |
tree | bdc823ac26a90943d752763f113022823276b27e /src | |
parent | 944f68046c028484f3f5e741d63f85d65e08090c (diff) | |
download | node-new-659dadd410a2a0851dd16ca6f8f5e3103bfaf7da.tar.gz |
vm: fix property descriptors of sandbox properties
The GlobalPropertyQueryCallback was changed in 2010 to return an
integer instead of a boolean:
https://groups.google.com/forum/#!topic/v8-users/OOjHJrix-cU
This integer communicates the property descriptors of the property,
instead of just its presence or absence. However, the original
contextify code was probably written before this change, and it was
not updated when porting to Node.js.
Credit to @smikes for the test and the original PR of #885.
Fixes: https://github.com/nodejs/io.js/pull/864
Fixes: https://github.com/nodejs/io.js/pull/885
PR-URL: https://github.com/nodejs/io.js/pull/1773
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src')
-rw-r--r-- | src/node_contextify.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/node_contextify.cc b/src/node_contextify.cc index b52062e72a..d93fb60c69 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -30,6 +30,7 @@ using v8::None; using v8::Object; using v8::ObjectTemplate; using v8::Persistent; +using v8::PropertyAttribute; using v8::PropertyCallbackInfo; using v8::Script; using v8::ScriptCompiler; @@ -406,10 +407,15 @@ class ContextifyContext { Local<Object> proxy_global = PersistentToLocal(isolate, ctx->proxy_global_); - bool in_sandbox = sandbox->GetRealNamedProperty(property).IsEmpty(); - bool in_proxy_global = - proxy_global->GetRealNamedProperty(property).IsEmpty(); - if (!in_sandbox || !in_proxy_global) { + if (sandbox->HasRealNamedProperty(property)) { + PropertyAttribute propAttr = + sandbox->GetRealNamedPropertyAttributes(property).FromJust(); + args.GetReturnValue().Set(propAttr); + } else if (proxy_global->HasRealNamedProperty(property)) { + PropertyAttribute propAttr = + proxy_global->GetRealNamedPropertyAttributes(property).FromJust(); + args.GetReturnValue().Set(propAttr); + } else { args.GetReturnValue().Set(None); } } |