1
0
Fork 0
firefox/testing/web-platform/tests/import-maps/no-referencing-script-integrity.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

39 lines
1.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
let log = [];
</script>
<script type="importmap">
{
"integrity": {
"./resources/log.js?pipe=sub&name=NoReferencingScriptInvalidCheck": "sha384-Li9vy3DqF8tnTXuiaAJuML3ky+er10rcgNR/VqsVpcw+ThHmYcwiB1pbOxEbzJr7"
}
}
</script>
<script>
let promiseResolve;
let promiseReject;
let promise = new Promise((resolve, reject) => {
promiseResolve = resolve;
promiseReject = reject;
});
</script>
</head>
<body>
<!-- This is testing the part of
https://html.spec.whatwg.org/multipage/webappapis.html#hostloadimportedmodule
where step 6's condition is false and referencingScript remains null.
Therefore, the onload event must be defined as an HTML attribute, outside of any script tag.
-->
<img src="/images/green.png"
onload="import('./resources/log.js?pipe=sub&name=NoReferencingScriptInvalidCheck').then(promiseResolve).catch(promiseReject)">
<script type="module">
promise_test(async t => {
await promise_rejects_js(t, TypeError, promise);
}, "Script was not loaded as its integrity check failed");
</script>
</body>
</html>