-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
External import map not loaded (#49586)
* External import map not loaded * Move up from historical
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
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> |