@@ -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,27 +587,38 @@ Intercepted ContextifyContext::PropertySetterCallback(
587587 return Intercepted::kNo ;
588588 }
589589
590- // true for x = 5
591- // false for this.x = 5
592- // false for Object.defineProperty(this, 'foo', ...)
593- // false for vmResult.x = 5 where vmResult = vm.runInContext();
594- bool is_contextual_store = ctx->global_proxy () != args.This ();
595-
596- // Indicator to not return before setting (undeclared) function declarations
597- // on the sandbox in strict mode, i.e. args.ShouldThrowOnError() = true.
598- // True for 'function f() {}', 'this.f = function() {}',
599- // 'var f = function()'.
600- // In effect only for 'function f() {}' because
601- // var f = function(), is_declared = true
602- // this.f = function() {}, is_contextual_store = false.
603- bool is_function = value->IsFunction ();
604-
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.
605597 bool is_declared = is_declared_on_global_proxy || is_declared_on_sandbox;
606- if (!is_declared && args.ShouldThrowOnError () && is_contextual_store &&
607- !is_function) {
608- return Intercepted::kNo ;
609- }
610598
599+ /*
600+ // true for x = 5
601+ // false for this.x = 5
602+ // false for Object.defineProperty(this, 'foo', ...)
603+ // false for vmResult.x = 5 where vmResult = vm.runInContext();
604+
605+ bool is_contextual_store = ctx->global_proxy() != args.This();
606+
607+ // Indicator to not return before setting (undeclared) function declarations
608+ // on the sandbox in strict mode, i.e. args.ShouldThrowOnError() = true.
609+ // True for 'function f() {}', 'this.f = function() {}',
610+ // 'var f = function()'.
611+ // In effect only for 'function f() {}' because
612+ // var f = function(), is_declared = true
613+ // this.f = function() {}, is_contextual_store = false.
614+ bool is_function = value->IsFunction();
615+
616+ bool is_declared = is_declared_on_global_proxy || is_declared_on_sandbox;
617+ if (!is_declared && args.ShouldThrowOnError() && is_contextual_store &&
618+ !is_function) {
619+ return Intercepted::kNo;
620+ }
621+ */
611622 if (!is_declared && property->IsSymbol ()) {
612623 return Intercepted::kNo ;
613624 }
0 commit comments