mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01: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:
parent
9f57120d84
commit
a0df94bddc
2 changed files with 6 additions and 7 deletions
|
@ -756,14 +756,18 @@ impl HTMLScriptElement {
|
||||||
let document = document_from_node(self);
|
let document = document_from_node(self);
|
||||||
let old_script = document.GetCurrentScript();
|
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_ {
|
match script.type_ {
|
||||||
ScriptType::Classic => {
|
ScriptType::Classic => {
|
||||||
document.set_current_script(Some(self));
|
|
||||||
self.run_a_classic_script(&script);
|
self.run_a_classic_script(&script);
|
||||||
document.set_current_script(old_script.as_deref());
|
document.set_current_script(old_script.as_deref());
|
||||||
},
|
},
|
||||||
ScriptType::Module => {
|
ScriptType::Module => {
|
||||||
assert!(old_script.is_none());
|
assert!(document.GetCurrentScript().is_none());
|
||||||
self.run_a_module_script(&script, false);
|
self.run_a_module_script(&script, false);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
|
|
||||||
[load-error-events-inline.html]
|
|
||||||
type: testharness
|
|
||||||
expected: CRASH
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue