Skip to content

Commit ca3eab1

Browse files
committed
Fix-ups
1 parent 99ed523 commit ca3eab1

File tree

1 file changed

+32
-25
lines changed

1 file changed

+32
-25
lines changed

spec.bs

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ WPT Display: open
2626
urlPrefix: https://tc39.es/ecma262/#; spec: ECMASCRIPT
2727
type: dfn
2828
text: current realm
29-
text: an Object; url: sec-object-type
30-
text: IsPromise; url: sec-ispromise
31-
text: GetMethod; url: sec-getmethod
29+
text: Object; url: sec-object-type
3230
text: GetIteratorFromMethod; url: sec-getiteratorfrommethod
3331
text: IteratorStepValue; url: sec-iteratorstepvalue
3432
text: normal completion; url: sec-normalcompletion
3533
text: throw completion; url: sec-throwcompletion
34+
url: sec-returnifabrupt-shorthands
35+
text: ?
36+
type: abstract-op
37+
text: Type; url: sec-ecmascript-data-types-and-values
3638
urlPrefix: https://dom.spec.whatwg.org; spec: DOM
3739
type: dfn
3840
for: event listener
@@ -466,18 +468,24 @@ An <dfn>internal observer</dfn> is a [=struct=] with the following [=struct/item
466468
the iterable protocols to the object, will not take affect between the creation of the returned
467469
observable, and when it is subscribed to.
468470

469-
1. If |value| is not [=an Object=], throw a {{TypeError}}.
471+
1. If [$Type$](|value|) is not [=Object=], [=exception/throw=] a {{TypeError}}.
470472

471-
Note: This prevents primitive types from being coerced into iterables (e.g. String).
473+
Note: This prevents primitive types from being coerced into iterables (e.g., String).
472474

473-
1. If |value| is an {{Observable}}, then return |value|.
475+
Issue: See if this is even the behavior we want. See <a
476+
href=https://github.com/WICG/observable/issues/125>WICG/observable#125</a>
474477

475-
1. Let |asyncIteratorMethodRecord| be ? [=GetMethod=](|value|, %Symbol.asyncIterator%).
478+
1. If |value|'s [=specific type=] is an {{Observable}}, then return |value|.
479+
480+
1. Let |asyncIteratorMethodRecord| be [=?=] [$GetMethod$](|value|, {{%Symbol.asyncIterator%}}).
481+
482+
Issue: TODO(dom or keith): This looks wrong. We certainly cannot return abrupt completions
483+
from this method directly to JS.
476484

477485
1. If |asyncIteratorMethodRecord|'s \[[Value]] is not undefined, then:
478486

479-
Note: [=GetMethod=] might return a [=normal completion=] with an undefined value when the
480-
object simply has no asyncIterator method.
487+
Note: [$GetMethod$] might return a [=normal completion=] with an undefined value when the
488+
object simply has no {{%Symbol.asyncIterator%}} method.
481489

482490
1. Let |nextAlgorithm| be the following steps, given |subscriber| and |iterator|:
483491

@@ -495,7 +503,7 @@ An <dfn>internal observer</dfn> is a [=struct=] with the following [=struct/item
495503

496504
1. Otherwise, set |nextPromise| to |nextRecord|'s \[[Value]].
497505

498-
1. React to |nextPromise|:
506+
1. [=React=] to |nextPromise|:
499507

500508
1. If |nextPromise| was fulfilled with value |v|, then:
501509

@@ -509,11 +517,11 @@ An <dfn>internal observer</dfn> is a [=struct=] with the following [=struct/item
509517
1. Return a [=new=] {{Observable}} whose [=Observable/subscribe callback=] is an
510518
algorithm that takes a {{Subscriber}} |subscriber| and does the following:
511519

512-
1. Let |iteratorRecord| be [=GetIteratorFromMethod=](|value|, %Symbol.asyncIterator%).
520+
1. Let |iteratorRecord| be [=GetIteratorFromMethod=](|value|, {{%Symbol.asyncIterator%}}).
513521

514522
1. If |iteratorRecord| is a [=throw completion=] then:
515523

516-
1. [=queue a microtask=] to perform the following steps:
524+
1. [=Queue a microtask=] to perform the following steps:
517525

518526
1. Run |subscriber|'s {{Subscriber/error()}} method, given |iteratorRecord|'s \[[Value]].
519527

@@ -525,11 +533,13 @@ An <dfn>internal observer</dfn> is a [=struct=] with the following [=struct/item
525533
coercing an AsyncIterable never stops the Subscription synchronously, thereby releasing
526534
Zalgo.
527535

528-
1. Let |iteratorMethodRecord| be ? [=GetMethod=](|value|, %Symbol.iterator%).
536+
1. Let |iteratorMethodRecord| be [=?=] [$GetMethod$](|value|, %Symbol.iterator%).
537+
538+
Issue: TODO(dom or keith): Same issue as above with abrupt (throw) completions.
529539

530540
1. If |iteratorMethodRecord|'s \[[Value]] is not undefined, then:
531541

532-
Note: [=GetMethod=] might return a [=normal completion=] with an undefined value when the
542+
Note: [$GetMethod$] might return a [=normal completion=] with an undefined value when the
533543
object simply has no asyncIterator method.
534544

535545
1. Return a [=new=] {{Observable}} whose [=Observable/subscribe callback=] is an
@@ -561,12 +571,12 @@ An <dfn>internal observer</dfn> is a [=struct=] with the following [=struct/item
561571

562572
1. Run |subscriber|'s {{Subscriber/next()}} given |nextRecord|'s \[[Value]].
563573

564-
1. If [=IsPromise=](|value|) is true, then:
574+
1. If [$IsPromise$](|value|) is true, then:
565575

566-
1. Return a [=new=] {{Observable}} whose [=Observable/subscribe callback=] is an
567-
algorithm that takes a {{Subscriber}} |subscriber| and does the following:
576+
1. Return a [=new=] {{Observable}} whose [=Observable/subscribe callback=] is an algorithm
577+
that takes a {{Subscriber}} |subscriber| and does the following:
568578

569-
1. React to |value|:
579+
1. [=React=] to |value|:
570580

571581
1. If |value| was fulfilled with value |v|, then:
572582

@@ -577,8 +587,7 @@ An <dfn>internal observer</dfn> is a [=struct=] with the following [=struct/item
577587
1. If |value| was rejected with reason |r|, then run |subscriber|'s
578588
{{Subscriber/error()}} method, given |r|.
579589

580-
1. Throw a {{TypeError}}.
581-
590+
1. [=exception/Throw=] a {{TypeError}}.
582591
</div>
583592

584593
<div algorithm>
@@ -696,12 +705,10 @@ For now, see [https://github.com/wicg/observable#operators](https://github.com/w
696705
<h4 id=observable-from>{{Observable/from()}}</h4>
697706

698707
<div algorithm>
699-
The <dfn for=Observable method><code>from(|value|)</code></dfn> method steps
700-
are:
701-
702-
1. Return the result of <a for=Observable lt="convert to an Observable">
703-
converting</a> |value| to an Observable.
708+
The <dfn for=Observable method><code>from(|value|)</code></dfn> method steps are:
704709

710+
1. Return the result of <a for=Observable lt="convert to an Observable">converting</a> |value|
711+
to an {{Observable}}. Rethrow any exceptions.
705712
</div>
706713

707714
<h4 id=observable-returning-operators>{{Observable}}-returning operators</h4>

0 commit comments

Comments
 (0)