Closed Bug 1568076 Opened 6 years ago Closed 3 years ago

While WebVR is enabled, Gamepad API can report no gamepads briefly when console is opened

Categories

(Core :: WebVR, enhancement, P2)

68 Branch
enhancement

Tracking

()

RESOLVED WONTFIX

People

(Reporter: kevin, Unassigned)

Details

Additionally, the "gamepadconnected" event fires every time the console is re-opened, but "gamepaddisconnected" does not.

Repro:
Tested with Vive controllers, but possibly occurring with other devices as well.

  1. Go to: https://webvr.info/samples/XX-vr-controllers.html
  2. Enter VR with controllers connected.
  3. in the console, enter the following:
setInterval(() => {
  console.log(navigator.getGamepads().length)
}, 0);
window.addEventListener("gamepaddisconnected", () => {
  console.log("disconnected");
});
window.addEventListener("gamepadconnected", () => {
  console.log("connected");
});
  1. Repeatedly open and close the console.
  2. Observe that "connected" will repeatedly fire when opening the console, and that the gamepad length will sometimes report as "0" briefly. See screenshot below:
    https://i.gyazo.com/9c33208d6aaf6965a3c092ed990379ba.png

Expectation:
If it is intended that the gamepads be reconnected when opening the console, then "gamepaddisconnected" should correctly fire. Otherwise, the gamepads should remain connected and "gamepadconnected" should not fire.

Tested on both 68 and 70.

Assignee: nobody → dmu
Priority: -- → P2

I would like to give this "Enhancement" tag because it only happens in Console window and that are mostly for developers.

Type: defect → enhancement

Daosheng, could DevTools help with this?

Flags: needinfo?(dmu)

(In reply to :Harald Kirschner :digitarald from comment #2)

Daosheng, could DevTools help with this?

That would be great if DevTools can jump into this bug. I would guess if Dev tool is running at an individual process and GamepadManager doesn't construct IPC connection with it properly.

Flags: needinfo?(dmu)

I would guess if Dev tool is running at an individual process

DevTools is on main process.

GamepadManager doesn't construct IPC connection with it properly.

The IPC issue you describe sounds rather like this issue is in the GamepadManager and not DevTools? Can you elaborate, so I can ni? the right team?

(In reply to :Harald Kirschner :digitarald from comment #4)

I would guess if Dev tool is running at an individual process

DevTools is on main process.

GamepadManager doesn't construct IPC connection with it properly.

The IPC issue you describe sounds rather like this issue is in the GamepadManager and not DevTools? Can you elaborate, so I can ni? the right team?

Navigator and GamepadManager are running at the content process. GamepadManager tells nsGlobalWindow how many gamepads it has. The controller information comes from VRManager, it runs at the main process and queries VR hardware related information, and notify the content process via IPC.

GamepadManager will remove all gamepads and ask for re-query current available VR controllers from VRManager when there is no other global windows are using GamepadManager and users ask for refreshing a gamepad page.

Any idea what could be going on here with Console and VRManager/GamepadManager?

Flags: needinfo?(nchevobbe)

I don't have controllers so I can't tell (you can send me a HTC Vive whenever you want :D )

I really don't see why the console would have any impact on this.
Here the code from Comment 0 simply add event listeners, like a script would do.

Kevin, could you set a test page where you put the events listeners in the page itself (not in console) and check if you get different results?

Flags: needinfo?(nchevobbe) → needinfo?(kevin)

Hi sorry for the really long delay on this- I don't use Bugzilla much. Went ahead and and put together a simple glitch example as requested: https://glitch.com/edit/#!/blue-mozzarella (note that this uses A-Frame to handle the "Enter VR" part). Same results occur when following the original repro steps.

Flags: needinfo?(kevin)
Assignee: dmu → kgilbert

The bug assignee didn't login in Bugzilla in the last 7 months.
:jimm, could you have a look please?
For more information, please visit auto_nag documentation.

Assignee: kearwood → nobody
Flags: needinfo?(jmathies)
Status: NEW → RESOLVED
Closed: 3 years ago
Flags: needinfo?(jmathies)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.