Eagerly define interfaces on non-Window globals (#36604)

These changes make us match Gecko's setup for how Window and non-Window
globals are initialized. Since Window globals are much more common than
Worker globals, using lazy interface definitions can be a useful memory
optimization at the expense of increased complexity for property
lookups.

Also adds the MayResolve hook for all globals, which is an optimization
for the JIT to avoid calling resolve hooks unnecessarily.

Testing: Existing test coverage on global interfaces should suffice.

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-04-20 23:32:21 -04:00 committed by GitHub
parent 436dee8450
commit 76ee127af8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 138 additions and 35 deletions

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#window
[Global=Window, Exposed=Window /*, LegacyUnenumerableNamedProperties */]
[Global=Window, Exposed=Window, LegacyUnenumerableNamedProperties, NeedResolve]
/*sealed*/ interface Window : GlobalScope {
// the current browsing context
[LegacyUnforgeable, CrossOriginReadable] readonly attribute WindowProxy window;