forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Align with HTML and remove support for external importmaps
https://bugs.webkit.org/show_bug.cgi?id=284286 Reviewed by Yusuke Suzuki. This PR removes support for external import maps and ensures they throw an error instead. That would align WebKit's behavior with the HTML standard and other browsers. It also imports a new WPT test that validates the standard requirement this fixes, as well as adjusts relevant WPT results. This adjustment results in some progressions and some regressions. The regressions would be fixed as part of WebKit/standards-positions#381. Upstream commit: web-platform-tests/wpt@ef41368 * LayoutTests/imported/w3c/web-platform-tests/import-maps/external-import-map-errors-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/import-maps/external-import-map-errors.html: Added. * LayoutTests/imported/w3c/web-platform-tests/import-maps/w3c-import.log: * Source/WebCore/Sources.txt: remove LoadableImportMap * Source/WebCore/WebCore.xcodeproj/project.pbxproj: remove LoadableImportMap * Source/WebCore/dom/LoadableClassicScript.cpp: remove LoadableImportMap logic * Source/WebCore/dom/LoadableImportMap.cpp: Removed. * Source/WebCore/dom/LoadableImportMap.h: Removed. (WebCore::ScriptElement::prepareScript): Fire an error event if an importmap script has a source. (WebCore::ScriptElement::executePendingScript): remove loadableImportMap logic (WebCore::ScriptElement::requestImportMap): Deleted. * Source/WebCore/dom/ScriptElement.h: Remove `requestImportMap`. Canonical link: https://commits.webkit.org/287725@main
- Loading branch information
Showing
10 changed files
with
51 additions
and
165 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...Tests/imported/w3c/web-platform-tests/import-maps/external-import-map-errors-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
PASS Test that an external import map fires an error event | ||
PASS Test that an external import map fires an error event, regardless of attribute order | ||
PASS Test that an external import map in markup fires an error event | ||
|
40 changes: 40 additions & 0 deletions
40
LayoutTests/imported/w3c/web-platform-tests/import-maps/external-import-map-errors.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE html> | ||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
window.markupErrored = false; | ||
window.markupLoaded = false; | ||
</script> | ||
<script src="/import-maps/resources/empty.js" type="importmap" | ||
onload="window.markupLoaded = true;" onerror="window.markupErrored = true;"> | ||
</script> | ||
<script> | ||
promise_test(async () => { | ||
await new Promise((resolve, reject) => { | ||
const element = document.createElement("script"); | ||
element.onload = () => { reject("Got an unexpected load event"); }; | ||
element.onerror = () => { resolve("Got an error event"); }; | ||
element.src = "/import-maps/resources/empty.js"; | ||
element.type = "importmap"; | ||
document.head.appendChild(element); | ||
}) | ||
}, "Test that an external import map fires an error event"); | ||
|
||
promise_test(async () => { | ||
await new Promise((resolve, reject) => { | ||
const element = document.createElement("script"); | ||
element.type = "importmap"; | ||
element.onload = () => { reject("Got an unexpected load event"); }; | ||
element.onerror = () => { resolve("Got an error event"); }; | ||
element.src = "/import-maps/resources/empty.js"; | ||
document.head.appendChild(element); | ||
}) | ||
}, "Test that an external import map fires an error event, regardless of attribute order"); | ||
|
||
promise_test(async () => { | ||
assert_true(window.markupErrored, "error"); | ||
assert_false(window.markupLoaded, "load"); | ||
}, "Test that an external import map in markup fires an error event"); | ||
</script> | ||
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters