script: implement resolve_a_module_integrity_metadata (#42604)

`ImportMap` _integrity_ entry was practically unused, since it is only
needed for [resolving a module integrity
metadata](https://html.spec.whatwg.org/multipage/#resolving-a-module-integrity-metadata).
Now, we correctly initialize `ScriptFetchOptions` when loading a
module's descendants.
I slightly modified `nonimport-integrity.html` test to run
`modulepreload` test cases at the end. Since we haven't an
implementation for it, the test timeout, making the test cases that
comes after them not run.

Testing: More tests start passing
Part of #37553

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
Gae24
2026-02-14 11:26:49 +01:00
committed by GitHub
parent ebcb92d6c1
commit 49adfed9a8
9 changed files with 62 additions and 64 deletions

View File

@@ -756,7 +756,7 @@ impl HTMLScriptElement {
};
// Step 29. Fetch options.
let options = ScriptFetchOptions {
let mut options = ScriptFetchOptions {
cryptographic_nonce,
integrity_metadata: integrity_metadata.to_owned(),
parser_metadata,
@@ -842,6 +842,14 @@ impl HTMLScriptElement {
}
},
ScriptType::Module => {
// If el does not have an integrity attribute, then set options's integrity metadata to
// the result of resolving a module integrity metadata with url and settings object.
if integrity_val.is_none() {
options.integrity_metadata = global
.import_map()
.resolve_a_module_integrity_metadata(&url);
}
// Step 31.11. Fetch an external module script graph.
fetch_an_external_module_script(
url.clone(),