[webkit-changes] [WebKit/WebKit] f3f3af: Implement Observable#first
Marais Rossouw
noreply at github.com
Thu Oct 24 08:05:04 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f3f3afde18272fdabcd5901b755b47bef3b77da2
https://github.com/WebKit/WebKit/commit/f3f3afde18272fdabcd5901b755b47bef3b77da2
Author: Marais Rossouw <me at marais.co>
Date: 2024-10-24 (Thu, 24 Oct 2024)
Changed paths:
M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-first.any-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-first.any.js
M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-first.any.worker-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-last.any.js
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
A Source/WebCore/dom/InternalObserverFirst.cpp
A Source/WebCore/dom/InternalObserverFirst.h
M Source/WebCore/dom/InternalObserverLast.cpp
M Source/WebCore/dom/InternalObserverLast.h
M Source/WebCore/dom/Observable.cpp
M Source/WebCore/dom/Observable.h
M Source/WebCore/dom/Observable.idl
M Source/WebCore/dom/Subscriber.cpp
M Source/WebCore/dom/Subscriber.h
Log Message:
-----------
Implement Observable#first
https://bugs.webkit.org/show_bug.cgi?id=277509
Reviewed by Chris Dumez and Darin Adler.
This change introduces the `.first` promise-returning operator
for Observables, using the InternalObserver and subscribing immediately.
This is required by the specification https://wicg.github.io/observable/#dom-observable-first
Because promise-returning operators subscribe immediatly in the runtime,
as opposed to user-land. We made a change to the Subscriber class to
now hold a reference to it's options, specifically any AbortSignals.
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-last.any.js: Rebaselined.
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-first.any-expected.txt: Rebaselined.
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-first.any.worker-expected.txt: Rebaselined.
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-first.any.js:
AbortErrors' description text is not normative,
as such do not assert against it.
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/Observable.h:
* Source/WebCore/dom/Observable.cpp:
(WebCore::Observable::first): Added.
(WebCore::Observable::subscribeInternal):
Move the abort signal following logic inside the Subscriber class.
* Source/WebCore/dom/Observable.idl:
Exposes `Promise<any> first(options)` as a promise-returning operator.
* Source/WebCore/dom/Subscriber.h:
* Source/WebCore/dom/Subscriber.cpp:
(WebCore::Subscriber::create):
(WebCore::Subscriber::Subscriber):
When a subscriber is created, it should own the options for the
lifetime of the subscriber.
* Source/WebCore/dom/InternalObserverLast.cpp:
Addressed diff feedback for `.first` in here as well.
* Source/WebCore/dom/InternalObserverLast.h:
* Source/WebCore/dom/InternalObserverFirst.cpp: Added.
(WebCore::createInternalObserverOperatorFirst):
* Source/WebCore/dom/InternalObserverFirst.h: Added.
Canonical link: https://commits.webkit.org/285650@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list