summaryrefslogtreecommitdiff
path: root/src/node_contextify.cc
diff options
context:
space:
mode:
authorFranziska Hinkelmann <franzih@chromium.org>2017-02-09 17:46:13 +0100
committerJames M Snell <jasnell@gmail.com>2017-02-11 09:01:15 -0800
commit02371985f1af28ff34da8bc526cadbdb50fe32a9 (patch)
treedba39f9946d1b911e7a7593ae44359df596f8828 /src/node_contextify.cc
parenta33f601267ad2284947e74284e296818fc171d37 (diff)
downloadandroid-node-v8-02371985f1af28ff34da8bc526cadbdb50fe32a9.tar.gz
android-node-v8-02371985f1af28ff34da8bc526cadbdb50fe32a9.tar.bz2
android-node-v8-02371985f1af28ff34da8bc526cadbdb50fe32a9.zip
src: fix delete operator on vm context
In the implementation of the vm module, if a property is successfully deleted on the sandbox, we also need to delete it on the global_proxy object. Therefore, we must not call args.GetReturnValue().Set(). We only intercept, i.e., call args.GetReturnValue().Set(), in the DeleterCallback, if Delete() failed, e.g. because the property was read only. PR-URL: https://github.com/nodejs/node/pull/11266 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/node_contextify.cc')
-rw-r--r--src/node_contextify.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 7710c252b2..ff66ffdaaa 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -456,8 +456,12 @@ class ContextifyContext {
Maybe<bool> success = ctx->sandbox()->Delete(ctx->context(), property);
- if (success.IsJust())
- args.GetReturnValue().Set(success.FromJust());
+ if (success.FromMaybe(false))
+ return;
+
+ // Delete failed on the sandbox, intercept and do not delete on
+ // the global object.
+ args.GetReturnValue().Set(false);
}