Diff
Modified: trunk/LayoutTests/ChangeLog (288639 => 288640)
--- trunk/LayoutTests/ChangeLog 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/LayoutTests/ChangeLog 2022-01-26 20:10:15 UTC (rev 288640)
@@ -1,3 +1,17 @@
+2022-01-26 Alexey Shvayka <[email protected]>
+
+ globalThis.queueMicrotask() should report thrown exceptions
+ https://bugs.webkit.org/show_bug.cgi?id=235614
+
+ Reviewed by Geoff Garen.
+
+ * TestExpectations: Unskip 3 WPT tests that are now passing.
+ * fast/dom/callback-function-detached-frame-queue-microtask-expected.txt: Added.
+ * fast/dom/callback-function-detached-frame-queue-microtask.html: Added.
+ * fast/dom/resources/callback-function-detached-frame-queue-microtask-iframe.html: Added.
+ * inspector/debugger/break-on-uncaught-exception-expected.txt:
+ * platform/mac-wk1/TestExpectations: Skip Service Worker test.
+
2022-01-26 Chris Dumez <[email protected]>
Unreviewed, revert r286855 as it caused form submission issues
Modified: trunk/LayoutTests/TestExpectations (288639 => 288640)
--- trunk/LayoutTests/TestExpectations 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/LayoutTests/TestExpectations 2022-01-26 20:10:15 UTC (rev 288640)
@@ -619,9 +619,6 @@
imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-sameorigin.tentative.html [ Skip ]
imported/w3c/web-platform-tests/html/user-activation/propagation-crossorigin.sub.tentative.html [ Skip ]
imported/w3c/web-platform-tests/html/user-activation/propagation-sameorigin.tentative.html [ Skip ]
-imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any.html [ Skip ]
-imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any.serviceworker.html [ Skip ]
-imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any.worker.html [ Skip ]
imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/allow-crossorigin.html [ Skip ]
imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/disallow-crossorigin.html [ Skip ]
imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.html [ Skip ]
Added: trunk/LayoutTests/fast/dom/callback-function-detached-frame-queue-microtask-expected.txt (0 => 288640)
--- trunk/LayoutTests/fast/dom/callback-function-detached-frame-queue-microtask-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/callback-function-detached-frame-queue-microtask-expected.txt 2022-01-26 20:10:15 UTC (rev 288640)
@@ -0,0 +1,5 @@
+
+PASS Callback function, originated in an <iframe>, is invoked if <iframe> is connected
+PASS Callback function, originated in an <iframe> via main window's Function constructor, is invoked even if <iframe> is disconnected
+PASS Callback function, originated in an <iframe>, is not invoked if <iframe> is disconnected
+
Added: trunk/LayoutTests/fast/dom/callback-function-detached-frame-queue-microtask.html (0 => 288640)
--- trunk/LayoutTests/fast/dom/callback-function-detached-frame-queue-microtask.html (rev 0)
+++ trunk/LayoutTests/fast/dom/callback-function-detached-frame-queue-microtask.html 2022-01-26 20:10:15 UTC (rev 288640)
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<script src=""
+<script src=""
+<script src=""
+
+<body>
+
+<script>
+const IFRAME_SRC = "resources/callback-function-detached-frame-queue-microtask-iframe.html";
+
+promise_test(async t => {
+ window.__qm0Calls__ = 0;
+
+ const iframe = await createIframe(t, IFRAME_SRC);
+ iframe.contentWindow.callQueueMicrotask("__qm0Calls__");
+
+ await sleep(10);
+
+ assert_equals(window.__qm0Calls__, 1);
+}, "Callback function, originated in an <iframe>, is invoked if <iframe> is connected");
+
+promise_test(async t => {
+ window.__qm1Calls__ = 0;
+
+ const iframe = await createIframe(t, IFRAME_SRC);
+ iframe.contentWindow.callQueueMicrotask("__qm1Calls__", Function);
+
+ iframe.remove();
+ assert_equals(iframe.contentWindow, null);
+
+ await sleep(10);
+
+ assert_equals(window.__qm1Calls__, 1);
+}, "Callback function, originated in an <iframe> via main window's Function constructor, is invoked even if <iframe> is disconnected");
+
+promise_test(async t => {
+ window.__qm2Calls__ = 0;
+
+ const iframe = await createIframe(t, IFRAME_SRC);
+ iframe.contentWindow.callQueueMicrotask("__qm2Calls__");
+
+ iframe.remove();
+ assert_equals(iframe.contentWindow, null);
+
+ await sleep(10);
+
+ assert_equals(window.__qm2Calls__, 0);
+}, "Callback function, originated in an <iframe>, is not invoked if <iframe> is disconnected");
+</script>
Added: trunk/LayoutTests/fast/dom/resources/callback-function-detached-frame-queue-microtask-iframe.html (0 => 288640)
--- trunk/LayoutTests/fast/dom/resources/callback-function-detached-frame-queue-microtask-iframe.html (rev 0)
+++ trunk/LayoutTests/fast/dom/resources/callback-function-detached-frame-queue-microtask-iframe.html 2022-01-26 20:10:15 UTC (rev 288640)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+
+<script>
+function callQueueMicrotask(key, FunctionConstructor = Function) {
+ parent.queueMicrotask(FunctionConstructor(`
+ top["${key}"]++;
+ `));
+}
+</script>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (288639 => 288640)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-01-26 20:10:15 UTC (rev 288640)
@@ -1,3 +1,16 @@
+2022-01-26 Alexey Shvayka <[email protected]>
+
+ globalThis.queueMicrotask() should report thrown exceptions
+ https://bugs.webkit.org/show_bug.cgi?id=235614
+
+ Reviewed by Geoff Garen.
+
+ Rebaseline WPT tests that are now passing.
+
+ * web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any-expected.txt:
+ * web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any.serviceworker-expected.txt:
+ * web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any.worker-expected.txt:
+
2022-01-26 Chris Dumez <[email protected]>
Unreviewed, revert r286855 as it caused form submission issues
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any-expected.txt (288639 => 288640)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any-expected.txt 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any-expected.txt 2022-01-26 20:10:15 UTC (rev 288640)
@@ -1,5 +1,4 @@
+CONSOLE MESSAGE: Error: boo
-Harness Error (TIMEOUT), message = null
+PASS It rethrows exceptions
-TIMEOUT It rethrows exceptions Test timed out
-
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any.serviceworker-expected.txt (288639 => 288640)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any.serviceworker-expected.txt 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any.serviceworker-expected.txt 2022-01-26 20:10:15 UTC (rev 288640)
@@ -1,5 +1,3 @@
-Harness Error (TIMEOUT), message = null
+PASS It rethrows exceptions
-TIMEOUT It rethrows exceptions Test timed out
-
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any.worker-expected.txt (288639 => 288640)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any.worker-expected.txt 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any.worker-expected.txt 2022-01-26 20:10:15 UTC (rev 288640)
@@ -1,5 +1,4 @@
+CONSOLE MESSAGE: Error: boo
-Harness Error (TIMEOUT), message = null
+PASS It rethrows exceptions
-TIMEOUT It rethrows exceptions Test timed out
-
Modified: trunk/LayoutTests/inspector/debugger/break-on-uncaught-exception-expected.txt (288639 => 288640)
--- trunk/LayoutTests/inspector/debugger/break-on-uncaught-exception-expected.txt 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/LayoutTests/inspector/debugger/break-on-uncaught-exception-expected.txt 2022-01-26 20:10:15 UTC (rev 288640)
@@ -11,10 +11,34 @@
CONSOLE MESSAGE: throwing TestError
CONSOLE MESSAGE: catch TestError
CONSOLE MESSAGE: DONE
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
CONSOLE MESSAGE: BREAKPOINT ACTION LOG 1
+CONSOLE MESSAGE: TestError
CONSOLE MESSAGE: BREAKPOINT ACTION LOG 2
+CONSOLE MESSAGE: TestError
CONSOLE MESSAGE: BREAKPOINT ACTION LOG 3
+CONSOLE MESSAGE: TestError
CONSOLE MESSAGE: BREAKPOINT ACTION LOG 4
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
+CONSOLE MESSAGE: TestError
Checking pause locations when pausing on uncaught exceptions.
@@ -42,17 +66,21 @@
Setting condition to 'false'...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should not pause.
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should not pause.
Setting condition to 'true'...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should pause.
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should pause.
-- Running test case: BreakOnUncaughtException.Options.Condition.ConsoleCommandLineAPI
@@ -61,9 +89,11 @@
Setting condition to saved console value...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should not pause.
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should not pause.
Adding saved console value 'true'...
@@ -70,9 +100,11 @@
Setting condition to saved console value...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should pause.
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should pause.
-- Running test case: BreakOnUncaughtException.Options.IgnoreCount
@@ -80,15 +112,19 @@
Setting ignoreCount to '2'...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should not pause.
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should not pause.
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should pause.
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should pause.
-- Running test case: BreakOnUncaughtException.Options.Action.Log
@@ -96,6 +132,7 @@
Adding log action...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should execute breakpoint action.
PASS: Should pause.
@@ -102,6 +139,7 @@
Editing log action...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should execute breakpoint action.
PASS: Should pause.
@@ -109,6 +147,7 @@
Enabling auto-continue...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should execute breakpoint action.
PASS: Should not pause.
@@ -115,6 +154,7 @@
Editing log action...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should execute breakpoint action.
PASS: Should not pause.
@@ -123,6 +163,7 @@
Adding evaluate action...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should execute breakpoint action.
PASS: Should pause.
@@ -129,6 +170,7 @@
Editing evaluate action...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should execute breakpoint action.
PASS: Should pause.
@@ -136,6 +178,7 @@
Enabling auto-continue...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should execute breakpoint action.
PASS: Should not pause.
@@ -142,6 +185,7 @@
Editing evaluate action...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should execute breakpoint action.
PASS: Should not pause.
@@ -151,6 +195,7 @@
Adding evaluate action using saved console value...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should execute breakpoint action.
PASS: Should pause.
@@ -158,6 +203,7 @@
Editing evaluate action using saved console value...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should execute breakpoint action.
PASS: Should pause.
@@ -166,6 +212,7 @@
Enabling auto-continue...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should execute breakpoint action.
PASS: Should not pause.
@@ -173,6 +220,7 @@
Editing evaluate action using saved console value...
Triggering breakpoint...
+Uncaught exception in test page: TestError [break-on-uncaught-exception.html:15]
PASS: Should execute breakpoint action.
PASS: Should not pause.
Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (288639 => 288640)
--- trunk/LayoutTests/platform/mac-wk1/TestExpectations 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations 2022-01-26 20:10:15 UTC (rev 288640)
@@ -378,6 +378,7 @@
imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/messagechannel.any.serviceworker.html [ Skip ]
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/json-module-service-worker-test.https.html [ Skip ]
imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask.any.serviceworker.html [ Skip ]
+imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any.serviceworker.html [ Skip ]
imported/w3c/web-platform-tests/infrastructure/server/context.any.serviceworker.html [ Skip ]
imported/w3c/web-platform-tests/infrastructure/server/secure-context.https.any.serviceworker.html [ Skip ]
imported/w3c/web-platform-tests/IndexedDB/key-generators/reading-autoincrement-indexes-cursors.any.serviceworker.html [ Skip ]
Modified: trunk/Source/_javascript_Core/ChangeLog (288639 => 288640)
--- trunk/Source/_javascript_Core/ChangeLog 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-01-26 20:10:15 UTC (rev 288640)
@@ -1,3 +1,23 @@
+2022-01-26 Alexey Shvayka <[email protected]>
+
+ globalThis.queueMicrotask() should report thrown exceptions
+ https://bugs.webkit.org/show_bug.cgi?id=235614
+
+ Reviewed by Geoff Garen.
+
+ 1. Move JSGlobalObject::hasDebugger() to the header to facilitate
+ inlining as it's used in a rather hot Microtask execution code.
+ 2. Export a few Debugger methods for JSDOMMicrotask::run().
+ 3. Remove the now-unused createJSMicrotask() overload.
+
+ * debugger/Debugger.h:
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::hasDebugger const): Deleted.
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::hasDebugger const):
+ * runtime/JSMicrotask.cpp:
+ * runtime/JSMicrotask.h:
+
2022-01-26 Antoine Quint <[email protected]>
[Web Inspector] Graphics tab should display pseudo-elements for more than ::before and ::after
Modified: trunk/Source/_javascript_Core/debugger/Debugger.h (288639 => 288640)
--- trunk/Source/_javascript_Core/debugger/Debugger.h 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/Source/_javascript_Core/debugger/Debugger.h 2022-01-26 20:10:15 UTC (rev 288640)
@@ -135,8 +135,8 @@
void didExecuteProgram(CallFrame*);
void didReachDebuggerStatement(CallFrame*);
- void willRunMicrotask();
- void didRunMicrotask();
+ JS_EXPORT_PRIVATE void willRunMicrotask();
+ JS_EXPORT_PRIVATE void didRunMicrotask();
void registerCodeBlock(CodeBlock*);
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (288639 => 288640)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2022-01-26 20:10:15 UTC (rev 288640)
@@ -2583,11 +2583,6 @@
vm().ensureShadowChicken();
}
-bool JSGlobalObject::hasDebugger() const
-{
- return m_debugger;
-}
-
bool JSGlobalObject::hasInteractiveDebugger() const
{
return m_debugger && m_debugger->isInteractivelyDebugging();
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (288639 => 288640)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2022-01-26 20:10:15 UTC (rev 288640)
@@ -629,7 +629,7 @@
DECLARE_EXPORT_INFO;
- bool hasDebugger() const;
+ bool hasDebugger() const { return m_debugger; }
bool hasInteractiveDebugger() const;
const RuntimeFlags& runtimeFlags() const { return m_runtimeFlags; }
Modified: trunk/Source/_javascript_Core/runtime/JSMicrotask.cpp (288639 => 288640)
--- trunk/Source/_javascript_Core/runtime/JSMicrotask.cpp 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/Source/_javascript_Core/runtime/JSMicrotask.cpp 2022-01-26 20:10:15 UTC (rev 288640)
@@ -47,11 +47,6 @@
m_arguments[3].set(vm, argument3);
}
- JSMicrotask(VM& vm, JSValue job)
- {
- m_job.set(vm, job);
- }
-
private:
void run(JSGlobalObject*) final;
@@ -59,11 +54,6 @@
Strong<Unknown> m_arguments[maxArguments];
};
-Ref<Microtask> createJSMicrotask(VM& vm, JSValue job)
-{
- return adoptRef(*new JSMicrotask(vm, job));
-}
-
Ref<Microtask> createJSMicrotask(VM& vm, JSValue job, JSValue argument0, JSValue argument1, JSValue argument2, JSValue argument3)
{
return adoptRef(*new JSMicrotask(vm, job, argument0, argument1, argument2, argument3));
Modified: trunk/Source/_javascript_Core/runtime/JSMicrotask.h (288639 => 288640)
--- trunk/Source/_javascript_Core/runtime/JSMicrotask.h 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/Source/_javascript_Core/runtime/JSMicrotask.h 2022-01-26 20:10:15 UTC (rev 288640)
@@ -33,7 +33,6 @@
class Microtask;
class JSArray;
-JS_EXPORT_PRIVATE Ref<Microtask> createJSMicrotask(VM&, JSValue job);
JS_EXPORT_PRIVATE Ref<Microtask> createJSMicrotask(VM&, JSValue job, JSValue, JSValue, JSValue, JSValue);
} // namespace JSC
Modified: trunk/Source/WebCore/ChangeLog (288639 => 288640)
--- trunk/Source/WebCore/ChangeLog 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/Source/WebCore/ChangeLog 2022-01-26 20:10:15 UTC (rev 288640)
@@ -1,3 +1,35 @@
+2022-01-26 Alexey Shvayka <[email protected]>
+
+ globalThis.queueMicrotask() should report thrown exceptions
+ https://bugs.webkit.org/show_bug.cgi?id=235614
+
+ Reviewed by Geoff Garen.
+
+ This patch introduces WebCore::JSDOMMicrotask so the queueMicrotask() could report
+ a thrown exception as per spec [1] and to avoid invocation of a userland function
+ from detached <iframe>, which aligns WebKit with Blink and Gecko.
+
+ Both this changes align the callback of queueMicrotask() with generated callback
+ functions / interfaces (see bug 232387) that are implemented via JSCallbackData.
+
+ [1] https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#microtask-queuing:report-the-exception
+
+ Tests: imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-exceptions.any.js
+ fast/dom/callback-function-detached-frame-queue-microtask.html
+
+ * Headers.cmake:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSDOMMicrotask.cpp: Added.
+ (WebCore::createJSDOMMicrotask):
+ (WebCore::JSDOMMicrotask::run):
+ * bindings/js/JSDOMMicrotask.h: Added.
+ * bindings/js/JSDOMWindowCustom.cpp:
+ (WebCore::JSDOMWindow::queueMicrotask):
+ * bindings/js/JSWorkerGlobalScopeCustom.cpp:
+ (WebCore::JSWorkerGlobalScope::queueMicrotask):
+ * dom/EventLoop.h:
+
2022-01-26 Antoine Quint <[email protected]>
[Web Animations] Remove remaining PseudoElement.h includes
Modified: trunk/Source/WebCore/Headers.cmake (288639 => 288640)
--- trunk/Source/WebCore/Headers.cmake 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/Source/WebCore/Headers.cmake 2022-01-26 20:10:15 UTC (rev 288640)
@@ -445,6 +445,7 @@
bindings/js/JSDOMExceptionHandling.h
bindings/js/JSDOMGlobalObject.h
bindings/js/JSDOMGuardedObject.h
+ bindings/js/JSDOMMicrotask.h
bindings/js/JSDOMOperation.h
bindings/js/JSDOMPromiseDeferred.h
bindings/js/JSDOMWindowBase.h
Modified: trunk/Source/WebCore/Sources.txt (288639 => 288640)
--- trunk/Source/WebCore/Sources.txt 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/Source/WebCore/Sources.txt 2022-01-26 20:10:15 UTC (rev 288640)
@@ -528,6 +528,7 @@
bindings/js/JSDOMGuardedObject.cpp
bindings/js/JSDOMIterator.cpp
bindings/js/JSDOMMapLike.cpp
+bindings/js/JSDOMMicrotask.cpp
bindings/js/JSDOMPromise.cpp
bindings/js/JSDOMPromiseDeferred.cpp
bindings/js/JSDOMQuadCustom.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (288639 => 288640)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2022-01-26 20:10:15 UTC (rev 288640)
@@ -12475,6 +12475,8 @@
8A9A586F11E84C36008ACFD1 /* JSPerformanceNavigation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPerformanceNavigation.h; sourceTree = "<group>"; };
8A9A587311E84C81008ACFD1 /* JSPerformance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPerformance.h; sourceTree = "<group>"; };
8A9A587711E84C98008ACFD1 /* JSPerformanceTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPerformanceTiming.h; sourceTree = "<group>"; };
+ 8AA9407E279EEE8100EC0C48 /* JSDOMMicrotask.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSDOMMicrotask.h; sourceTree = "<group>"; };
+ 8AA94080279EEE8100EC0C48 /* JSDOMMicrotask.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMMicrotask.cpp; sourceTree = "<group>"; };
8AB4BC76126FDB7100DEB727 /* IgnoreDestructiveWriteCountIncrementer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IgnoreDestructiveWriteCountIncrementer.h; sourceTree = "<group>"; };
8AF4E55211DC5A36000ED3DE /* PerformanceNavigation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceNavigation.cpp; sourceTree = "<group>"; };
8AF4E55311DC5A36000ED3DE /* PerformanceNavigation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceNavigation.h; sourceTree = "<group>"; };
@@ -29770,6 +29772,8 @@
children = (
1449E286107D4DB400B5793F /* JSCallbackData.cpp */,
1449E24A107D4A8400B5793F /* JSCallbackData.h */,
+ 8AA94080279EEE8100EC0C48 /* JSDOMMicrotask.cpp */,
+ 8AA9407E279EEE8100EC0C48 /* JSDOMMicrotask.h */,
F3D461461161D53200CA0D09 /* JSErrorHandler.cpp */,
F3D461471161D53200CA0D09 /* JSErrorHandler.h */,
93B70D4D09EB0C7C009D8468 /* JSEventListener.cpp */,
Added: trunk/Source/WebCore/bindings/js/JSDOMMicrotask.cpp (0 => 288640)
--- trunk/Source/WebCore/bindings/js/JSDOMMicrotask.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSDOMMicrotask.cpp 2022-01-26 20:10:15 UTC (rev 288640)
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSDOMMicrotask.h"
+
+#include "JSDOMExceptionHandling.h"
+#include "JSExecState.h"
+#include <_javascript_Core/Debugger.h>
+#include <_javascript_Core/JSGlobalObject.h>
+#include <_javascript_Core/JSObjectInlines.h>
+#include <_javascript_Core/StrongInlines.h>
+
+namespace WebCore {
+using namespace JSC;
+
+class JSDOMMicrotask final : public Microtask {
+public:
+ JSDOMMicrotask(VM& vm, JSObject* job)
+ : m_job { vm, job }
+ {
+ }
+
+private:
+ void run(JSGlobalObject*) final;
+
+ Strong<JSObject> m_job;
+};
+
+Ref<Microtask> createJSDOMMicrotask(VM& vm, JSObject* job)
+{
+ return adoptRef(*new JSDOMMicrotask(vm, job));
+}
+
+void JSDOMMicrotask::run(JSGlobalObject* globalObject)
+{
+ auto& vm = globalObject->vm();
+
+ JSObject* job = m_job.get();
+
+ auto* lexicalGlobalObject = job->globalObject(vm);
+ auto* context = jsCast<JSDOMGlobalObject*>(lexicalGlobalObject)->scriptExecutionContext();
+ if (!context || context->activeDOMObjectsAreSuspended() || context->activeDOMObjectsAreStopped())
+ return;
+
+ auto callData = getCallData(vm, job);
+ ASSERT(callData.type != CallData::Type::None);
+
+ if (UNLIKELY(globalObject->hasDebugger()))
+ globalObject->debugger()->willRunMicrotask();
+
+ NakedPtr<JSC::Exception> returnedException = nullptr;
+ JSExecState::profiledCall(lexicalGlobalObject, JSC::ProfilingReason::Microtask, job, callData, jsUndefined(), ArgList(), returnedException);
+ if (returnedException)
+ reportException(lexicalGlobalObject, returnedException);
+
+ if (UNLIKELY(globalObject->hasDebugger()))
+ globalObject->debugger()->didRunMicrotask();
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/bindings/js/JSDOMMicrotask.h (0 => 288640)
--- trunk/Source/WebCore/bindings/js/JSDOMMicrotask.h (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSDOMMicrotask.h 2022-01-26 20:10:15 UTC (rev 288640)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <_javascript_Core/JSCJSValue.h>
+#include <_javascript_Core/Microtask.h>
+
+namespace WebCore {
+
+Ref<JSC::Microtask> createJSDOMMicrotask(JSC::VM&, JSC::JSObject* job);
+
+}
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (288639 => 288640)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp 2022-01-26 20:10:15 UTC (rev 288640)
@@ -31,6 +31,7 @@
#include "JSDOMConvertNullable.h"
#include "JSDOMConvertNumbers.h"
#include "JSDOMConvertStrings.h"
+#include "JSDOMMicrotask.h"
#include "JSDatabase.h"
#include "JSDatabaseCallback.h"
#include "JSEvent.h"
@@ -51,7 +52,6 @@
#include <_javascript_Core/InternalFunction.h>
#include <_javascript_Core/JSCInlines.h>
#include <_javascript_Core/JSFunction.h>
-#include <_javascript_Core/JSMicrotask.h>
#include <_javascript_Core/Lookup.h>
#include <_javascript_Core/Structure.h>
@@ -534,7 +534,7 @@
return JSValue::decode(throwArgumentMustBeFunctionError(lexicalGlobalObject, scope, 0, "callback", "Window", "queueMicrotask"));
scope.release();
- Base::queueMicrotask(JSC::createJSMicrotask(vm, functionValue));
+ Base::queueMicrotask(createJSDOMMicrotask(vm, asObject(functionValue)));
return jsUndefined();
}
Modified: trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp (288639 => 288640)
--- trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp 2022-01-26 20:10:15 UTC (rev 288640)
@@ -27,8 +27,8 @@
#include "JSWorkerGlobalScope.h"
#include "JSDOMExceptionHandling.h"
+#include "JSDOMMicrotask.h"
#include "WorkerGlobalScope.h"
-#include <_javascript_Core/JSMicrotask.h>
namespace WebCore {
using namespace JSC;
@@ -64,7 +64,7 @@
return JSValue::decode(throwArgumentMustBeFunctionError(lexicalGlobalObject, scope, 0, "callback", "WorkerGlobalScope", "queueMicrotask"));
scope.release();
- Base::queueMicrotask(JSC::createJSMicrotask(vm, functionValue));
+ Base::queueMicrotask(createJSDOMMicrotask(vm, asObject(functionValue)));
return jsUndefined();
}
Modified: trunk/Source/WebCore/dom/EventLoop.h (288639 => 288640)
--- trunk/Source/WebCore/dom/EventLoop.h 2022-01-26 20:06:29 UTC (rev 288639)
+++ trunk/Source/WebCore/dom/EventLoop.h 2022-01-26 20:10:15 UTC (rev 288640)
@@ -37,7 +37,6 @@
class ActiveDOMCallbackMicrotask;
class EventLoopTaskGroup;
class EventTarget;
-class Microtask;
class MicrotaskQueue;
class ScriptExecutionContext;