LibWeb: Just ignore <script> elements that failed to load the script

We're never gonna be able to run them if we can't load them so just
let it go.
This commit is contained in:
Andreas Kling 2020-06-15 18:37:48 +02:00
parent 84f8c91a6f
commit 17d26b92f8
Notes: sideshowbarker 2024-07-19 05:38:22 +09:00
3 changed files with 18 additions and 8 deletions

View file

@ -190,14 +190,19 @@ void HTMLScriptElement::prepare_script(Badge<HTMLDocumentParser>)
// FIXME: Check classic vs. module script type
// FIXME: This load should be made asynchronous and the parser should spin an event loop etc.
ResourceLoader::the().load_sync(url, [this, url](auto& data, auto&) {
if (data.is_null()) {
dbg() << "HTMLScriptElement: Failed to load " << url;
return;
}
m_script_source = String::copy(data);
script_became_ready();
});
ResourceLoader::the().load_sync(
url,
[this, url](auto& data, auto&) {
if (data.is_null()) {
dbg() << "HTMLScriptElement: Failed to load " << url;
return;
}
m_script_source = String::copy(data);
script_became_ready();
},
[this](auto&) {
m_failed_to_load = true;
});
} else {
// FIXME: Check classic vs. module script type
m_script_source = source_text;