LibWeb: Don't attempt to run unparsed scripts

This commit is contained in:
Andreas Kling 2021-09-18 01:38:40 +02:00
parent 0bb680bacd
commit e215580147
Notes: sideshowbarker 2024-07-18 03:44:32 +09:00

View file

@ -59,6 +59,12 @@ NonnullRefPtr<ClassicScript> ClassicScript::create(String filename, StringView s
// https://html.spec.whatwg.org/multipage/webappapis.html#run-a-classic-script
JS::Value ClassicScript::run(RethrowErrors rethrow_errors)
{
if (!m_script_record) {
// FIXME: Throw a SyntaxError per the spec.
dbgln("ClassicScript: Unable to run script {}", filename());
return {};
}
dbgln("ClassicScript: Running script {}", filename());
(void)rethrow_errors;