Closed zloirock closed 2 weeks ago
Looks like this regressed in 76b8ecbb6d8c07d29c34fb0b301cc3bf3351e3aa (cc @kt3k).
Looks like the global var segregator (interceptor) in ext/node/global.rs
doesn't transfer(?) property descriptor correctly from inner object at Object.getOwnPropertyDescriptor
call.
The same issue seems happening to window
, which is defined as getter-only property in runtime/js/98_global_scope_window.js
, but Object.getOwnPropertyDescriptor(globalThis, "window")
returns:
{
value: Window {},
writable: true,
enumerable: true,
configurable: true
}
@lucacasonato Do you have any clue on this?
Some notes:
Object.getOwnPropertyDescriptor(globalThis, "self")
is called, descriptor
callback (in ext/node/global.rs
) is not called. Instead getter
callback is called.ext_node_denoGlobals
is exposed to global, Object.getOwnPropertyDescriptor(ext_node_denoGlobals, "self")
returns getter/setter descriptor. definer
interceptor seems correctly working.It looks strange that getter
callback is called at Object.getOwnPropertyDescriptor
call, but one solution (workaround) might be returning v8::Intercepted::No
in getter
intercepter for key self
(and window
).
This is a bug in V8, caused by assuming that an object can only have one ACCESS_CHECK
, and therefore never reaching the INTERCEPTOR
state for the global object: https://source.chromium.org/chromium/chromium/src/+/main:v8/src/objects/js-objects.cc;l=1834;drc=2017cd8a8925f180257662f78eaf9eb93e8e394d?q=js-objects.cc&ss=chromium
I have submitted a patch here: https://chromium-review.googlesource.com/c/v8/v8/+/5737946
It seems it's fixed in 1.46.0.
globalThis.self
should be a getter, but 1.45.3 breaks it - here it's a usual property:Before that:
That enforces
core-js
to load a polyfill and patch it.