@@ -6241,6 +6241,9 @@ An [=identifier=] that identifies
6241
6241
a [=callback function=] is used to refer to
6242
6242
a type whose values are references to objects that are functions with the given signature.
6243
6243
6244
+ Note: If the [{{TreatNonObjectAsNull}}] [=extended attribute=] is specified on the [=definition=] of
6245
+ the [=callback function=], the values can be references to objects that are not functions.
6246
+
6244
6247
An IDL value of the callback function type is represented by a tuple of an object
6245
6248
reference and a [=callback context=].
6246
6249
@@ -10485,16 +10488,13 @@ that does specify [{{SecureContext}}].
10485
10488
10486
10489
</div>
10487
10490
10488
- If the [{{TreatNonObjectAsNull}}]
10489
- [=extended attribute=]
10490
- appears on a [=callback function=],
10491
- then it indicates that any value assigned to an [=attribute=]
10492
- whose type is a [=nullable type|nullable=]
10493
- [=callback function=]
10494
- that is not an object will be converted to
10495
- the <emu-val>null</emu-val> value.
10496
-
10497
- See [[#es-nullable-type]]
10491
+ If the [{{TreatNonObjectAsNull}}] [=extended attribute=] appears on a [=callback function=], then
10492
+ it indicates that any value assigned to an [=attribute=] whose type is a [=nullable type|nullable=]
10493
+ [=callback function=] will be converted more loosely: if the value is not an object, it will be
10494
+ converted to null, and if the value is not [=ECMAScript/callable=], it will be converted to a
10495
+ [=callback function=] value that does nothing when called.
10496
+
10497
+ See [[#es-nullable-type]], [[#es-callback-function]] and [[#es-invoking-callback-functions]]
10498
10498
for the specific requirements that the use of
10499
10499
[{{TreatNonObjectAsNull}}] entails.
10500
10500
@@ -10519,7 +10519,7 @@ for the specific requirements that the use of
10519
10519
</pre>
10520
10520
10521
10521
In an ECMAScript implementation, assigning a value that is not
10522
- an object (such as a Number value)
10522
+ an object (such as a Number value), or that is not [=ECMAScript/callable=]
10523
10523
to handler1 will have different behavior from that when assigning
10524
10524
to handler2:
10525
10525
@@ -10534,11 +10534,19 @@ for the specific requirements that the use of
10534
10534
} catch (e) {
10535
10535
}
10536
10536
10537
+ try {
10538
+ manager.handler1 = {}; // Throws a TypeError.
10539
+ } catch (e) {
10540
+ }
10541
+
10537
10542
manager.handler2 = function() { };
10538
10543
manager.handler2; // Evaluates to the function.
10539
10544
10540
10545
manager.handler2 = 123;
10541
10546
manager.handler2; // Evaluates to null.
10547
+
10548
+ manager.handler2 = {};
10549
+ manager.handler2; // Evaluates to the object.
10542
10550
</pre>
10543
10551
</div>
10544
10552
@@ -13744,11 +13752,9 @@ described in the previous section).
13744
13752
1. If |thisArg| was not given, let |thisArg| be <emu-val>undefined</emu-val>.
13745
13753
1. Let |F| be the ECMAScript object corresponding to |callable|.
13746
13754
1. If [=!=] <a abstract-op>IsCallable</a>(|F|) is <emu-val>false</emu-val>:
13747
- 1. If the callback function's return type is {{void}}, return.
13748
-
13749
- Note: This is only possible when the callback function came from an attribute
13755
+ 1. Note: This is only possible when the [=callback function=] came from an attribute
13750
13756
marked with [{{TreatNonObjectAsNull}}].
13751
-
13757
+ 1. If the callback function's return type is {{void}}, return.
13752
13758
1. Return the result of [=converted to an IDL value|converting=]
13753
13759
<emu-val>undefined</emu-val> to the callback function's return type.
13754
13760
1. Let |realm| be |F|'s [=associated Realm=].
0 commit comments