Skip to content

Commit 512f172

Browse files
authored
Fix references to invoke and report an exception (#213)
1 parent fe7c0b1 commit 512f172

File tree

1 file changed

+44
-57
lines changed

1 file changed

+44
-57
lines changed

spec.bs

Lines changed: 44 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ The <dfn attribute for=Subscriber><code>signal</code></dfn> getter steps are to
226226
<div algorithm>
227227
The <dfn for=Subscriber method><code>error(|error|)</code></dfn> method steps are:
228228

229-
1. If [=this=]'s [=Subscriber/active=] is false, [=report the exception=] |error|, then return.
229+
1. If [=this=]'s [=Subscriber/active=] is false, [=report an exception=] with |error| and
230+
[=this=]'s [=relevant global object=], then return.
230231

231232
1. If [=this=]'s [=relevant global object=] is a {{Window}} object, and its [=associated
232233
Document=] is not [=Document/fully active=], then return.
@@ -270,10 +271,7 @@ The <dfn attribute for=Subscriber><code>signal</code></dfn> getter steps are to
270271
1. If [=this=]'s [=Subscriber/active=] is true, then [=list/append=] |teardown| to [=this=]'s
271272
[=Subscriber/teardown callbacks=] list.
272273

273-
1. Otherwise, [=invoke=] |teardown|.
274-
275-
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then [=report
276-
the exception=] |E|.
274+
1. Otherwise, [=invoke=] |teardown| with «» and "`report`".
277275
</div>
278276

279277
<div algorithm>
@@ -320,10 +318,7 @@ observable.subscribe({}, {signal: outerController.signal});
320318
Note: This step runs repeatedly because each |teardown| could result in the above
321319
{{Document}} becoming inactive.
322320

323-
1. [=Invoke=] |teardown|.
324-
325-
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then
326-
[=report the exception=] |E|.
321+
1. [=Invoke=] |teardown| with «» and "`report`".
327322
</div>
328323

329324
<h3 id=observable-api>The {{Observable}} interface</h3>
@@ -442,7 +437,7 @@ callback). The return value of {{EventTarget/when()}} is an example of the latte
442437
The <dfn>default error algorithm</dfn> is an algorithm that takes an {{any}} |error|, and runs
443438
these steps:
444439

445-
1. [=Report the exception=] |error|.
440+
1. [=Report an exception=] with |error| and the [=current realm=]'s [=realm/global object=].
446441

447442
Note: We pull this default out separately so that every place in this specification that natively
448443
<a for=Observable lt="subscribe to an Observable">subscribes</a> to an {{Observable}} (i.e.,
@@ -701,10 +696,7 @@ An <dfn>internal observer</dfn> is a [=struct=] with the following [=struct/item
701696
<dd>Set |internal observer|'s [=internal observer/next steps=] to these steps that take
702697
an {{any}} |value|:
703698

704-
1. [=Invoke=] |observer| with |value|.
705-
706-
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>,
707-
then [=report the exception=] |E|.
699+
1. [=Invoke=] |observer| with «|value|» and "`report`".
708700
</dd>
709701

710702
<dt>If |observer| is a {{SubscriptionObserver}}</dt>
@@ -713,27 +705,21 @@ An <dfn>internal observer</dfn> is a [=struct=] with the following [=struct/item
713705
observer|'s [=internal observer/next steps=] to these steps that take an {{any}}
714706
|value|:
715707

716-
1. [=Invoke=] |observer|'s {{SubscriptionObserver/next}} with |value|.
717-
718-
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>,
719-
then [=report the exception=] |E|.
708+
1. [=Invoke=] |observer|'s {{SubscriptionObserver/next}} with «|value|» and
709+
"`report`".
720710

721711
1. If |observer|'s {{SubscriptionObserver/error}} [=map/exists=], then set |internal
722712
observer|'s [=internal observer/error steps=] to these steps that take an {{any}}
723713
|error|:
724714

725-
1. [=Invoke=] |observer|'s {{SubscriptionObserver/error}} with |error|.
726-
727-
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>,
728-
then [=report the exception=] |E|.
715+
1. [=Invoke=] |observer|'s {{SubscriptionObserver/error}} with «|error|» and
716+
"`report`".
729717

730718
1. If |observer|'s {{SubscriptionObserver/complete}} [=map/exists=], then set
731719
|internal observer|'s [=internal observer/complete steps=] to these steps:
732720

733-
1. [=Invoke=] |observer|'s {{SubscriptionObserver/complete}}.
734-
735-
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>,
736-
then [=report the exception=] |E|.
721+
1. [=Invoke=] |observer|'s {{SubscriptionObserver/complete}} with «» and
722+
"`report`".
737723
</dd>
738724

739725
<dt>If |observer| is an [=internal observer=]</dt>
@@ -797,8 +783,8 @@ An <dfn>internal observer</dfn> is a [=struct=] with the following [=struct/item
797783
subscription|close=] |subscriber| with |options|'s {{SubscribeOptions/signal}}'s
798784
[=AbortSignal/abort reason=].
799785

800-
1. If [=this=]'s [=Observable/subscribe callback=] is a {{SubscribeCallback}}, [=invoke=] it
801-
with |subscriber|.
786+
1. If [=this=]'s [=Observable/subscribe callback=] is a {{SubscribeCallback}}, then [=invoke=]
787+
it with «subscriber» with "`rethrow`".
802788

803789
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, call
804790
|subscriber|'s {{Subscriber/error()}} method with |E|.
@@ -935,8 +921,8 @@ For now, see
935921
1. Let |sourceObserver| be a new [=internal observer=], initialized as follows:
936922

937923
: [=internal observer/next steps=]
938-
:: 1. [=Invoke=] |mapper| with the passed in <var ignore>value</var>, and |idx|, and let
939-
|mappedValue| be the returned value.
924+
:: 1. [=Invoke=] |mapper| with «the passed in <var ignore>value</var>, |idx|» and
925+
"`rethrow`"; let |mappedValue| be the returned value.
940926

941927
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then
942928
run |subscriber|'s {{Subscriber/error()}} method, given |E|, and abort these steps.
@@ -979,8 +965,8 @@ For now, see
979965
1. Let |sourceObserver| be a new [=internal observer=], initialized as follows:
980966

981967
: [=internal observer/next steps=]
982-
:: 1. [=Invoke=] |predicate| with the passed in |value| and |idx|, and let |matches| be
983-
the returned value.
968+
:: 1. [=Invoke=] |predicate| with «the passed in |value|, |idx|» and "`rethrow`"; let
969+
|matches| be the returned value.
984970

985971
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then
986972
run |subscriber|'s {{Subscriber/error()}} method, given |E|, and abort these steps.
@@ -1174,7 +1160,8 @@ For now, see
11741160
{{any}} values |queue|, a [=boolean=] |activeInnerSubscription|, a [=boolean=]
11751161
|outerSubscriptionHasCompleted|, and an {{unsigned long long}} |idx|:
11761162

1177-
1. Let |mappedResult| be the result of [=invoking=] |mapper| with |value| and |idx|.
1163+
1. Let |mappedResult| be the result of [=invoking=] |mapper| with «|value|, |idx|» and
1164+
"`rethrow`".
11781165

11791166
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then run
11801167
|subscriber|'s {{Subscriber/error()}} method, given |E|, and abort these steps.
@@ -1307,7 +1294,8 @@ For now, see
13071294
{{AbortController}} |activeInnerAbortController|, a [=boolean=] |outerSubscriptionHasCompleted|,
13081295
and an {{unsigned long long}} |idx| are to run these steps:
13091296

1310-
1. Let |mappedResult| be the result of [=invoking=] |mapper| with |value| and |idx|.
1297+
1. Let |mappedResult| be the result of [=invoking=] |mapper| with «|value|, |idx|» and
1298+
"`rethrow`".
13111299

13121300
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then run
13131301
|subscriber|'s {{Subscriber/error()}} method, given |E|, and abort these steps.
@@ -1397,7 +1385,7 @@ For now, see
13971385
1. Let |observable| be a [=new=] {{Observable}} whose [=Observable/subscribe callback=] is an
13981386
algorithm that takes a {{Subscriber}} |subscriber| and does the following:
13991387

1400-
1. If |subscribe callback| is not null, then [=invoke=] it.
1388+
1. If |subscribe callback| is not null, then [=invoke=] it with «» and "`rethrow`".
14011389

14021390
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then run
14031391
|subscriber|'s {{Subscriber/error()}} method, given |E|, and abort these steps.
@@ -1408,17 +1396,14 @@ For now, see
14081396
algorithm=] to |subscriber|'s [=Subscriber/subscription controller=]'s
14091397
[=AbortController/signal=]:
14101398

1411-
1. [=Invoke=] |abort callback| with |subscriber|'s [=Subscriber/subscription
1412-
controller=]'s [=AbortController/signal=]'s [=AbortSignal/abort reason=].
1413-
1414-
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then
1415-
[=report the exception=] |E|.
1399+
1. [=Invoke=] |abort callback| with «|subscriber|'s [=Subscriber/subscription
1400+
controller=]'s [=AbortController/signal=]'s [=AbortSignal/abort reason=]» and "`report`".
14161401

14171402
1. Let |sourceObserver| be a new [=internal observer=], initialized as follows:
14181403

14191404
: [=internal observer/next steps=]
1420-
:: 1. If |next callback| is not null, then [=invoke=] |next callback| with the passed in
1421-
|value|.
1405+
:: 1. If |next callback| is not null, then [=invoke=] |next callback| with «the passed in
1406+
|value|» and "`rethrow`".
14221407

14231408
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>,
14241409
then:
@@ -1446,8 +1431,8 @@ For now, see
14461431
:: 1. [=AbortSignal/Remove=] |abort callback| from |subscriber|'s
14471432
[=Subscriber/subscription controller=]'s [=AbortController/signal=].
14481433

1449-
1. If |error callback| is not null, then [=invoke=] |error callback| given the passed
1450-
in |error|.
1434+
1. If |error callback| is not null, then [=invoke=] |error callback| with «the passed
1435+
in |error|» and "`rethrow`".
14511436

14521437
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then
14531438
run |subscriber|'s {{Subscriber/error()}} method, given |E|, and abort these steps.
@@ -1458,7 +1443,8 @@ For now, see
14581443
:: 1. [=AbortSignal/Remove=] |abort callback| from |subscriber|'s
14591444
[=Subscriber/subscription controller=]'s [=AbortController/signal=].
14601445

1461-
1. If |complete callback| is not null, then [=invoke=] |complete callback|.
1446+
1. If |complete callback| is not null, then [=invoke=] |complete callback| with «»
1447+
and "`rethrow`".
14621448

14631449
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then
14641450
run |subscriber|'s {{Subscriber/error()}} method, given |E|, and abort these steps.
@@ -1494,8 +1480,8 @@ For now, see
14941480

14951481
: [=internal observer/error steps=]
14961482
::
1497-
1. [=Invoke=] |callback| with the passed in <var ignore>error</var>. Let |result| be
1498-
the returned value.
1483+
1. [=Invoke=] |callback| with «the passed in <var ignore>error</var>» and "`rethrow`".
1484+
Let |result| be the returned value.
14991485

15001486
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then
15011487
run |subscriber|'s {{Subscriber/error()}} with |E|, and abort these steps.
@@ -1687,7 +1673,8 @@ For now, see
16871673

16881674
: [=internal observer/next steps=]
16891675
::
1690-
1. [=Invoke=] |callback| with the passed in <var ignore>value</var>, and |idx|.
1676+
1. [=Invoke=] |callback| with «the passed in <var ignore>value</var>, |idx|» and
1677+
"`rethrow`".
16911678

16921679
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then
16931680
[=reject=] |p| with |E|, and [=AbortController/signal abort=] |visitor callback
@@ -1741,8 +1728,8 @@ For now, see
17411728
1. Let |observer| be a new [=internal observer=], initialized as follows:
17421729

17431730
: [=internal observer/next steps=]
1744-
:: 1. [=Invoke=] |predicate| with the passed in <var ignore>value</var> and |idx|, and let
1745-
|passed| be the returned value.
1731+
:: 1. [=Invoke=] |predicate| with «the passed in <var ignore>value</var>, |idx|» and
1732+
"`rethrow`"; let |passed| be the returned value.
17461733

17471734
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then
17481735
[=reject=] |p| with |E|, and [=AbortController/signal abort=] |controller| with |E|.
@@ -1889,8 +1876,8 @@ For now, see
18891876
1. Let |observer| be a new [=internal observer=], initialized as follows:
18901877

18911878
: [=internal observer/next steps=]
1892-
:: 1. [=Invoke=] |predicate| with the passed in |value| an |idx|, and let |passed| be the
1893-
returned value.
1879+
:: 1. [=Invoke=] |predicate| with «the passed in |value|, |idx|» and "`rethrow`"; let
1880+
|passed| be the returned value.
18941881

18951882
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then
18961883
[=reject=] |p| with |E|, and [=AbortController/signal abort=] |controller| with |E|.
@@ -1942,8 +1929,8 @@ For now, see
19421929
1. Let |observer| be a new [=internal observer=], initialized as follows:
19431930

19441931
: [=internal observer/next steps=]
1945-
:: 1. [=Invoke=] |predicate| with the passed in <var ignore>value</var> and |idx|, and let
1946-
|passed| be the returned value.
1932+
:: 1. [=Invoke=] |predicate| with «the passed in <var ignore>value</var>, |idx|» and
1933+
"`rethrow`"; let |passed| be the returned value.
19471934

19481935
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then
19491936
[=reject=] |p| with |E|, and [=AbortController/signal abort=] |controller| with |E|.
@@ -2007,9 +1994,9 @@ For now, see
20071994
eventually emitted, we will call |reducer| with *it* as the {{Reducer/currentValue}},
20081995
and the first value (that we're saving here) as the {{Reducer/accumulator}}.
20091996

2010-
1. [=Invoke=] |reducer| with |accumulator| as {{Reducer/accumulator}}, the passed in
2011-
|value| as {{Reducer/currentValue}}, and |idx| as {{Reducer/index}}. Let |result| be
2012-
the returned value.
1997+
1. [=Invoke=] |reducer| with «|accumulator| as {{Reducer/accumulator}}, the passed in
1998+
|value| as {{Reducer/currentValue}}, |idx| as {{Reducer/index}}» and "`rethrow`". Let
1999+
|result| be the returned value.
20132000

20142001
If <a spec=webidl lt="an exception was thrown">an exception |E| was thrown</a>, then
20152002
[=reject=] |p| with |E|, and [=AbortController/signal abort=] |controller| with |E|.

0 commit comments

Comments
 (0)