Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.45.3 breaks self descriptor #24683

Closed
zloirock opened this issue Jul 23, 2024 · 5 comments
Closed

1.45.3 breaks self descriptor #24683

zloirock opened this issue Jul 23, 2024 · 5 comments
Labels
bug Something isn't working correctly upstream Changes in upstream are required to solve these issues

Comments

@zloirock
Copy link

globalThis.self should be a getter, but 1.45.3 breaks it - here it's a usual property:

Снимок экрана 2024-07-23 в 09 11 13

Before that:

Снимок экрана 2024-07-23 в 09 45 01

That enforces core-js to load a polyfill and patch it.

zloirock added a commit to zloirock/core-js that referenced this issue Jul 23, 2024
@nathanwhit
Copy link
Member

Looks like this regressed in 76b8ecb (cc @kt3k).

@kt3k
Copy link
Member

kt3k commented Jul 24, 2024

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?

@kt3k
Copy link
Member

kt3k commented Jul 24, 2024

Some notes:

  • When Object.getOwnPropertyDescriptor(globalThis, "self") is called, descriptor callback (in ext/node/global.rs) is not called. Instead getter callback is called.
  • When 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).

@devsnek
Copy link
Member

devsnek commented Jul 24, 2024

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

@zloirock
Copy link
Author

It seems it's fixed in 1.46.0.

zloirock added a commit to zloirock/core-js that referenced this issue Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly upstream Changes in upstream are required to solve these issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants