diff options
author | Franziska Hinkelmann <franzih@chromium.org> | 2017-02-09 17:46:13 +0100 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-02-11 09:01:15 -0800 |
commit | 02371985f1af28ff34da8bc526cadbdb50fe32a9 (patch) | |
tree | dba39f9946d1b911e7a7593ae44359df596f8828 /src/node_contextify.cc | |
parent | a33f601267ad2284947e74284e296818fc171d37 (diff) | |
download | node-new-02371985f1af28ff34da8bc526cadbdb50fe32a9.tar.gz |
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.cc | 8 |
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); } |