script: Preserve the order of entries when parsing an import map (#42754)

Unless the feature `preserve_order` is enabled, serde_json will sort the
map's entries in an alphanumerical order.
The specification instead expect the entries to be visited by the order
they are listed, a latter entry should replace a previous one when they
are resolved to the same url.

I've also removed a couple of `CanGc` introduced in #37405, unless I've
missed something there is not code that can trigger a GC.

Testing: A subtest now pass
Part of #37553

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
Gae24
2026-02-23 22:39:37 +01:00
committed by GitHub
parent 8dfda0979d
commit ea7703c39d
5 changed files with 9 additions and 25 deletions

View File

@@ -934,7 +934,6 @@ impl HTMLScriptElement {
ModuleOwner::Window(Trusted::new(self)),
Rc::clone(&text_rc),
base_url.clone(),
can_gc,
);
let script = Script::ImportMap(ScriptOrigin::internal(
text_rc,