mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
CanGc fixes from EventTarget::fire_event (#33985)
Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
This commit is contained in:
parent
bb4932026c
commit
ea875f0a51
35 changed files with 155 additions and 115 deletions
|
@ -27,7 +27,7 @@ use crate::dom::bindings::structuredclone;
|
|||
use crate::dom::bindings::trace::RootedTraceableBox;
|
||||
use crate::dom::eventtarget::EventTarget;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::JSContext;
|
||||
use crate::script_runtime::{CanGc, JSContext};
|
||||
use crate::task::TaskOnce;
|
||||
|
||||
pub type TrustedServiceWorkerAddress = Trusted<ServiceWorker>;
|
||||
|
@ -74,15 +74,15 @@ impl ServiceWorker {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn dispatch_simple_error(address: TrustedServiceWorkerAddress) {
|
||||
pub fn dispatch_simple_error(address: TrustedServiceWorkerAddress, can_gc: CanGc) {
|
||||
let service_worker = address.root();
|
||||
service_worker.upcast().fire_event(atom!("error"));
|
||||
service_worker.upcast().fire_event(atom!("error"), can_gc);
|
||||
}
|
||||
|
||||
pub fn set_transition_state(&self, state: ServiceWorkerState) {
|
||||
pub fn set_transition_state(&self, state: ServiceWorkerState, can_gc: CanGc) {
|
||||
self.state.set(state);
|
||||
self.upcast::<EventTarget>()
|
||||
.fire_event(atom!("statechange"));
|
||||
.fire_event(atom!("statechange"), can_gc);
|
||||
}
|
||||
|
||||
pub fn get_script_url(&self) -> ServoUrl {
|
||||
|
@ -167,6 +167,6 @@ impl ServiceWorkerMethods for ServiceWorker {
|
|||
impl TaskOnce for SimpleWorkerErrorHandler<ServiceWorker> {
|
||||
#[allow(crown::unrooted_must_root)]
|
||||
fn run_once(self) {
|
||||
ServiceWorker::dispatch_simple_error(self.addr);
|
||||
ServiceWorker::dispatch_simple_error(self.addr, CanGc::note());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue