[webkit-changes] [WebKit/WebKit] 5799af: Implement Observable#reduce

Marais Rossouw noreply at github.com
Tue Dec 10 01:21:02 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5799af7ea9f2c0f39b9857651240967129be2900
      https://github.com/WebKit/WebKit/commit/5799af7ea9f2c0f39b9857651240967129be2900
  Author: Marais Rossouw <me at marais.co>
  Date:   2024-12-10 (Tue, 10 Dec 2024)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-reduce.any-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-reduce.any.js
    M LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-reduce.any.worker-expected.txt
    M Source/WebCore/CMakeLists.txt
    M Source/WebCore/DerivedSources-input.xcfilelist
    M Source/WebCore/DerivedSources-output.xcfilelist
    M Source/WebCore/DerivedSources.make
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/dom/InternalObserverReduce.cpp
    A Source/WebCore/dom/InternalObserverReduce.h
    M Source/WebCore/dom/Observable.cpp
    M Source/WebCore/dom/Observable.h
    M Source/WebCore/dom/Observable.idl
    A Source/WebCore/dom/ReducerCallback.h
    A Source/WebCore/dom/ReducerCallback.idl

  Log Message:
  -----------
  Implement Observable#reduce
https://bugs.webkit.org/show_bug.cgi?id=284287

Reviewed by Darin Adler.

This change introduces the `.reduce` promise-returning operator
for Observables, using the InternalObserver and subscribing immediately.

Unlike our MapperCallback, we need to pass an accumulator as well. As
such, we also introduce a new ReducerCallback IDL.

Spec: <https://wicg.github.io/observable/#dom-observable-reduce>

* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-reduce.any-expected.txt: Rebaseline.
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-reduce.any.js: Rebaseline.
* LayoutTests/imported/w3c/web-platform-tests/dom/observable/tentative/observable-reduce.any.worker-expected.txt: Rebaseline.
* Source/WebCore/CMakeLists.txt:
* Source/WebCore/DerivedSources-input.xcfilelist:
* Source/WebCore/DerivedSources-output.xcfilelist:
* Source/WebCore/DerivedSources.make:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/InternalObserverReduce.cpp: Added.
(WebCore::createInternalObserverOperatorReduce):
* Source/WebCore/dom/InternalObserverReduce.h: Added.
* Source/WebCore/dom/Observable.cpp:
(WebCore::Observable::reduce):
* Source/WebCore/dom/Observable.h:
* Source/WebCore/dom/Observable.idl:
Exposes `Promise<any> reduce(reducer, initialValue, options)` as a promise-returning operator.
* Source/WebCore/dom/ReducerCallback.h: Added.
* Source/WebCore/dom/ReducerCallback.idl: Added.

Canonical link: https://commits.webkit.org/287595@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