@@ -463,7 +463,7 @@ ContextifyContext* ContextifyContext::Get(const PropertyCallbackInfo<T>& args) {
463463 // args.GetIsolate()->GetCurrentContext() and take the pointer at
464464 // ContextEmbedderIndex::kContextifyContext, as V8 is supposed to
465465 // push the creation context before invoking these callbacks.
466- return Get (args.This ());
466+ return Get (args.HolderV2 ());
467467}
468468
469469ContextifyContext* ContextifyContext::Get (Local<Object> object) {
@@ -597,10 +597,21 @@ Intercepted ContextifyContext::PropertySetterCallback(
597597 return Intercepted::kNo ;
598598 }
599599
600+ // V8 comment: As long as the context is not detached the contextual accesses
601+ // are the same as regular accesses to `context->Global()`s data property.
602+ // The only difference is that after detaching `args.Holder()` will
603+ // become a new identity and will no longer be equal to `context->Global()`.
604+ // TODO(Node.js): revise the code below as the "contextual"-ness of the
605+ // store is not actually relevant here. Also, new variable declaration is
606+ // reported by V8 via PropertyDefinerCallback.
607+ bool is_declared = is_declared_on_global_proxy || is_declared_on_sandbox;
608+
609+ /*
600610 // true for x = 5
601611 // false for this.x = 5
602612 // false for Object.defineProperty(this, 'foo', ...)
603613 // false for vmResult.x = 5 where vmResult = vm.runInContext();
614+
604615 bool is_contextual_store = ctx->global_proxy() != args.This();
605616
606617 // Indicator to not return before setting (undeclared) function declarations
@@ -617,7 +628,7 @@ Intercepted ContextifyContext::PropertySetterCallback(
617628 !is_function) {
618629 return Intercepted::kNo;
619630 }
620-
631+ */
621632 if (!is_declared && property->IsSymbol ()) {
622633 return Intercepted::kNo ;
623634 }
0 commit comments