aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/timers.rs
diff options
context:
space:
mode:
authorwebbeef <me@webbeef.org>2024-10-10 20:53:39 -0700
committerGitHub <noreply@github.com>2024-10-11 03:53:39 +0000
commit2b71130a8a95d0c723532d2486493b5db0c9e1b1 (patch)
tree0d6ea3caab12b9787f3f76cd8056272c82eb4afc /components/script/timers.rs
parentc00c6e728ddb82d6cb646eb924a73c4b43a798a4 (diff)
downloadservo-2b71130a8a95d0c723532d2486493b5db0c9e1b1.tar.gz
servo-2b71130a8a95d0c723532d2486493b5db0c9e1b1.zip
Various CanGc fixes (#33800)
* CanGc fix for pagetransitionevent Signed-off-by: webbeef <me@webbeef.org> * CanGc fix for dom/node Signed-off-by: webbeef <me@webbeef.org> * CanGc fix for gamepad Signed-off-by: webbeef <me@webbeef.org> * CanGc fix for gpu Signed-off-by: webbeef <me@webbeef.org> * CanGc fix for dom/element Signed-off-by: webbeef <me@webbeef.org> * CanGc fix for xhr Signed-off-by: webbeef <me@webbeef.org> * CanGc fix for dom/worker Signed-off-by: webbeef <me@webbeef.org> * CanGc fix for rtcdatachannel Signed-off-by: webbeef <me@webbeef.org> * CanGc fix for rtcerror Signed-off-by: webbeef <me@webbeef.org> * Address review comments Signed-off-by: webbeef <me@webbeef.org> --------- Signed-off-by: webbeef <me@webbeef.org>
Diffstat (limited to 'components/script/timers.rs')
-rw-r--r--components/script/timers.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/components/script/timers.rs b/components/script/timers.rs
index 9022ea4bc2d..3b70a344f8c 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -29,6 +29,7 @@ use crate::dom::htmlmetaelement::RefreshRedirectDue;
use crate::dom::testbinding::TestBindingCallback;
use crate::dom::xmlhttprequest::XHRTimeoutCallback;
use crate::script_module::ScriptFetchOptions;
+use crate::script_runtime::CanGc;
use crate::script_thread::ScriptThread;
#[derive(Clone, Copy, Debug, Eq, Hash, JSTraceable, MallocSizeOf, Ord, PartialEq, PartialOrd)]
@@ -88,9 +89,9 @@ pub enum OneshotTimerCallback {
}
impl OneshotTimerCallback {
- fn invoke<T: DomObject>(self, this: &T, js_timers: &JsTimers) {
+ fn invoke<T: DomObject>(self, this: &T, js_timers: &JsTimers, can_gc: CanGc) {
match self {
- OneshotTimerCallback::XhrTimeout(callback) => callback.invoke(),
+ OneshotTimerCallback::XhrTimeout(callback) => callback.invoke(can_gc),
OneshotTimerCallback::EventSourceTimeout(callback) => callback.invoke(),
OneshotTimerCallback::JsTimer(task) => task.invoke(this, js_timers),
OneshotTimerCallback::TestBindingCallback(callback) => callback.invoke(),
@@ -190,7 +191,7 @@ impl OneshotTimers {
}
}
- pub fn fire_timer(&self, id: TimerEventId, global: &GlobalScope) {
+ pub fn fire_timer(&self, id: TimerEventId, global: &GlobalScope, can_gc: CanGc) {
let expected_id = self.expected_event_id.get();
if expected_id != id {
debug!(
@@ -233,7 +234,7 @@ impl OneshotTimers {
return;
}
let callback = timer.callback;
- callback.invoke(global, &self.js_timers);
+ callback.invoke(global, &self.js_timers, can_gc);
}
self.schedule_timer_call();