haikuwebkit/LayoutTests/requestidlecallback/requestidlecallback-is-call...

13 lines
354 B
Plaintext
Raw Permalink Normal View History

Source/WebCore: Invoke callbacks registered by requestIdleCallback https://bugs.webkit.org/show_bug.cgi?id=202824 Reviewed by Antti Koivisto. Invoke callbacks registered by requestIdleCallback unless it's canceled. To do this, this patch introduces WindowEventLoop class, which represents the HTML5 event loop: https://html.spec.whatwg.org/multipage/webappapis.html#window-event-loop Because each and only each agent cluster is meant to have its own window event loop, this class will be shared across multiple documents of the same registrable domain: https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-agent-cluster-formalism Tests: requestidlecallback/requestidlecallback-is-called.html requestidlecallback/requestidlecallback-is-not-called-when-canceled.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/Document.cpp: (WebCore::Document::eventLoop): Added. (WebCore::Document::requestIdleCallback): Associate IdleCallbackController with this document. * dom/Document.h: (WebCore::Document::idleCallbackController): Added. Used for release assertions. * dom/IdleCallbackController.cpp: (WebCore::IdleCallbackController::IdleCallbackController): Keeps a weak pointer to Document. (WebCore::IdleCallbackController::queueIdleCallback): (WebCore::IdleCallbackController::removeIdleCallback): (WebCore::IdleCallbackController::queueTaskToStartIdlePeriod): Added. (WebCore::IdleCallbackController::startIdlePeriod): Added. Implements the start an idle period algorithm: https://w3c.github.io/requestidlecallback/#start-an-idle-period-algorithm (WebCore::IdleCallbackController::queueTaskToInvokeIdleCallbacks): Added. (WebCore::IdleCallbackController::invokeIdleCallbacks): Added. The invoke idle callback timeout algorithm: https://w3c.github.io/requestidlecallback/#invoke-idle-callback-timeout-algorithm * dom/IdleCallbackController.h: * dom/IdleDeadline.h: * dom/WindowEventLoop.cpp: Added. (WebCore::WindowEventLoop::create): Added. (WebCore::WindowEventLoop::WindowEventLoop): Added. (WebCore::WindowEventLoop::queueTask): Added. (WebCore::WindowEventLoop::run): Added. * dom/WindowEventLoop.h: Added. * page/Page.cpp: (WebCore::Page::updateRendering): Added comments for the missing pieces. LayoutTests: Invoke callback registered by requestIdleCallback https://bugs.webkit.org/show_bug.cgi?id=202824 Reviewed by Antti Koivisto. Added basic regression tests. The second test (requestidlecallback-is-not-called-when-canceled.html) found a spec bug (https://github.com/w3c/requestidlecallback/issues/83). * requestidlecallback/requestidlecallback-is-called-expected.txt: Added. * requestidlecallback/requestidlecallback-is-called.html: Added. * requestidlecallback/requestidlecallback-is-not-called-when-canceled-expected.txt: Added. * requestidlecallback/requestidlecallback-is-not-called-when-canceled.html: Added. Canonical link: https://commits.webkit.org/216340@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251050 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-12 20:34:07 +00:00
This tests that when requestIdleCallback is enabled, requestIdleCallback is eventaully called in the order.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS requestIdleCallbackIsCalled is true
PASS logs.length is 4
PASS logs.join(", ") is "1.A1, 2.B1, 4.A2, 3.B2"
PASS successfullyParsed is true
TEST COMPLETE