More files with CanGc fixes (#33892)

* More files with CanGc fixes

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

* removed the can_gc inside !task

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-18 19:12:43 +05:30 committed by GitHub
parent fde8d72aca
commit af6154cf63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 226 additions and 100 deletions

View file

@ -212,8 +212,8 @@ impl WorkerEventLoopMethods for DedicatedWorkerGlobalScope {
&self.task_queue
}
fn handle_event(&self, event: MixedMessage, _can_gc: CanGc) -> bool {
self.handle_mixed_message(event)
fn handle_event(&self, event: MixedMessage, can_gc: CanGc) -> bool {
self.handle_mixed_message(event, can_gc)
}
fn handle_worker_post_event(&self, worker: &TrustedWorkerAddress) -> Option<AutoWorkerReset> {
@ -512,7 +512,7 @@ impl DedicatedWorkerGlobalScope {
(chan, Box::new(rx))
}
fn handle_script_event(&self, msg: WorkerScriptMsg) {
fn handle_script_event(&self, msg: WorkerScriptMsg, can_gc: CanGc) {
match msg {
WorkerScriptMsg::DOMMessage { origin, data } => {
let scope = self.upcast::<WorkerGlobalScope>();
@ -528,9 +528,10 @@ impl DedicatedWorkerGlobalScope {
Some(&origin.ascii_serialization()),
None,
ports,
can_gc,
);
} else {
MessageEvent::dispatch_error(target, scope.upcast());
MessageEvent::dispatch_error(target, scope.upcast(), can_gc);
}
},
WorkerScriptMsg::Common(msg) => {
@ -539,7 +540,7 @@ impl DedicatedWorkerGlobalScope {
}
}
fn handle_mixed_message(&self, msg: MixedMessage) -> bool {
fn handle_mixed_message(&self, msg: MixedMessage, can_gc: CanGc) -> bool {
// FIXME(#26324): `self.worker` is None in devtools messages.
match msg {
MixedMessage::Devtools(msg) => match msg {
@ -553,7 +554,7 @@ impl DedicatedWorkerGlobalScope {
},
MixedMessage::Worker(DedicatedWorkerScriptMsg::CommonWorker(linked_worker, msg)) => {
let _ar = AutoWorkerReset::new(self, linked_worker);
self.handle_script_event(msg);
self.handle_script_event(msg, can_gc);
},
MixedMessage::Worker(DedicatedWorkerScriptMsg::WakeUp) => {},
MixedMessage::Control(DedicatedWorkerControlMsg::Exit) => {
@ -614,7 +615,7 @@ impl DedicatedWorkerGlobalScope {
let global_scope = self.upcast::<GlobalScope>();
let pipeline_id = global_scope.pipeline_id();
let task = Box::new(task!(post_worker_message: move || {
Worker::handle_message(worker, data);
Worker::handle_message(worker, data, CanGc::note());
}));
self.parent_sender
.send(CommonScriptMsg::Task(