Open domenic opened 3 months ago
Two observations:
printf
debugging in node_contextify.cc
shows that while both cases with a Proxy call ContextifyContext::PropertyGetterCallback
exactly 4 times (and no other intereptor), the problematic case actually intercepts 2 of the calls, vs 1 for the good case (with an empty proxy handler)This may be a V8 issue that when the global object has an interceptor it will not throw ReferenceError when the property does not exist: https://source.chromium.org/chromium/chromium/src/+/main:v8/src/ic/ic.cc;l=454-481;drc=ee096094e94cdabe44749b7a3c89bdbb4082a527 (When an object has an interceptor, LookupIterator::IsFound()
is always true`, and does not perform an existence check).
When the prototype of vm global object or sandbox object is a proxy, the PropertyGetterCallback
will always return Intercepted::kYes
without existence check.
An alternative would be performing an existence check on every PropertyGetterCallback.
Version
v22.7.0
Platform
Subsystem
vm
What steps will reproduce the bug?
Output:
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
If I instead do
or simply
then I get the expected output:
What do you see instead?
Additional information
I am not 100% sure this is a vm bug. It may be a fundamental limitation of
Proxy
and the complicated ECMAScript spec rules governingReferenceError
vs.TypeError
. But I am pretty sure this is a vm limitation instead:This is blocking jsdom from passing the web platform test window-runtime-error.html once I implement the WindowProperties object (https://github.com/jsdom/jsdom/pull/3765).