script: Move Window-only gamepad functionality out of GlobalScope (#36805)

The only code that calls these methods is in the script thread, and the
code is simpler when we can assume a Window global. Pulling this thread
led to cleaning up a lot of constructors for Window-only WebXR code,
too.

Testing: Existing WPT coverage.

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-05-02 16:10:26 -04:00 committed by GitHub
parent 80d3e138a8
commit b8971e528f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 199 additions and 236 deletions

View file

@ -297,7 +297,13 @@ impl XRSystem {
return;
},
};
let session = XRSession::new(&self.global(), session, mode, frame_receiver, CanGc::note());
let session = XRSession::new(
self.global().as_window(),
session,
mode,
frame_receiver,
CanGc::note(),
);
if mode == XRSessionMode::Inline {
self.active_inline_sessions
.borrow_mut()