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

[WIP] Implement the named properties object #96

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

TimothyGu
Copy link
Member

This PR forces all interfaces annotated with [PrimaryGlobal] or [Global] and that supports named getter to become factories, the reasoning being that [[GetOwnProperty]] of the named properties object (which is window.__proto__.__proto__) needs to be able to access window, which is of course impossible when window hasn't been created yet. Thus, the caller would do roughly something like the following to make window available to the [[GetOwnProperty]] hook:

const createWindowInterface = require("../generated/Window");
const defaultPrivateData = {};
const Window = createWindowInterface(defaultPrivateData);
const window = Window.create([], { options });
defaultPrivateData.globalObject = window;

The implementation class only needs to implement @@supportsPropertyName and @@namedGet (or only the latter if [WebIDL2JSValueAsUnsupported] is used); @@supportedPropertyNames is not necessary since named properties object does not support property name iteration.

This PR is considered finished, but DO NOT MERGE since it's very likely there still remain a significant number of bugs as the jsdom counterpart is not yet complete, and this code is essentially untested (other than the output is valid JavaScript).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant