@@ -125,6 +125,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262
125
125
text: DefinePropertyOrThrow; url: sec-definepropertyorthrow
126
126
text: DetachArrayBuffer; url: sec-detacharraybuffer
127
127
text: Get; url: sec-get-o-p
128
+ text: GetFunctionRealm; url: sec-getfunctionrealm
128
129
text: GetIterator; url: sec-getiterator
129
130
text: GetMethod; url: sec-getmethod
130
131
text: IsAccessorDescriptor; url: sec-isaccessordescriptor
@@ -189,6 +190,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262
189
190
text: internal method
190
191
text: internal slot
191
192
text: Number type; url: sec-ecmascript-language-types-number-type
193
+ text: Object; for: ECMAScript; url: sec-object-type
192
194
for: ordinary object; url: sec-ordinary-object-internal-methods-and-internal-slots
193
195
text: internal method
194
196
text: internal slot
@@ -870,6 +872,19 @@ its inheritance hierarchy has a cycle. That is, an interface
870
872
|A| cannot inherit from itself, nor can it inherit from another
871
873
interface |B| that inherits from |A|, and so on.
872
874
875
+ <div algorithm>
876
+ The [=list=] of <dfn for=interface>inclusive inherited interfaces</dfn> of an [=interface=] |I|
877
+ is defined as follows:
878
+
879
+ 1. Let |result| be « ».
880
+ 1. Let |interface| be |I|.
881
+ 1. While |interface| is not null:
882
+ 1. [=list/Append=] |interface| to |result|.
883
+ 1. Set |interface| to the [=interface=] that |I| [=interface/inherits=] from, if any, and
884
+ null otherwise.
885
+ 1. Return |result|.
886
+ </div>
887
+
873
888
Note that general multiple inheritance of interfaces is not supported, and
874
889
objects also cannot implement arbitrary sets of interfaces.
875
890
Objects can be defined to implement a single given interface |A|,
@@ -10700,11 +10715,14 @@ the <code>typeof</code> operator will return "function" when applied to an inter
10700
10715
1. Let <|constructor|, |values|> be the result
10701
10716
of passing |S| and |args|.
10702
10717
to the [=overload resolution algorithm=].
10703
- 1. Let |R| be the result of performing
10704
- the actions listed in the description of |constructor|
10705
- with |values| as the argument values.
10718
+ 1. Let |object| be the result of [=internally create a new object implementing the
10719
+ interface|internally creating a new object implementing=] |I|, with |realm| and
10720
+ {{NewTarget}}.
10721
+ 1. Perform the actions listed in the description of |constructor|
10722
+ with |values| as the argument values
10723
+ and |object| as the <emu-val>this</emu-val> value.
10706
10724
Rethrow any exceptions.
10707
- 1. Let |O| be the result of [=converted to an ECMAScript value|converting=] |R |
10725
+ 1. Let |O| be the result of [=converted to an ECMAScript value|converting=] |object |
10708
10726
to an ECMAScript [=interface type=] value |I|.
10709
10727
1. Assert: |O| is an object that implements |I|.
10710
10728
1. Assert: |O|.\[[Realm]] is equal to |realm|.
@@ -12347,12 +12365,65 @@ It is the responsibility of specifications using Web IDL to state
12347
12365
which global environment (or, by proxy, which global object) each platform
12348
12366
object is associated with.
12349
12367
12368
+ <div algorithm>
12369
+ To <dfn export lt=new>create a new object implementing the interface</dfn> |interface|, with a
12370
+ Realm |realm|, perform the following steps:
12371
+
12372
+ 1. Return the result of [=internally create a new object implementing the
12373
+ interface|internally creating a new object implementing=] |interface|, with |realm| and
12374
+ <emu-val>undefined</emu-val>.
12375
+ </div>
12376
+
12377
+ <div algorithm>
12378
+ To <dfn>internally create a new object implementing the interface</dfn> |interface|, with a
12379
+ Realm |realm| and a JavaScript value |newTarget|, perform the following steps:
12380
+
12381
+ 1. Assert: |interface| is [=exposed=] in |realm|.
12382
+ 1. If |newTarget| is <emu-val>undefined</emu-val>, then:
12383
+ 1. Let |prototype| be the [=interface prototype object=] for |interface| in
12384
+ |realm|.
12385
+ 1. Otherwise:
12386
+ 1. Assert: [$IsCallable$](|newTarget|) is true.
12387
+ 1. Let |prototype| be [=?=] [$Get$](|newTarget|, "prototype").
12388
+ 1. If [$Type$](|prototype|) is not Object, then:
12389
+ 1. Let |targetRealm| be [$GetFunctionRealm$](|newTarget|).
12390
+ 1. Set |prototype| to the [=interface prototype object=] for |interface| in
12391
+ |targetRealm|.
12392
+ 1. Let |instance| be a newly created [=ECMAScript/object=] in |realm|.
12393
+ 1. Set |instance|.\[[Prototype]] to |prototype|.
12394
+ 1. Set |instance|'s essential internal methods to the definitions specified in
12395
+ [=ECMA-262 Ordinary object internal methods and internal slots=].
12396
+ 1. Let |interfaces| be the [=inclusive inherited interfaces=] of |interface|.
12397
+ 1. [=list/iterate|For every=] [=interface=] |ancestor interface| in |interfaces|:
12398
+ 1. [=Define the unforgeable regular operations=] of |ancestor interface| on |instance|,
12399
+ given |realm|.
12400
+ 1. [=Define the unforgeable regular attributes=] of |ancestor interface| on |instance|,
12401
+ given |realm|.
12402
+ 1. If |interface| is declared with the [{{Global}}] [=extended attribute=], then:
12403
+ 1. [=Define the regular operations=] of |interface| on |instance|, given |realm|.
12404
+ 1. [=Define the regular attributes=] of |interface| on |instance|, given |realm|.
12405
+ 1. Set |instance|.\[[SetPrototypeOf]] as defined in [[#platform-object-setprototypeof]].
12406
+ 1. Otherwise, if |interfaces| contains an [=interface=] which
12407
+ [=support indexed properties|supports indexed properties=],
12408
+ [=support named properties|named properties=], or both:
12409
+ 1. Set |instance|.\[[GetOwnProperty]] as defined in
12410
+ [[#legacy-platform-object-getownproperty]].
12411
+ 1. Set |instance|.\[[Set]] as defined in
12412
+ [[#legacy-platform-object-set]].
12413
+ 1. Set |instance|.\[[DefineOwnProperty]] as defined in
12414
+ [[#legacy-platform-object-defineownproperty]].
12415
+ 1. Set |instance|.\[[Delete]] as defined in
12416
+ [[#legacy-platform-object-delete]].
12417
+ 1. Set |instance|.\[[PreventExtensions]] as defined in
12418
+ [[#legacy-platform-object-preventextensions]].
12419
+ 1. Set |instance|.\[[OwnPropertyKeys]] as defined in
12420
+ [[#legacy-platform-object-ownpropertykeys]].
12421
+ 1. Return |instance|.
12422
+ </div>
12423
+
12350
12424
The <dfn id="dfn-primary-interface" export>primary interface</dfn> of a platform object
12351
12425
that implements one or more interfaces is the most-derived [=interface=]
12352
- that it implements. The value of the \[[Prototype]] [=internal slot=]
12353
- of the platform object is the [=interface prototype object=]
12354
- of the [=primary interface=]
12355
- from the [=platform object=]’s associated global environment.
12426
+ that it implements.
12356
12427
12357
12428
The global environment that a given [=platform object=]
12358
12429
is associated with can <dfn id="dfn-change-global-environment" for="global environment" export>change</dfn> after it has been created. When
@@ -12368,24 +12439,6 @@ must be the [=qualified name=] of
12368
12439
the [=primary interface=]
12369
12440
of the platform object.
12370
12441
12371
- [=Platform objects=] which implement an [=interface=] which has a [{{Global}}]
12372
- [=extended attribute=] have an internal \[[SetPrototypeOf]] method
12373
- as defined in [[#platform-object-setprototypeof]].
12374
-
12375
- Within a [=Realm=] |realm|,
12376
- for each [=interface=] |interface| implemented by a [=platform object=] |obj|,
12377
- the following steps must be run as part of |obj|'s creation:
12378
-
12379
- 1. [=Define the unforgeable regular operations=] of |interface| on |obj|, given |realm|.
12380
- 1. [=Define the unforgeable regular attributes=] of |interface| on |obj|, given |realm|.
12381
-
12382
- If within a [=Realm=] |realm| a [=platform object=] |obj| implements
12383
- an interface |interface| which is declared with the [{{Global}}] [=extended attribute=], then
12384
- the following steps must be run as part of |obj|'s creation:
12385
-
12386
- 1. [=Define the regular operations=] of |interface| on |obj|, given |realm|.
12387
- 1. [=Define the regular attributes=] of |interface| on |obj|, given |realm|.
12388
-
12389
12442
Additionally, [=platform objects=] which implement an [=interface=]
12390
12443
which has a [{{Global}}] [=extended attribute=]
12391
12444
get properties declaratively from:
@@ -12447,14 +12500,12 @@ Support for [=getters=] is handled in [[#legacy-platform-object-getownproperty]]
12447
12500
and for [=setters=] in [[#legacy-platform-object-defineownproperty]]
12448
12501
and [[#legacy-platform-object-set]].
12449
12502
12450
- Additionally, [=legacy platform objects=] must have internal methods as defined in:
12503
+ Additionally, [=legacy platform objects=] have internal methods as defined in:
12451
12504
12452
12505
* [[#legacy-platform-object-delete]],
12453
12506
* [[#legacy-platform-object-preventextensions]], and
12454
12507
* [[#legacy-platform-object-ownpropertykeys]].
12455
12508
12456
- Issue: Define those internal methods imperatively instead.
12457
-
12458
12509
12459
12510
<h4 id="legacy-platform-object-getownproperty" dfn oldids="getownproperty" lt=GetOwnProperty for="legacy platform object">\[[GetOwnProperty]]</h4>
12460
12511
@@ -13325,10 +13376,8 @@ Each {{DOMException}} object has an associated <dfn for="DOMException">name</dfn
13325
13376
The <dfn constructor for="DOMException"><code>DOMException(|message|, |name|)</code></dfn>
13326
13377
constructor, when invoked, must run these steps:
13327
13378
13328
- 1. Let |e| be a new {{DOMException}} object.
13329
- 1. Set |e|'s [=DOMException/name=] to |name|.
13330
- 1. Set |e|'s [=DOMException/message=] to |message|.
13331
- 1. Return |e|.
13379
+ 1. Set <emu-val>this</emu-val>'s [=DOMException/name=] to |name|.
13380
+ 1. Set <emu-val>this</emu-val>'s [=DOMException/message=] to |message|.
13332
13381
13333
13382
The <dfn attribute for="DOMException"><code>name</code></dfn> attribute's getter must return this
13334
13383
{{DOMException}} object's [=DOMException/name=].
0 commit comments