This PR "fixes" Observable unsubscription/teardown timing. As a matter
of accidental historical precedent, Observables in JavaScript (but not
in other languages) had implemented the "rule" that upon
Subscriber#error() or Subscriber#complete(), the subscriber would:
First, invoke the appropriate Observer callback, if provided (i.e.,
complete() or error() callback).
Signal abort Subscriber#signal, which invokes any teardowns and also
fires the abort event at the signal.
However, after dom@chromium.org discussed this more with
ben@benlesh.com, we came to the conclusion that the principle of "as
soon as you know you will teardown, you MUST close the subscription and
any upstream subscriptions" should be followed. This means the above
steps must be inverted. This is a small-in-size but medium-in-impact
design change for the Observable concept, and led to a blog post and
an announcement that the RxJS library intends to change its
historical ordering of these events.
This PR "fixes" Observable unsubscription/teardown timing. As a matter of accidental historical precedent, Observables in JavaScript (but not in other languages) had implemented the "rule" that upon Subscriber#error() or Subscriber#complete(), the subscriber would:
abort
event at the signal.However, after dom@chromium.org discussed this more with ben@benlesh.com, we came to the conclusion that the principle of "as soon as you know you will teardown, you MUST close the subscription and any upstream subscriptions" should be followed. This means the above steps must be inverted. This is a small-in-size but medium-in-impact design change for the Observable concept, and led to a blog post and an announcement that the RxJS library intends to change its historical ordering of these events.
This PR is made alongside https://crrev.com/c/5311097 and https://github.com/web-platform-tests/wpt/pull/44682, which fixes the Chromium implementation and test expectations respectively.
Preview | Diff