Set currentScript to null for module scripts

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`.
This commit is contained in:
CYBAI 2020-05-27 11:22:04 +09:00
parent 9f57120d84
commit a0df94bddc
2 changed files with 6 additions and 7 deletions

View file

@ -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);
},
}

View file

@ -1,5 +0,0 @@
[load-error-events-inline.html]
type: testharness
expected: CRASH