[webkit-changes] [WebKit/WebKit] d94b20: Performing a micro tasks checkpoint should notify ...
Chris Dumez
noreply at github.com
Thu Sep 22 15:34:55 PDT 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d94b209da5dbab0b2e45adbf8bda39ec3a5d4b31
https://github.com/WebKit/WebKit/commit/d94b209da5dbab0b2e45adbf8bda39ec3a5d4b31
Author: Chris Dumez <cdumez at apple.com>
Date: 2022-09-22 (Thu, 22 Sep 2022)
Changed paths:
M LayoutTests/TestExpectations
M LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt
M LayoutTests/http/wpt/webauthn/public-key-credential-get-failure.https-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/tasks.window-expected.txt
M LayoutTests/platform/glib/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-resources.https-expected.txt
M Source/WebCore/bindings/js/JSExecState.cpp
M Source/WebCore/dom/Document.cpp
M Source/WebCore/dom/EmptyScriptExecutionContext.h
M Source/WebCore/dom/EventLoop.cpp
M Source/WebCore/dom/EventLoop.h
M Source/WebCore/dom/Microtasks.cpp
M Source/WebCore/dom/Microtasks.h
M Source/WebCore/dom/ScriptExecutionContext.h
M Source/WebCore/dom/WindowEventLoop.cpp
M Source/WebCore/workers/WorkerEventLoop.cpp
Log Message:
-----------
Performing a micro tasks checkpoint should notify about rejected promises
https://bugs.webkit.org/show_bug.cgi?id=245454
Reviewed by Darin Adler and Ryosuke Niwa.
Performing a micro tasks checkpoint should notify about rejected promises:
- https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model:notify-about-rejected-promises (Step 4)
Previously, we would notify about rejected promises in JSExecState::didLeaveScriptContext(),
after performing the microtasks checkpoint. However, there were 2 issues with that:
1. Per the specification, we're supposed to notify about rejected promises every time we
perform a microtasks checkpoint. However, JSExecState::didLeaveScriptContext() is not
the only place to perform a microtasks checkpoint. As a result, it makes more sense
to do the notification as part of the checkpoint steps, like in the spec.
2. We were doing the "notify about rejected promises" step only for the context we were
leaving. However, the specification says to do it in every context associated with this
event loop.
This patch addresses both issues and helps us pass one more WPT test. Note that this test
was already passing in both Chrome and Firefox.
* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/tasks.window-expected.txt:
* Source/WebCore/bindings/js/JSExecState.cpp:
(WebCore::JSExecState::didLeaveScriptContext):
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::~Document):
(WebCore::Document::windowEventLoop):
* Source/WebCore/dom/EmptyScriptExecutionContext.h:
* Source/WebCore/dom/EventLoop.cpp:
(WebCore::EventLoop::forEachAssociatedContext):
(WebCore::EventLoop::addAssociatedContext):
(WebCore::EventLoop::removeAssociatedContext):
* Source/WebCore/dom/EventLoop.h:
* Source/WebCore/dom/Microtasks.cpp:
(WebCore::MicrotaskQueue::MicrotaskQueue):
(WebCore::MicrotaskQueue::performMicrotaskCheckpoint):
* Source/WebCore/dom/Microtasks.h:
* Source/WebCore/dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::rejectedPromiseTracker):
* Source/WebCore/dom/WindowEventLoop.cpp:
(WebCore::WindowEventLoop::microtaskQueue):
* Source/WebCore/workers/WorkerEventLoop.cpp:
(WebCore::WorkerEventLoop::WorkerEventLoop):
(WebCore::WorkerEventLoop::microtaskQueue):
Canonical link: https://commits.webkit.org/254766@main
More information about the webkit-changes
mailing list