Open Bug 1517555 Opened 6 years ago Updated 5 months ago

One getUserMedia() call stalls when called from two iframes (one using srcdoc) simultaneously.

Categories

(Firefox :: Site Permissions, defect, P3)

52 Branch
defect

Tracking

()

People

(Reporter: jib, Unassigned)

References

Details

I ran into this while creating a WebRTC demo communicating with a srcdoc iframe on the same page. STRs: 1. Open https://jsfiddle.net/jib1/z85cbwn0/23/ 2. Hit "Allow" in the permission prompt. Expected result: .------- | https: | gum called | gum succeeded '------ https: gum called gum succeeded Actual result: .------- | about: | gum called | gum succeeded '------ https: gum called Main issue is outer gum call never resolves (the "about:" part I suspect is bug 960506?) Side-note: checking "Remember this decision" in the permission prompt yields: "Nightly can not allow permanent access to your camera.", even though the iframe otherwise appears to be SecureContext. Workaround: - Start with persisted camera permission: the outside call succeeds immediately, the iframe prompts, and clicking Allow makes it succeed as well. Got a report that delaying one call works as well, so maybe a race. Regression: - Does not appear to be a regression (I tested as far back as 52).
Flags: needinfo?(jhofmann)

So my guess from a cursory bit of debugging is that we're deleting the first permission prompt here: https://searchfox.org/mozilla-central/rev/b10ae6b7a50d176a813900cbe9dc18c85acd604b/toolkit/modules/PopupNotifications.jsm#504

So this wouldn't be a problem that affects only WebRTC.

At first I thought a fix for this could be feature policy, but this is happening even when the iframe has the same origin.

The right fix might be to "transfer" the callback that is applied to the permission prompt that gets removed to the new one IFF they have the same origin.

Flags: needinfo?(jhofmann)

This came up again in another fiddle: https://jsfiddle.net/jib1/p1wjse6v/ - I've added a 3 second delay as a workaround, with some interesting behavior:

  • If I grant the 1st prompt within the 3 seconds, then the 1st iframe gets its camera, and I get a 2nd prompt. Lovely.
  • But if I miss that window, then the 2nd iframe gets the camera instead, the 1st iframe gets nothing, and I get no 2nd prompt; unexpected.

I'm leaving this here in case it reveals something.

Yup, that confirms my findings in comment 1, the first prompt gets deleted.

Could this be what's affecting our feature policy web-platform-tests?

Severity: normal → S3
Priority: P2 → P3
You need to log in before you can comment on or make changes to this bug.