mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 20:42:11 +02:00
LibWeb: Let HTMLScriptElement call Document::run_javascript()
The fewer places we invoke the JS parser the better. Unless we have some specific reason to parse manually, we can just call Document.
This commit is contained in:
Notes:
sideshowbarker
2024-07-19 05:25:43 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c24f5585b29
@@ -55,13 +55,7 @@ void HTMLScriptElement::set_non_blocking(Badge<HTMLDocumentParser>, bool non_blo
|
||||
|
||||
void HTMLScriptElement::execute_script()
|
||||
{
|
||||
auto parser = JS::Parser(JS::Lexer(m_script_source));
|
||||
auto program = parser.parse_program();
|
||||
if (parser.has_errors()) {
|
||||
parser.print_errors();
|
||||
return;
|
||||
}
|
||||
document().interpreter().run(document().interpreter().global_object(), *program);
|
||||
document().run_javascript(m_script_source);
|
||||
}
|
||||
|
||||
void HTMLScriptElement::prepare_script(Badge<HTMLDocumentParser>)
|
||||
|
||||
Reference in New Issue
Block a user