LibWeb: Make HTMLScriptElement create and run ClassicScripts

Before this patch, HTMLScriptElement would cache the full script source
text in a String member, and parse that just-in-time via Document's
run_javascript() helpers.

We now follow the spec more closely and turn the incoming source text
into a ClassicScript object ("the script's script" in the spec.)
This commit is contained in:
Andreas Kling 2021-09-09 19:04:33 +02:00
parent 73be7e227b
commit 1864b2b828
Notes: sideshowbarker 2024-07-18 04:22:02 +09:00
2 changed files with 30 additions and 12 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -8,6 +8,7 @@
#include <AK/Function.h>
#include <LibWeb/HTML/HTMLElement.h>
#include <LibWeb/HTML/Scripting/Script.h>
namespace Web::HTML {
@ -61,8 +62,9 @@ private:
Function<void()> m_script_ready_callback;
String m_source_text;
String m_script_filename;
RefPtr<Script> m_script;
};
}