refactor: propagate CanGc arguments through callers (#35565)

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
This commit is contained in:
Auguste Baum 2025-02-21 18:35:17 +01:00 committed by GitHub
parent 085cd981aa
commit ca1f0486ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 62 additions and 42 deletions

View file

@ -860,7 +860,7 @@ impl HTMLScriptElement {
doc.set_pending_parsing_blocking_script(self, Some(result));
} else {
// Step 27.i: otherwise.
self.execute(result);
self.execute(result, can_gc);
}
},
ScriptType::Module => {
@ -917,7 +917,7 @@ impl HTMLScriptElement {
}
/// <https://html.spec.whatwg.org/multipage/#execute-the-script-block>
pub(crate) fn execute(&self, result: ScriptResult) {
pub(crate) fn execute(&self, result: ScriptResult, can_gc: CanGc) {
// Step 1.
let doc = self.owner_document();
if self.parser_inserted.get() && *doc != *self.parser_document {
@ -928,7 +928,7 @@ impl HTMLScriptElement {
// Step 2.
Err(e) => {
warn!("error loading script {:?}", e);
self.dispatch_error_event(CanGc::note());
self.dispatch_error_event(can_gc);
return;
},
@ -967,12 +967,12 @@ impl HTMLScriptElement {
match script.type_ {
ScriptType::Classic => {
self.run_a_classic_script(&script, CanGc::note());
self.run_a_classic_script(&script, can_gc);
document.set_current_script(old_script.as_deref());
},
ScriptType::Module => {
assert!(document.GetCurrentScript().is_none());
self.run_a_module_script(&script, false, CanGc::note());
self.run_a_module_script(&script, false, can_gc);
},
}
@ -983,7 +983,7 @@ impl HTMLScriptElement {
// Step 6.
if script.external {
self.dispatch_load_event(CanGc::note());
self.dispatch_load_event(can_gc);
}
}