1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 16:54:57 +00:00

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

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;