Skip to content

Commit

Permalink
Stop destructuring load in HTMLScriptElement::execute().
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Jul 16, 2016
1 parent 91b9bcd commit b65240d
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions components/script/dom/htmlscriptelement.rs
Expand Up @@ -428,22 +428,21 @@ impl HTMLScriptElement {
}

let load = self.load.borrow_mut().take().unwrap();
let (source, external, url) = match load {
let script = match load {
// Step 2.
Err(e) => {
warn!("error loading script {:?}", e);
self.dispatch_error_event();
return;
}

Ok(ScriptOrigin { text, url, external }) => {
if external {
debug!("loading external script, url = {}", url);
}
(text, external, url)
},
Ok(script) => script,
};

if script.external {
debug!("loading external script, url = {}", script.url);
}

// TODO(#12446): beforescriptexecute.
if !self.dispatch_before_script_execute_event() {
return;
Expand All @@ -465,9 +464,9 @@ impl HTMLScriptElement {
// Step 5.a.2.
let window = window_from_node(self);
rooted!(in(window.get_cx()) let mut rval = UndefinedValue());
window.evaluate_script_on_global_with_result(&*source,
url.as_str(),
rval.handle_mut());
window.evaluate_script_on_global_with_result(&script.text,
script.url.as_str(),
rval.handle_mut());

// Step 6.
document.set_current_script(old_script.r());
Expand All @@ -480,7 +479,7 @@ impl HTMLScriptElement {
self.dispatch_after_script_execute_event();

// Step 8.
if external {
if script.external {
self.dispatch_load_event();
} else {
window.dom_manipulation_task_source().queue_simple_event(self.upcast(), atom!("load"), window.r());
Expand Down

0 comments on commit b65240d

Please sign in to comment.