mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 06:18:59 +00:00
LibWeb: Implement multiple import map support
This commit is contained in:
parent
0a216f9c14
commit
ac6fe2e211
Notes:
github-actions[bot]
2024-12-10 12:02:45 +00:00
Author: https://github.com/shannonbooth
Commit: ac6fe2e211
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2824
Reviewed-by: https://github.com/Lubrsi ✅
19 changed files with 294 additions and 100 deletions
|
@ -460,25 +460,10 @@ void HTMLScriptElement::prepare_script()
|
|||
}
|
||||
// -> "importmap"
|
||||
else if (m_script_type == ScriptType::ImportMap) {
|
||||
// FIXME: need to check if relevant global object is a Window - is this correct?
|
||||
auto& global = relevant_global_object(*this);
|
||||
|
||||
// 1. If el's relevant global object's import maps allowed is false, then queue an element task on the DOM manipulation task source given el to fire an event named error at el, and return.
|
||||
if (is<Window>(global) && !verify_cast<Window>(global).import_maps_allowed()) {
|
||||
queue_an_element_task(HTML::Task::Source::DOMManipulation, [this] {
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::error));
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Set el's relevant global object's import maps allowed to false.
|
||||
if (is<Window>(global))
|
||||
verify_cast<Window>(global).set_import_maps_allowed(false);
|
||||
|
||||
// 3. Let result be the result of creating an import map parse result given source text and base URL.
|
||||
// 1. Let result be the result of creating an import map parse result given source text and base URL.
|
||||
auto result = ImportMapParseResult::create(realm(), source_text.to_byte_string(), base_url);
|
||||
|
||||
// 4. Mark as ready el given result.
|
||||
// 2. Mark as ready el given result.
|
||||
mark_as_ready(Result(move(result)));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue