Skip to content

Commit 003dd03

Browse files
authored
Allow for global objects with a mutable prototype chain
This is required to define the ShadowRealm global object in IDL.
1 parent 8920a62 commit 003dd03

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

index.bs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9756,6 +9756,13 @@ from other interfaces. Specifically:
97569756
will correspond to properties on the object itself rather than on
97579757
[=interface prototype objects=].
97589758

9759+
All [=realms=] have an <dfn export for="realm">is global prototype chain mutable</dfn> boolean,
9760+
which can be set when the [=realm=] is created.
9761+
Its value can not change during the lifetime of the [=realm=].
9762+
By default it is set to false.
9763+
9764+
<p class="note">This allows the <code>ShadowRealm</code> global to have a mutable prototype.</p>
9765+
97599766
<div class="note">
97609767

97619768
Placing named properties on an object in the prototype chain
@@ -11567,7 +11574,9 @@ with the [{{LegacyNoInterfaceObject}}] [=extended attribute=].
1156711574
1. Otherwise, set |proto| to |realm|.\[[Intrinsics]].[[{{%Object.prototype%}}]].
1156811575
1. Assert: <a abstract-op>Type</a>(|proto|) is Object.
1156911576
1. Let |interfaceProtoObj| be null.
11570-
1. If |interface| is declared with the [{{Global}}] [=extended attribute=], or
11577+
1. If |realm|'s [=is global prototype chain mutable=] is true, then:
11578+
1. Set |interfaceProtoObj| to [$OrdinaryObjectCreate$](|proto|).
11579+
1. Otherwise, if |interface| is declared with the [{{Global}}] [=extended attribute=], or
1157111580
|interface| is in the set of [=inherited interfaces=] of an interface
1157211581
that is declared with the [{{Global}}] [=extended attribute=], then:
1157311582
1. Set |interfaceProtoObj| to [$MakeBasicObject$](« \[[Prototype]], \[[Extensible]] »).
@@ -11745,6 +11754,8 @@ is the concatenation of the [=interface=]'s
1174511754
When the \[[SetPrototypeOf]] internal method of a [=named properties object=] |O| is called with
1174611755
JavaScript language value |V|, the following step is taken:
1174711756

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

1175011761
</div>
@@ -13563,6 +13574,8 @@ Issue: Define those properties imperatively instead.
1356313574
[=interface=] with the [{{Global}}] [=extended attribute=] is called with
1356413575
JavaScript language value |V|, the following step is taken:
1356513576

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

1356813581
</div>

0 commit comments

Comments
 (0)