Closed
Bug 936104
Opened 11 years ago
Closed 11 years ago
[Gamepad] Pages using only navigator.getGamepads without event listeners don't get gamepad data
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
VERIFIED
FIXED
mozilla28
People
(Reporter: ted, Assigned: ted)
References
Details
Attachments
(2 files)
(deleted),
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
(deleted),
text/html
|
Details |
This is silly, but apparently the machinery to scan for gamepads and update the DOM only triggers if you add event listeners for gamepadconnected or gamepaddisconnected. Calling navigator.getGamepads isn't sufficient, which means that pages doing strictly polling won't actually get any gamepad data.
The simple workaround is just to add
addEventListener("gamepadconnected", function() {});
which will make things spin up.
Assignee | ||
Comment 1•11 years ago
|
||
This fixes this issue for me on a simple local test page. Unfortunately I can't write a test for this because all of the Mochitests use a fake gamepad service, which means they don't need to spin up a platform gamepad service anyway. Conveniently the patch is trivial.
Attachment #8342342 -
Flags: review?(bugs)
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → ted
Status: NEW → ASSIGNED
Comment 2•11 years ago
|
||
Comment on attachment 8342342 [details] [diff] [review]
pages using only navigator.getGamepads should trigger gamepad backend startup
A bit hackish, but mostly because SetHasGamepadEventListener name is odd.
We should change that to WantsGamepadUpdates() or some such, and
then have another method for the 'false' case, perhaps
DisconnectedFromGamepadService()
But you can do that in a followup.
Attachment #8342342 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 3•11 years ago
|
||
Assignee | ||
Comment 4•11 years ago
|
||
Filed bug 947172 on renaming that method.
Comment 5•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Assignee | ||
Comment 6•11 years ago
|
||
Here's a testcase you can use for verification. Connecting a gamepad and pressing a button on this page should display a message in the page body.
Comment 7•11 years ago
|
||
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0
With Nightly from 2013-11-06 no message is displayed.
On latest Aurora (Build ID:20140203004003) a message is displayed in the page body of the attached testcase when a button is pressed on the gamepad. Tested with Xbox 360 and Logitech F310 controllers.
Status: RESOLVED → VERIFIED
Keywords: verifyme
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•