From 02371985f1af28ff34da8bc526cadbdb50fe32a9 Mon Sep 17 00:00:00 2001 From: Franziska Hinkelmann Date: Thu, 9 Feb 2017 17:46:13 +0100 Subject: 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 Reviewed-By: James M Snell Reviewed-By: Ben Noordhuis --- src/node_contextify.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/node_contextify.cc') 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 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); } -- cgit v1.2.1