Skip to content

Commit

Permalink
Set currentScript to null for module scripts
Browse files Browse the repository at this point in the history
I misunderstood the test case when I worked on #23545. That test case is
actually not related to dynamic import; instead, the reason why it
crashes is, `currentScript` should be updated to `null`.
  • Loading branch information
CYBAI committed May 27, 2020
1 parent 9f57120 commit a0df94b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 6 additions & 2 deletions components/script/dom/htmlscriptelement.rs
Expand Up @@ -756,14 +756,18 @@ impl HTMLScriptElement {
let document = document_from_node(self);
let old_script = document.GetCurrentScript();

match script.type_ {
ScriptType::Classic => document.set_current_script(Some(self)),
ScriptType::Module => document.set_current_script(None),
}

match script.type_ {
ScriptType::Classic => {
document.set_current_script(Some(self));
self.run_a_classic_script(&script);
document.set_current_script(old_script.as_deref());
},
ScriptType::Module => {
assert!(old_script.is_none());
assert!(document.GetCurrentScript().is_none());
self.run_a_module_script(&script, false);
},
}
Expand Down

This file was deleted.

0 comments on commit a0df94b

Please sign in to comment.