NEW 215775
navigator.getGamepads() returns live Gamepad objects instead of snapshots
https://bugs.webkit.org/show_bug.cgi?id=215775
Summary navigator.getGamepads() returns live Gamepad objects instead of snapshots
James Howard
Reported 2020-08-24 11:55:06 PDT
Created attachment 407119 [details] Test page navigator.getGamepads() returns live Gamepad objects instead of snapshots According to the HTML5 Gamepad spec[1], each gamepad object returned from navigator.getGamepads() is to be a snapshot of the gamepad state: > getGamepads() > Retrieve a snapshot of the data for the the currently connected and interacted-with gamepads. Attached is a small test page that saves the result of Gamepad objects returned from getGamepads() each animation tick, and checks to see if they are snapshots or if they are live objects, by comparing with a manually created snapshot object. Testing this page with a gamepad in Safari will show a number of mismatch errors in the top line of the textarea on the page -- errors being when the saved Gamepad object doesn't match up with the manual snapshot because it changed since getGamepads() was called. Steps to reproduce: 1. Load attached test page 2. Press buttons on an attached gamepad 3. Count mismatch errors shown on test page Reproduces in: Version/14.0 Safari/605.1.15 (macOS 10.15.6) Version/14.0 Safari/605.1.15 (iPadOS 14 Beta 5 (18A5351d)) Version/13.1.2 Safari/604.1 (iOS 13.6) Does not reproduce in: Chrome Version 84.0.4147.135 (macOS 10.15.6) [^1] https://w3c.github.io/gamepad/#navigator-interface-extension
Attachments
Test page (3.05 KB, text/html)
2020-08-24 11:55 PDT, James Howard
no flags
Radar WebKit Bug Importer
Comment 1 2020-08-24 16:52:17 PDT
Note You need to log in before you can comment on or make changes to this bug.