mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Stop destructuring load in HTMLScriptElement::execute().
This commit is contained in:
parent
91b9bcd125
commit
b65240d730
1 changed files with 10 additions and 11 deletions
|
@ -428,7 +428,7 @@ impl HTMLScriptElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
let load = self.load.borrow_mut().take().unwrap();
|
let load = self.load.borrow_mut().take().unwrap();
|
||||||
let (source, external, url) = match load {
|
let script = match load {
|
||||||
// Step 2.
|
// Step 2.
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
warn!("error loading script {:?}", e);
|
warn!("error loading script {:?}", e);
|
||||||
|
@ -436,14 +436,13 @@ impl HTMLScriptElement {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(ScriptOrigin { text, url, external }) => {
|
Ok(script) => script,
|
||||||
if external {
|
|
||||||
debug!("loading external script, url = {}", url);
|
|
||||||
}
|
|
||||||
(text, external, url)
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if script.external {
|
||||||
|
debug!("loading external script, url = {}", script.url);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(#12446): beforescriptexecute.
|
// TODO(#12446): beforescriptexecute.
|
||||||
if !self.dispatch_before_script_execute_event() {
|
if !self.dispatch_before_script_execute_event() {
|
||||||
return;
|
return;
|
||||||
|
@ -465,9 +464,9 @@ impl HTMLScriptElement {
|
||||||
// Step 5.a.2.
|
// Step 5.a.2.
|
||||||
let window = window_from_node(self);
|
let window = window_from_node(self);
|
||||||
rooted!(in(window.get_cx()) let mut rval = UndefinedValue());
|
rooted!(in(window.get_cx()) let mut rval = UndefinedValue());
|
||||||
window.evaluate_script_on_global_with_result(&*source,
|
window.evaluate_script_on_global_with_result(&script.text,
|
||||||
url.as_str(),
|
script.url.as_str(),
|
||||||
rval.handle_mut());
|
rval.handle_mut());
|
||||||
|
|
||||||
// Step 6.
|
// Step 6.
|
||||||
document.set_current_script(old_script.r());
|
document.set_current_script(old_script.r());
|
||||||
|
@ -480,7 +479,7 @@ impl HTMLScriptElement {
|
||||||
self.dispatch_after_script_execute_event();
|
self.dispatch_after_script_execute_event();
|
||||||
|
|
||||||
// Step 8.
|
// Step 8.
|
||||||
if external {
|
if script.external {
|
||||||
self.dispatch_load_event();
|
self.dispatch_load_event();
|
||||||
} else {
|
} else {
|
||||||
window.dom_manipulation_task_source().queue_simple_event(self.upcast(), atom!("load"), window.r());
|
window.dom_manipulation_task_source().queue_simple_event(self.upcast(), atom!("load"), window.r());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue