CanGc fixes in several files (#33958)

* few cangc fixes

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* few cangc fixes

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

---------

Signed-off-by: L Ashwin B <lashwinib@gmail.com>
This commit is contained in:
chickenleaf 2024-10-22 03:02:22 +05:30 committed by GitHub
parent 1bf68567b8
commit ebfea9b352
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 170 additions and 129 deletions

View file

@ -19,6 +19,7 @@ use crate::dom::event::{Event, EventBubbles, EventCancelable};
use crate::dom::eventtarget::EventTarget;
use crate::dom::securitypolicyviolationevent::SecurityPolicyViolationEvent;
use crate::dom::types::GlobalScope;
use crate::script_runtime::CanGc;
use crate::task::TaskOnce;
pub struct CSPViolationReporter {
@ -100,7 +101,7 @@ impl CSPViolationReporter {
}
}
fn fire_violation_event(&self) {
fn fire_violation_event(&self, can_gc: CanGc) {
let target = self.target.root();
let global = &target.global();
let report = self.get_report(global);
@ -111,6 +112,7 @@ impl CSPViolationReporter {
EventBubbles::Bubbles,
EventCancelable::Cancelable,
&report.into(),
can_gc,
);
event.upcast::<Event>().fire(&target);
@ -142,7 +144,7 @@ impl TaskOnce for CSPViolationReporter {
// > If target implements EventTarget, fire an event named securitypolicyviolation
// > that uses the SecurityPolicyViolationEvent interface
// > at target with its attributes initialized as follows:
self.fire_violation_event();
self.fire_violation_event(CanGc::note());
// TODO: Support `report-to` directive that corresponds to 5.5.3.5.
}
}