@@ -453,7 +453,7 @@ ContextifyContext* ContextifyContext::Get(const PropertyCallbackInfo<T>& args) {
453453 // args.GetIsolate()->GetCurrentContext() and take the pointer at
454454 // ContextEmbedderIndex::kContextifyContext, as V8 is supposed to
455455 // push the creation context before invoking these callbacks.
456- return Get (args.This ());
456+ return Get (args.HolderV2 ());
457457}
458458
459459ContextifyContext* ContextifyContext::Get (Local<Object> object) {
@@ -587,10 +587,21 @@ Intercepted ContextifyContext::PropertySetterCallback(
587587 return Intercepted::kNo ;
588588 }
589589
590+ // V8 comment: As long as the context is not detached the contextual accesses
591+ // are the same as regular accesses to `context->Global()`s data property.
592+ // The only difference is that after detaching `args.Holder()` will
593+ // become a new identity and will no longer be equal to `context->Global()`.
594+ // TODO(Node.js): revise the code below as the "contextual"-ness of the
595+ // store is not actually relevant here. Also, new variable declaration is
596+ // reported by V8 via PropertyDefinerCallback.
597+ bool is_declared = is_declared_on_global_proxy || is_declared_on_sandbox;
598+
599+ /*
590600 // true for x = 5
591601 // false for this.x = 5
592602 // false for Object.defineProperty(this, 'foo', ...)
593603 // false for vmResult.x = 5 where vmResult = vm.runInContext();
604+
594605 bool is_contextual_store = ctx->global_proxy() != args.This();
595606
596607 // Indicator to not return before setting (undeclared) function declarations
@@ -607,7 +618,7 @@ Intercepted ContextifyContext::PropertySetterCallback(
607618 !is_function) {
608619 return Intercepted::kNo;
609620 }
610-
621+ */
611622 if (!is_declared && property->IsSymbol ()) {
612623 return Intercepted::kNo ;
613624 }
0 commit comments