@@ -9756,6 +9756,13 @@ from other interfaces. Specifically:
9756
9756
will correspond to properties on the object itself rather than on
9757
9757
[=interface prototype objects=].
9758
9758
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
+
9759
9766
<div class="note">
9760
9767
9761
9768
Placing named properties on an object in the prototype chain
@@ -11567,7 +11574,9 @@ with the [{{LegacyNoInterfaceObject}}] [=extended attribute=].
11567
11574
1. Otherwise, set |proto| to |realm|.\[[Intrinsics]].[[{{%Object.prototype%}}]].
11568
11575
1. Assert: <a abstract-op>Type</a>(|proto|) is Object.
11569
11576
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
11571
11580
|interface| is in the set of [=inherited interfaces=] of an interface
11572
11581
that is declared with the [{{Global}}] [=extended attribute=], then:
11573
11582
1. Set |interfaceProtoObj| to [$MakeBasicObject$](« \[[Prototype]], \[[Extensible]] »).
@@ -11745,6 +11754,8 @@ is the concatenation of the [=interface=]'s
11745
11754
When the \[[SetPrototypeOf]] internal method of a [=named properties object=] |O| is called with
11746
11755
JavaScript language value |V|, the following step is taken:
11747
11756
11757
+ 1. If |O|'s [=associated realm=]'s [=is global prototype chain mutable=] is true,
11758
+ return [=?=] [$OrdinarySetPrototypeOf$](|O|, |V|).
11748
11759
1. Return [=?=] <a abstract-op>SetImmutablePrototype</a>(|O|, |V|).
11749
11760
11750
11761
</div>
@@ -13563,6 +13574,8 @@ Issue: Define those properties imperatively instead.
13563
13574
[=interface=] with the [{{Global}}] [=extended attribute=] is called with
13564
13575
JavaScript language value |V|, the following step is taken:
13565
13576
13577
+ 1. If |O|'s [=associated realm=]'s [=is global prototype chain mutable=] is true,
13578
+ return [=?=] [$OrdinarySetPrototypeOf$](|O|, |V|).
13566
13579
1. Return [=?=] <a abstract-op>SetImmutablePrototype</a>(|O|, |V|).
13567
13580
13568
13581
</div>
0 commit comments