mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 14:58:46 +00:00
LibWeb: Provide file name to JavaScript interpreter
This commit is contained in:
parent
6172cb3599
commit
8dca96fb61
Notes:
sideshowbarker
2024-07-18 21:49:39 +09:00
Author: https://github.com/boricj
Commit: 8dca96fb61
Pull-request: https://github.com/SerenityOS/serenity/pull/5547
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/linusg
4 changed files with 7 additions and 4 deletions
|
@ -40,6 +40,7 @@ namespace Web::HTML {
|
|||
|
||||
HTMLScriptElement::HTMLScriptElement(DOM::Document& document, QualifiedName qualified_name)
|
||||
: HTMLElement(document, move(qualified_name))
|
||||
, m_script_filename("(document)")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -89,7 +90,7 @@ void HTMLScriptElement::execute_script()
|
|||
else
|
||||
dbgln_if(HTML_SCRIPT_DEBUG, "HTMLScriptElement: Running inline script");
|
||||
|
||||
document().run_javascript(m_script_source);
|
||||
document().run_javascript(m_script_source, m_script_filename);
|
||||
|
||||
document().set_current_script({}, old_current_script);
|
||||
} else {
|
||||
|
@ -229,6 +230,7 @@ void HTMLScriptElement::prepare_script(Badge<HTMLDocumentParser>)
|
|||
|
||||
if (m_script_type == ScriptType::Classic) {
|
||||
// FIXME: This load should be made asynchronous and the parser should spin an event loop etc.
|
||||
m_script_filename = url.basename();
|
||||
ResourceLoader::the().load_sync(
|
||||
url,
|
||||
[this, url](auto data, auto&) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue