New issue
Advanced search Search tips

Issue 840487 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 3
Type: Bug



Sign in to add a comment

Gamepad state changes after being returned from navigator.getGamepads()

Project Member Reported by mattreynolds@chromium.org, May 7 2018

Issue description

Chrome Version: 66.0.3359.139 (Official Build) (64-bit)
OS: Linux

What steps will reproduce the problem?

(1) Connect a gamepad and load html5gamepad.com. This page calls navigator.getGamepad() periodically and registers gamepadconnected and gamepaddisconnected listeners.
(2) While on the page, open the developer console and get the current gamepad state.

> var pad = navigator.getGamepads()[0];

(3) Move the joystick while printing pads.axes to the developer console.

What is the expected result?

The axis values should remain the same as when |pad| was first assigned.

What happens instead?

The contents of |pad.axes| changes as the analog stick is moved.

 
We're returning a reference to a buffer that may still be in use.

Note that this requires that the page calls getGamepads() regularly to reproduce. The buffer is only written when getGamepads() is called so this doesn't leak any information that isn't already available to the page.

To fix, we should make sure a copy is made when the buffer is returned to the page.
Status: Available (was: Untriaged)

Sign in to add a comment