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

Normative: Restriction on [[Prototype]] of the global object #1967

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -24800,6 +24800,7 @@ <h1>The Global Object</h1>
<li>does not have a [[Construct]] internal method; it cannot be used as a constructor with the `new` operator.</li>
<li>does not have a [[Call]] internal method; it cannot be invoked as a function.</li>
<li>has a [[Prototype]] internal slot whose value is implementation-dependent.</li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the challenges here might be that %Object.prototype% is a Realm-specific value, but i believe the WindowProxy causes the current realm's Object.prototype to report as being in the prototype chain.

Copy link
Contributor

@ExE-Boss ExE-Boss May 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WindowProxy.[[GetPrototypeOf]]() returns null for cross‑origin calls, which are a subset of cross‑realm calls.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right - and null doesn't have Object.prototype in its prototype chain.

<li>is an instance of the standard built-in Object constructor.</li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is “is an instance of the standard built-in Object constructor” an observable status / a defined concept?

I’m guessing the intention here is to say that the [[Prototype]] chain (initially? permanently?) includes %Object.prototype%, which is not the same thing as being an instance of a given constructor as this phrase is used elsewhere. For example,

[A Boolean Object is] a member of the Object type that is an instance of the standard built-in Boolean constructor.

It’s observable (indirectly) that an object is a Boolean Object because the [[BooleanData]] slot is obtained uniquely through creation with the Boolean constructor. It’s incidental that such an object likely has %Boolean.prototype% as its [[Prototype]], and it may not — Object.setPrototypeOf(new Boolean, null) is still a Boolean Object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with your opinion. The sentence "is instance of the the standard built-in Object constructor" does not clearly imply that the prototype chain includes %Object.prototype%. Thus, I just directly wrote that the prototype chain include %Object.prototype% and updated the pull request.

<li>may have host defined properties in addition to the properties defined in this specification. This may include a property whose value is the global object itself.</li>
</ul>

Expand Down