Open Bug 1691625 Opened 4 years ago Updated 2 years ago

Improve MediaManager::mPendingGUMRequest logic

Categories

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

defect

Tracking

()

ASSIGNED

People

(Reporter: karlt, Assigned: pehrsons)

References

(Blocks 3 open bugs, Regression)

Details

(Keywords: regression)

Attachments

(10 files, 1 obsolete file)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

mPendingGUMRequest was implemented as an incomplete band-aid, with multiple flaws including the following.

The check on whether to send a new request is based on whether there is an existing request for the relevant (inner) window, but pending requests are dispatched when a request in the same process (for a potentially different window) is completed.

Some error handling paths trigger SendPendingGUMRequest():

but others do not:

The queue blocks even requests that do not need a prompt.

Component: Site Permissions → WebRTC: Audio/Video
Product: Firefox → Core
Severity: -- → S4
Priority: -- → P2
Has Regression Range: --- → yes
Blocks: 1775945
Assignee: nobody → apehrson
Status: NEW → ASSIGNED

This is an attempt to make it clearer what an active window is. The term still
lives on through IsWindowStillActive and IsWindowListenerStillActive but it is
hopefully clearer that they only check whether a window listener is registered
to a window (id).

This hopefully reduces confusion with other terms, such as "active callbacks".

At least a local failure has been observed in
browser_devices_get_user_media_in_xorigin_frame.js.

This patch mainly moves window and call/request related data structures from
MediaManager into a new helper class called MediaManagerData. A lot of the
logic around these data structures moves along into MediaManagerData.

MediaManagerData stores the data in a natural way that better matches the
hierarchical relationships between calls, windows and MediaManager. This
improves readability of the affected code significantly, and makes it easier
to improve this code in the future.

It also takes over the responsibility to send some notifications to the
frontend, to declutter the code in MediaManager.

It is already baked into askPermission and therefore has no effect.

This patch removes the race by which MediaManager would check the registered
GetUserMediaTasks to determine whether to show a prompt, but pop the request
queue (thereby showing another prompt) at a later time than when unregistering
a GetUserMediaTask. This allowed another request to come in and show a prompt
in between these events, so that when popping the request queue there'd be two
simultaneous requests sent to the parent for prompting.

With this patch MediaManagerData is in charge of sending requests, and it will
only check the request queue when determining whether a request should be sent.

Blocks: 1334752
Blocks: 1739107
Blocks: 1503991
Blocks: 976544
Blocks: 1393761
Attachment #9317056 - Attachment is obsolete: true
Attachment #9317053 - Attachment description: Bug 1691625 - Don't look for "browserwindow" window attribute in the legacy indicator. r?karlt! → Bug 1691625 - Don't look for "sharingbrowserwindow" window attribute in the legacy indicator. r?karlt!
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: