Closed Bug 1397978 Opened 7 years ago Closed 2 years ago

Delay enumerateDevices() success until page has focus

Categories

(Core :: WebRTC: Audio/Video, enhancement, P2)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1732410
Tracking Status
firefox57 --- affected

People

(Reporter: jib, Assigned: jib)

Details

To be spec compliant we must implement the [[storedDeviceList]] requirement in enumerateDevices [1] which prevents JS from polling on enumerateDevices to circumvent devicechange event restrictions.

Basically, subsequent calls to enumerateDevices must return the same (cached) result, until a devicechange event has been fired on navigator.mediaDevices.

We should not land this before bug 1397977, to prevent hampering users.

[1] https://w3c.github.io/mediacapture-main/getusermedia.html#dom-mediadevices-enumeratedevices()
Rank: 22
Mass change P2->P3 to align with new Mozilla triage process.
Priority: P2 → P3
Assignee: nobody → jib
Priority: P3 → P2
Summary: Cache enumerateDevices list to not reveal updates until devicechange event has fired. → Mitigate enumerateDevices() revealing new device info until devicechange event has fired.
Rank: 22 → 19
See Also: → 1528042

To be spec compliant we must implement the [[storedDeviceList]] requirement in enumerateDevices

The [[storedDeviceList]] has been revealed to be insufficient to guard against background access. The new plan is to postpone the promise from enumerateDevices() until the page receives focus, similar to what we do for getUserMedia() today.

[1] https://github.com/w3c/mediacapture-main/issues/561#issuecomment-457713003

See Also: → 1528078

Some more context on this: getUserMedia has the following language today:

The plan would be to add similar language to enumerateDevices() to solve this issue.

The new spec language mentioned in comment 3 is now available in enumerateDevices:

  • The User Agent MUST wait to proceed to the next step until the device information can be exposed check returns true.
    The User Agent MAY wait to proceed to the next step until document is fully active and has focus.

I'm leaning toward implementing the latter.

Summary: Mitigate enumerateDevices() revealing new device info until devicechange event has fired. → Delay enumerateDevices() success until page has focus
Depends on: 1704177
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → DUPLICATE
No longer depends on: 1704177
No longer depends on: 1397977
See Also: 1528078
See Also: 1528042
You need to log in before you can comment on or make changes to this bug.