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>
This commit is contained in:
webbeef 2024-10-10 20:53:39 -07:00 committed by GitHub
parent c00c6e728d
commit 2b71130a8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 168 additions and 119 deletions

View file

@ -532,7 +532,7 @@ impl TimerListener {
},
};
// Step 7, substeps run in a task.
global.fire_timer(id);
global.fire_timer(id, CanGc::note());
}),
&self.canceller,
);
@ -2893,8 +2893,8 @@ impl GlobalScope {
}
}
pub fn fire_timer(&self, handle: TimerEventId) {
self.timers.fire_timer(handle, self);
pub fn fire_timer(&self, handle: TimerEventId, can_gc: CanGc) {
self.timers.fire_timer(handle, self, can_gc);
}
pub fn resume(&self) {
@ -3208,7 +3208,7 @@ impl GlobalScope {
}
}
pub fn handle_gamepad_event(&self, gamepad_event: GamepadEvent) {
pub fn handle_gamepad_event(&self, gamepad_event: GamepadEvent, can_gc: CanGc) {
match gamepad_event {
GamepadEvent::Connected(index, name, bounds, supported_haptic_effects) => {
self.handle_gamepad_connect(
@ -3217,6 +3217,7 @@ impl GlobalScope {
bounds.axis_bounds,
bounds.button_bounds,
supported_haptic_effects,
can_gc,
);
},
GamepadEvent::Disconnected(index) => {
@ -3239,6 +3240,7 @@ 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.
@ -3259,7 +3261,8 @@ impl GlobalScope {
axis_bounds,
button_bounds,
supported_haptic_effects,
false
false,
can_gc,
);
navigator.set_gamepad(selected_index as usize, &gamepad);
}