LibWeb: Create an execution context before registering import map

Fixes #6297
This commit is contained in:
Daniel Price 2025-11-05 08:53:15 -08:00 committed by Tim Flynn
parent aff642053a
commit 3a70a4735a
Notes: github-actions[bot] 2025-11-06 22:08:40 +00:00
2 changed files with 66 additions and 0 deletions

View file

@ -20,6 +20,7 @@
#include <LibWeb/HTML/Scripting/ClassicScript.h>
#include <LibWeb/HTML/Scripting/Fetching.h>
#include <LibWeb/HTML/Scripting/ImportMapParseResult.h>
#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Infra/CharacterTypes.h>
#include <LibWeb/Infra/Strings.h>
@ -154,6 +155,8 @@ void HTMLScriptElement::execute_script()
}
// -> "importmap"
else if (m_script_type == ScriptType::ImportMap) {
HTML::TemporaryExecutionContext execution_context { realm() };
// 1. Register an import map given el's relevant global object and el's result.
m_result.get<GC::Ref<ImportMapParseResult>>()->register_import_map(as<Window>(relevant_global_object(*this)));
}