Skip to content

Commit 7bbff53

Browse files
committed
Imperatively define the global property references
1 parent d534bbe commit 7bbff53

File tree

1 file changed

+53
-21
lines changed

1 file changed

+53
-21
lines changed

index.bs

Lines changed: 53 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262
122122
text: CreateDataProperty; url: sec-createdataproperty
123123
text: CreateIterResultObject; url: sec-createiterresultobject
124124
text: CreateMapIterator; url: sec-createmapiterator
125+
text: CreateMethodProperty; url: sec-createmethodproperty
125126
text: CreateSetIterator; url: sec-createsetiterator
126127
text: DefinePropertyOrThrow; url: sec-definepropertyorthrow
127128
text: DetachArrayBuffer; url: sec-detacharraybuffer
@@ -10654,27 +10655,22 @@ Note: The HTML Standard defines how a security check is performed. [[!HTML]]
1065410655
For every non-callback [=interface=] that is [=exposed=] in
1065510656
a given ECMAScript global environment and that is not declared with
1065610657
the [{{NoInterfaceObject}}] or [{{LegacyNamespace}}] [=extended attributes=],
10657-
a corresponding property must exist on the ECMAScript environment's global object.
10658+
a corresponding property exists on the ECMAScript environment's global object.
1065810659
The name of the property is the [=identifier=] of the interface,
1065910660
and its value is an object called the <dfn id="dfn-interface-object" export>interface object</dfn>.
10660-
The property has the attributes { \[[Writable]]: <emu-val>true</emu-val>, \[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>true</emu-val> }.
1066110661
The characteristics of an interface object are described in [[#interface-object]].
1066210662

1066310663
If the [{{LegacyWindowAlias}}] extended attribute was specified on an [=exposed=] interface,
1066410664
then for each [=LegacyWindowAlias identifier|identifier=] in [{{LegacyWindowAlias}}]'s [=LegacyWindowAlias identifier|identifiers=]
10665-
there must be a corresponding property on the {{Window}} [=interface=].
10665+
there exists a corresponding property on the {{Window}} global object.
1066610666
The name of the property is the given [=LegacyWindowAlias identifier|identifier=],
1066710667
and its value is a reference to the [=interface object=] for the [=interface=].
10668-
The property has the attributes
10669-
{ \[[Writable]]: <emu-val>true</emu-val>, \[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>true</emu-val> }.
1067010668

1067110669
In addition, for every [{{NamedConstructor}}] extended attribute on an [=exposed=] interface,
10672-
a corresponding property must exist on the ECMAScript global object.
10670+
a corresponding property exists on the ECMAScript global object.
1067310671
The name of the property is the [{{NamedConstructor}}]'s [=NamedConstructor identifier|identifier=],
1067410672
and its value is an object called a <dfn id="dfn-named-constructor" export>named constructor</dfn>,
1067510673
which allows construction of objects that implement the interface.
10676-
The property has the attributes
10677-
{ \[[Writable]]: <emu-val>true</emu-val>, \[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>true</emu-val> }.
1067810674
The characteristics of a named constructor are described in [[#named-constructors]].
1067910675

1068010676

@@ -10918,11 +10914,10 @@ the [=interface=]’s [=qualified name=] and the string "<code>Prototype</code>"
1091810914
For every [=callback interface=] that is [=exposed=] in
1091910915
a given ECMAScript global environment
1092010916
and on which [=constants=] are defined,
10921-
a corresponding property must exist on the ECMAScript environment's global object.
10917+
a corresponding property exists on the ECMAScript environment's global object.
1092210918
The name of the property is the [=identifier=] of the interface,
1092310919
and its value is an object called the
1092410920
<dfn id="dfn-legacy-callback-interface-object" export>legacy callback interface object</dfn>.
10925-
The property has the attributes { \[[Writable]]: <emu-val>true</emu-val>, \[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>true</emu-val> }.
1092610921

1092710922
The [=legacy callback interface object=] for a given [=callback interface=]
1092810923
is a [=built-in function object=].
@@ -12424,6 +12419,7 @@ object is associated with.
1242412419
1. If |interface| is declared with the [{{Global}}] [=extended attribute=], then:
1242512420
1. [=Define the regular operations=] of |interface| on |instance|, given |realm|.
1242612421
1. [=Define the regular attributes=] of |interface| on |instance|, given |realm|.
12422+
1. [=Define the global property references=] on |instance|, given |realm|.
1242712423
1. Set |instance|.\[[SetPrototypeOf]] as defined in [[#platform-object-setprototypeof]].
1242812424
1. Otherwise, if |interfaces| contains an [=interface=] which
1242912425
[=support indexed properties|supports indexed properties=],
@@ -12443,6 +12439,43 @@ object is associated with.
1244312439
1. Return |instance|.
1244412440
</div>
1244512441

12442+
<div algorithm>
12443+
To <dfn>define the global property references</dfn> on |target|, given [=Realm=] |realm|,
12444+
perform the following steps:
12445+
12446+
1. [=list/iterate|For every=] non-callback [=interface=] |interface| that is [=exposed=] in
12447+
|realm|:
12448+
1. If |interface| is not declared with the [{{NoInterfaceObject}}] or
12449+
[{{LegacyNamespace}}] [=extended attributes=], then:
12450+
1. Let |id| be |interface|'s [=identifier=].
12451+
1. Let |interfaceObject| be the result of [=create an interface object|creating
12452+
an interface object=] for |interface| with |id| in |realm|.
12453+
1. Perform [=!=] [$CreateMethodProperty$](|target|, |id|, |interfaceObject|).
12454+
1. If the |interface| is declared with a [{{LegacyWindowAlias}}] [=extended attribute=],
12455+
and |target| implements the {{Window}} [=interface=], then:
12456+
1. [=list/iterate|For every=] [=LegacyWindowAlias identifier|identifier=] |id| in
12457+
[{{LegacyWindowAlias}}]'s [=LegacyWindowAlias identifier|identifiers=]:
12458+
1. Perform [=!=] [$CreateMethodProperty$](|target|, |id|, |interfaceObject|).
12459+
1. If the |interface| is declared with a [{{NamedConstructor}}] [=extended attribute=],
12460+
then:
12461+
1. [=list/iterate|For every=] [=NamedConstructor identifier|identifier=] |id| in
12462+
[{{NamedConstructor}}]'s [=NamedConstructor identifier|identifiers=]:
12463+
1. Let |namedConstructor| be the result of [=create a named constructor|creating
12464+
a named constructor=] with |id| for |interface| in |realm|.
12465+
1. Perform [=!=] [$CreateMethodProperty$](|target|, |id|, |namedConstructor|).
12466+
1. [=list/iterate|For every=] [=callback interface=] |interface| that is [=exposed=] in
12467+
|realm| and on which [=constants=] are defined:
12468+
1. Let |id| be |interface|'s [=identifier=].
12469+
1. Let |interfaceObject| be the result of [=create a legacy callback interface
12470+
object|creating a legacy callback interface object=] for |interface| with |id| in |realm|.
12471+
1. Perform [=!=] [$CreateMethodProperty$](|target|, |id|, |interfaceObject|).
12472+
1. [=list/iterate|For every=] [=namespace=] |namespace| that is [=exposed=] in
12473+
|realm|:
12474+
1. Let |id| be |namespace|'s [=identifier=].
12475+
1. Let |namespaceObject| be the result of [=create a namespace object|creating a namespace object=] for |namespace| in |realm|.
12476+
1. Perform [=!=] [$CreateMethodProperty$](|target|, |id|, |namespaceObject|).
12477+
</div>
12478+
1244612479
<div class="note">
1244712480
The set of interfaces that a [=platform object=] [=implements=] does not change over
1244812481
the lifetime of the object.
@@ -13138,32 +13171,31 @@ a return type that is a [=promise type=].
1313813171
<h3 id="es-namespaces">Namespaces</h3>
1313913172

1314013173
For every [=namespace=] that is [=exposed=] in a given ECMAScript global environment,
13141-
a corresponding property must exist on the ECMAScript
13142-
environment's global object. The name of the property is the [=identifier=] of the namespace, and its value is an object
13174+
a corresponding property exists on the ECMAScript environment's global object.
13175+
The name of the property is the [=identifier=] of the namespace, and its value is an object
1314313176
called the <dfn id="dfn-namespace-object" export>namespace object</dfn>.
1314413177

13145-
The property has the attributes
13146-
{ \[[Writable]]: <emu-val>true</emu-val>, \[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>true</emu-val> }.
1314713178
The characteristics of a namespace object are described in [[#namespace-object]].
1314813179

1314913180

1315013181
<h4 id="namespace-object">Namespace object</h4>
1315113182

13152-
<div algorithm="to create a namespace object">
13183+
<div algorithm>
1315313184

1315413185
The namespace object for a given [=namespace=] |namespace| and [=Realm=] |realm|
13155-
is created as follows:
13186+
is <dfn lt="create a namespace object">created</dfn> as follows:
1315613187

1315713188
1. Let |namespaceObject| be
1315813189
[=!=] <a abstract-op>ObjectCreate</a>(|realm|.\[[Intrinsics]].[[{{%ObjectPrototype%}}]]).
1315913190
1. [=Define the regular attributes=] of |namespace| on |namespaceObject| given |realm|.
1316013191
1. [=Define the regular operations=] of |namespace| on |namespaceObject| given |realm|.
1316113192
1. For each [=exposed=] [=interface=] |interface| which has the [{{LegacyNamespace}}] extended
13162-
attribute with the identifier of this namespace as its argument,
13163-
1. Let |I| be the [=interface object=] for |interface|.
13164-
1. Let |newDesc| be the PropertyDescriptor{\[[Writable]]: <emu-val>true</emu-val>,
13165-
\[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>true</emu-val>, \[[Value]]: |I|}.
13166-
1. Perform [=!=] <a abstract-op>DefinePropertyOrThrow</a>(|namespaceObject|, |interface|'s [=identifier=], |newDesc|).
13193+
attribute with the identifier of |namespace| as its argument,
13194+
1. Let |id| be |interface|'s [=identifier=].
13195+
1. Let |interfaceObject| be the result of [=create an interface object|creating an
13196+
interface object=] for |interface| with |id| in |realm|.
13197+
1. Perform [=!=] [$CreateMethodProperty$](|namespaceObject|, |id|, |interfaceObject|).
13198+
1. Return |namespaceObject|.
1316713199
</div>
1316813200

1316913201

0 commit comments

Comments
 (0)