aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/globalscope.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2024-10-18 13:26:54 -0400
committerGitHub <noreply@github.com>2024-10-18 17:26:54 +0000
commitb85093ad7461122447298d91acd19040c31c42a9 (patch)
treeb83e2e52452cf3e93caefa0461bf66be25c97205 /components/script/dom/globalscope.rs
parenta58da5aa832a67c827021592fe0397a532491c4c (diff)
downloadservo-b85093ad7461122447298d91acd19040c31c42a9.tar.gz
servo-b85093ad7461122447298d91acd19040c31c42a9.zip
Prevent moving CanGc values between threads/tasks (#33902)
* Make CanGc non-sendable, and add documentation. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Update CanGc usage to fix usages that were moved between threads/tasks. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Diffstat (limited to 'components/script/dom/globalscope.rs')
-rw-r--r--components/script/dom/globalscope.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs
index fa2574cc252..74dca15fedd 100644
--- a/components/script/dom/globalscope.rs
+++ b/components/script/dom/globalscope.rs
@@ -3185,7 +3185,7 @@ impl GlobalScope {
}
}
- pub fn handle_gamepad_event(&self, gamepad_event: GamepadEvent, can_gc: CanGc) {
+ pub fn handle_gamepad_event(&self, gamepad_event: GamepadEvent) {
match gamepad_event {
GamepadEvent::Connected(index, name, bounds, supported_haptic_effects) => {
self.handle_gamepad_connect(
@@ -3194,7 +3194,6 @@ impl GlobalScope {
bounds.axis_bounds,
bounds.button_bounds,
supported_haptic_effects,
- can_gc,
);
},
GamepadEvent::Disconnected(index) => {
@@ -3207,7 +3206,7 @@ impl GlobalScope {
}
/// <https://www.w3.org/TR/gamepad/#dfn-gamepadconnected>
- pub fn handle_gamepad_connect(
+ fn handle_gamepad_connect(
&self,
// As the spec actually defines how to set the gamepad index, the GilRs index
// is currently unused, though in practice it will almost always be the same.
@@ -3217,7 +3216,6 @@ impl GlobalScope {
axis_bounds: (f64, f64),
button_bounds: (f64, f64),
supported_haptic_effects: GamepadSupportedHapticEffects,
- can_gc: CanGc,
) {
// TODO: 2. If document is not null and is not allowed to use the "gamepad" permission,
// then abort these steps.
@@ -3239,7 +3237,7 @@ impl GlobalScope {
button_bounds,
supported_haptic_effects,
false,
- can_gc,
+ CanGc::note(),
);
navigator.set_gamepad(selected_index as usize, &gamepad);
}