mirror of
https://github.com/servo/servo
synced 2026-04-27 09:57:23 +02:00
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:
@@ -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);
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user