Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 36ca3438261c63184bafdf56e0331d54398f6c4b
https://github.com/WebKit/WebKit/commit/36ca3438261c63184bafdf56e0331d54398f6c4b
Author: Ahmad Saleem <[email protected]>
Date: 2026-10-09 (Fri, 09 Oct 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/src-empty-or-invalid-error-event-queued-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/src-empty-or-invalid-error-event-queued.html
M Source/WebCore/dom/ScriptElement.cpp
Log Message:
-----------
Module script elements with an empty or invalid src fire the error event
synchronously
https://bugs.webkit.org/show_bug.cgi?id=326650
rdar://189384155
Reviewed by Chris Dumez.
This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.
"Prepare the script element" [1] says:
"If src is the empty string, then queue an element task on the DOM
manipulation task source given el to fire an event named error at el,
and return."
"If url is failure, then queue an element task on the DOM manipulation
task source given el to fire an event named error at el, and return."
These steps run before the switch on el's type, so they apply to classic
and module scripts alike.
requestClassicScript() already queues the task, but requestModuleScript()
called dispatchErrorEvent() directly, so for module scripts the error event
fired synchronously inside appendChild(). Use the same
queueTaskKeepingObjectAlive() pattern as the classic path.
[1]
https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element
Test:
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/src-empty-or-invalid-error-event-queued.html
*
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/src-empty-or-invalid-error-event-queued-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/src-empty-or-invalid-error-event-queued.html:
Added.
* Source/WebCore/dom/ScriptElement.cpp:
(WebCore::ScriptElement::requestModuleScript):
Canonical link: https://commits.webkit.org/323198@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications