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

Allow for global objects with a mutable prototype chain #1381

Merged
merged 4 commits into from
Jan 15, 2024
Merged
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
12 changes: 11 additions & 1 deletion index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -9687,6 +9687,10 @@ from other interfaces. Specifically:
will correspond to properties on the object itself rather than on
[=interface prototype objects=].

A [=realm=] can be defined to
<dfn export for="realm" lt="has a mutable global prototype chain">have a mutable global prototype chain</dfn>.
If a [=realm=] is not defined as such, the prototype of its global object can not be changed.
Ms2ger marked this conversation as resolved.
Show resolved Hide resolved

<div class="note">

Placing named properties on an object in the prototype chain
Expand Down Expand Up @@ -11498,7 +11502,9 @@ with the [{{LegacyNoInterfaceObject}}] [=extended attribute=].
1. Otherwise, set |proto| to |realm|.\[[Intrinsics]].[[{{%Object.prototype%}}]].
1. Assert: <a abstract-op>Type</a>(|proto|) is Object.
1. Let |interfaceProtoObj| be null.
1. If |interface| is declared with the [{{Global}}] [=extended attribute=], or
1. If |realm| [=realm/has a mutable global prototype chain=], then:
1. Set |interfaceProtoObj| to [$OrdinaryObjectCreate$](|proto|).
1. Otherwise, if |interface| is declared with the [{{Global}}] [=extended attribute=], or
|interface| is in the set of [=inherited interfaces=] of an interface
that is declared with the [{{Global}}] [=extended attribute=], then:
1. Set |interfaceProtoObj| to [$MakeBasicObject$](« \[[Prototype]], \[[Extensible]] »).
Expand Down Expand Up @@ -11676,6 +11682,8 @@ is the concatenation of the [=interface=]'s
When the \[[SetPrototypeOf]] internal method of a [=named properties object=] |O| is called with
ECMAScript language value |V|, the following step is taken:

1. If |O|'s [=associated realm=] [=realm/has a mutable global prototype chain=],
return [=?=] [$OrdinarySetPrototypeOf$](|O|, |V|).
1. Return [=?=] <a abstract-op>SetImmutablePrototype</a>(|O|, |V|).

</div>
Expand Down Expand Up @@ -13494,6 +13502,8 @@ Issue: Define those properties imperatively instead.
[=interface=] with the [{{Global}}] [=extended attribute=] is called with
ECMAScript language value |V|, the following step is taken:

1. If |O|'s [=associated realm=] [=realm/has a mutable global prototype chain=],
return [=?=] [$OrdinarySetPrototypeOf$](|O|, |V|).
1. Return [=?=] <a abstract-op>SetImmutablePrototype</a>(|O|, |V|).

</div>
Expand Down