"Failed to allocate videosource" error if you try to call getUserMedia inside an iframe in JSBin
Categories
(Core :: WebRTC: Audio/Video, defect, P3)
Tracking
()
People
(Reporter: adam, Assigned: padenot)
References
Details
(Keywords: stale-bug)
Steps to repro: See https://jsbin.com/yokexuc/edit?html,js,output 1) Create an iframe 2) call iframe.contentWindow.navigator.getUserMedia Result: You get an error "Failed to allocate audiosource" This is a regression in Firefox 56. Not sure whether it is intentional. If it is it seems there could be a nicer error message. It took me a while to figure out what was the problem.
Assignee | ||
Comment 1•7 years ago
|
||
Interesting, I can repro, but it says "Failed to allocate videosource". In any case, I tracked it down, seems like a regression from bug 1320170. Considering this bug does not talk about iframes, it must be accidental. Baku, it seems like your patch changed this, was it on purpose ?
Assignee | ||
Updated•7 years ago
|
Assignee | ||
Updated•7 years ago
|
Comment 2•7 years ago
|
||
The issue here is about the principal of a new iframe element. When a new iframe is created, we load about:blank, but the iframe principal has the codebase of the parent window (https://jsbin.com/something) Here what happens in steps: 1. Using the principal, getUserMedia() checks the permission. the principal says that the codebase is equal to the URL of iframe parent (https://jsbin.com/something) 2. We need to show the permission prompt. This operation is done by the parent process. 3. the parent process, using the windowID, knows that the URL is about:blank and it shows a permission prompt for it. 4. the permission is granted by the user. 5. the content process tries to create a audio/video source and it checks the permission again using the same principal as point 1. the URL https://jsbin.com/something doesn't have permission. 6. we show the error. Smaug, is it correct that a new iframe, after loading about:blank, has a principal with the parent URL as codebase?
Assignee | ||
Updated•7 years ago
|
Comment 4•7 years ago
|
||
Adam, Can we verify that it said "videosource" for you, and not "audiosource", and that your problem is limited to cameras, not microphones?
Comment 5•7 years ago
|
||
Note that even though the regression-range is the same, this differs from bug 1367805 in that the iframe is not sandboxed, so we should make it work if we can. Also, JSBin, like JSFiddle, uses "allow-same-origin" in the implicit sandboxed iframe(s) they wrap everything in (JSBin apparently wraps it in two nested iframes for some reason, the inner one without a src attribute apparently, dunno if that matters) FWIW gUM in plain iframes appears to work just fine in https://jsfiddle.net/jib1/hut751ep/
Updated•7 years ago
|
Reporter | ||
Comment 6•7 years ago
|
||
Now I'm getting "Failed to allocate videosource". Yes, my problem is also limited to cameras, if I do video:false as the constraint then it works fine with audio only. Also, it works fine with fake devices, it's only with a real camera that I get this error.
Comment 7•7 years ago
|
||
Mass change P1->P2 to align with new Mozilla triage process
Comment 8•6 years ago
|
||
Moving to p3 because no activity for at least 1 year(s). See https://github.com/mozilla/bug-handling/blob/master/policy/triage-bugzilla.md#how-do-you-triage for more information
Assignee | ||
Comment 9•5 years ago
|
||
jib, you've been doing some stuff in the area lately, what is the currrent behaviour here?
Comment 10•5 years ago
|
||
This particular iframe bug was somewhat particular to JBin—which if I'm guessing, may have had to do with delayed setting of .src attribute, see comment 5—with unique symptoms:
In the case where it fails with "Failed to allocate videosource":
- The prompt will say "Will you allow about:blank to use your camera and microphone?
- And when you allow, it JSBin says: "The page at https://null.jsbin.com says: Failed to allocate videosource"
I did some archeology, and this was fixed in 2017-12-06 in bug 1366357, after which it works:
- The prompt will say "Will you allow null.jsbin.com to use your camera and microphone?
- Camera and mic succeed.
5:51.11 INFO: First good revision: 99a3b09ac1898eb1db05430e2876d6643ba0d4a8 (2017-12-06)
5:51.11 INFO: Last bad revision: 18a9cb5cb32d0e8031d0a80901b199d5e9827d83 (2017-12-05)
5:51.11 INFO: Pushlog:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=18a9cb5cb32d0e8031d0a80901b199d5e9827d83&tochange=99a3b09ac1898eb1db05430e2876d6643ba0d4a8
Note that while this still works in release, it will stop working and fail with NotAllowedError once we enable dom.security.featurePolicy.enabled (which is currently enabled in Nightly).
Description
•