summaryrefslogtreecommitdiffstats
path: root/browser/modules/webrtcUI.jsm
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-03-17 13:09:02 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-03-17 13:09:02 +0100
commit191ec5415b5bc6f06cc5cd7b1d907575eb928332 (patch)
tree50f069647c83deb8ef587dadc50b31a08efccfda /browser/modules/webrtcUI.jsm
parent56bcb6b5af91696e2700b6477db2473b5921bce1 (diff)
downloadUXP-191ec5415b5bc6f06cc5cd7b1d907575eb928332.tar
UXP-191ec5415b5bc6f06cc5cd7b1d907575eb928332.tar.gz
UXP-191ec5415b5bc6f06cc5cd7b1d907575eb928332.tar.lz
UXP-191ec5415b5bc6f06cc5cd7b1d907575eb928332.tar.xz
UXP-191ec5415b5bc6f06cc5cd7b1d907575eb928332.zip
Use origin instead of documentURI for WebRTC permission requests, when available.
Diffstat (limited to 'browser/modules/webrtcUI.jsm')
-rw-r--r--browser/modules/webrtcUI.jsm8
1 files changed, 7 insertions, 1 deletions
diff --git a/browser/modules/webrtcUI.jsm b/browser/modules/webrtcUI.jsm
index b24135bfc..08de46bb3 100644
--- a/browser/modules/webrtcUI.jsm
+++ b/browser/modules/webrtcUI.jsm
@@ -290,7 +290,13 @@ function prompt(aBrowser, aRequest) {
let {audioDevices: audioDevices, videoDevices: videoDevices,
sharingScreen: sharingScreen, sharingAudio: sharingAudio,
requestTypes: requestTypes} = aRequest;
- let uri = Services.io.newURI(aRequest.documentURI, null, null);
+ let uri;
+ try {
+ // This fails for principals that serialize to "null", e.g. file URIs.
+ uri = Services.io.newURI(aRequest.origin, null, null);
+ } catch (e) {
+ uri = Services.io.newURI(aRequest.documentURI, null, null);
+ }
let host = getHost(uri);
let chromeDoc = aBrowser.ownerDocument;
let chromeWin = chromeDoc.defaultView;