diff --git a/browser/base/content/popup-notifications.inc b/browser/base/content/popup-notifications.inc
index 4e563af8a291..bdc2d0bd3570 100644
--- a/browser/base/content/popup-notifications.inc
+++ b/browser/base/content/popup-notifications.inc
@@ -30,6 +30,10 @@
+
+
+
+
diff --git a/browser/locales/en-US/chrome/browser/browser.properties b/browser/locales/en-US/chrome/browser/browser.properties
index 5cba325a7aea..940ea924ee0b 100644
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -486,6 +486,15 @@ getUserMedia.shareCameraAndAudioCapture.message = Would you like to share your c
getUserMedia.shareScreenAndMicrophone.message = Would you like to share your microphone and screen with %S?
getUserMedia.shareScreenAndAudioCapture.message = Would you like to share this tab’s audio and your screen with %S?
getUserMedia.shareAudioCapture.message = Would you like to share this tab’s audio with %S?
+# LOCALIZATION NOTE (getUserMedia.shareScreenWarning.message): NB: inserted via innerHTML, so please don't use <, > or & in this string.
+# %S will be the 'learn more' link
+getUserMedia.shareScreenWarning.message = Only share screens with sites you trust. Sharing can allow deceptive sites to browse as you and steal your private data. %S
+# LOCALIZATION NOTE (getUserMedia.shareFirefoxWarning.message): NB: inserted via innerHTML, so please don't use <, > or & in this string.
+# %1$S is brandShortName (eg. Firefox)
+# %2$S will be the 'learn more' link
+getUserMedia.shareFirefoxWarning.message = Only share %1$S with sites you trust. Sharing can allow deceptive sites to browse as you and steal your private data. %2$S
+# LOCALIZATION NOTE(getUserMedia.shareScreen.learnMoreLabel): NB: inserted via innerHTML, so please don't use <, > or & in this string.
+getUserMedia.shareScreen.learnMoreLabel = Learn More
getUserMedia.selectWindow.label=Window to share:
getUserMedia.selectWindow.accesskey=W
getUserMedia.selectScreen.label=Screen to share:
diff --git a/browser/modules/ContentWebRTC.jsm b/browser/modules/ContentWebRTC.jsm
index 54e6f6862437..bfb98a868a4d 100644
--- a/browser/modules/ContentWebRTC.jsm
+++ b/browser/modules/ContentWebRTC.jsm
@@ -178,8 +178,11 @@ function prompt(aContentWindow, aWindowID, aCallID, aConstraints, aDevices, aSec
// Verify that if we got a camera, we haven't requested a screen share,
// or that if we requested a screen share we aren't getting a camera.
if (video && (device.mediaSource == "camera") != sharingScreen) {
- videoDevices.push({name: device.name, deviceIndex: devices.length,
- id: device.rawId, mediaSource: device.mediaSource});
+ let deviceObject = {name: device.name, deviceIndex: devices.length,
+ id: device.rawId, mediaSource: device.mediaSource};
+ if (device.scary)
+ deviceObject.scary = true;
+ videoDevices.push(deviceObject);
devices.push(device);
}
break;
diff --git a/browser/modules/webrtcUI.jsm b/browser/modules/webrtcUI.jsm
index e2b1600b4023..eff72f72bc25 100644
--- a/browser/modules/webrtcUI.jsm
+++ b/browser/modules/webrtcUI.jsm
@@ -485,10 +485,12 @@ function prompt(aBrowser, aRequest) {
// Build the list of 'devices'.
let monitorIndex = 1;
for (let i = 0; i < devices.length; ++i) {
+ let device = devices[i];
+
let name;
// Building screen list from available screens.
if (type == "screen") {
- if (devices[i].name == "Primary Monitor") {
+ if (device.name == "Primary Monitor") {
name = stringBundle.getString("getUserMedia.shareEntireScreen.label");
} else {
name = stringBundle.getFormattedString("getUserMedia.shareMonitor.label",
@@ -497,7 +499,7 @@ function prompt(aBrowser, aRequest) {
}
}
else {
- name = devices[i].name;
+ name = device.name;
if (type == "application") {
// The application names returned by the platform are of the form:
// \x1e
@@ -510,7 +512,9 @@ function prompt(aBrowser, aRequest) {
}
}
let item = addDeviceToList(menupopup, name, i, typeName);
- item.deviceId = devices[i].id;
+ item.deviceId = device.id;
+ if (device.scary)
+ item.scary = true;
}
// Always re-select the "No " item.
@@ -530,6 +534,36 @@ function prompt(aBrowser, aRequest) {
return;
}
+ let scary = event.target.scary;
+ let warning = chromeDoc.getElementById("webRTC-previewWarning");
+ warning.hidden = !scary;
+ let chromeWin = chromeDoc.defaultView;
+ if (scary) {
+ warning.hidden = false;
+ let string;
+ let bundle = chromeWin.gNavigatorBundle;
+
+ let learnMoreText =
+ bundle.getString("getUserMedia.shareScreen.learnMoreLabel");
+ let baseURL =
+ Services.urlFormatter.formatURLPref("app.support.baseURL");
+ let learnMore =
+ "";
+
+ if (type == "screen") {
+ string = bundle.getFormattedString("getUserMedia.shareScreenWarning.message",
+ [learnMore]);
+ }
+ else {
+ let brand =
+ chromeDoc.getElementById("bundle_brand").getString("brandShortName");
+ string = bundle.getFormattedString("getUserMedia.shareFirefoxWarning.message",
+ [brand, learnMore]);
+ }
+ warning.innerHTML = string;
+ }
+
let perms = Services.perms;
let chromeUri = Services.io.newURI(chromeDoc.documentURI, null, null);
perms.add(chromeUri, "MediaManagerVideo", perms.ALLOW_ACTION,
@@ -537,7 +571,6 @@ function prompt(aBrowser, aRequest) {
video.deviceId = deviceId;
let constraints = { video: { mediaSource: type, deviceId: {exact: deviceId } } };
- let chromeWin = chromeDoc.defaultView;
chromeWin.navigator.mediaDevices.getUserMedia(constraints).then(stream => {
if (video.deviceId != deviceId) {
// The user has selected a different device or closed the panel
diff --git a/browser/themes/shared/jar.inc.mn b/browser/themes/shared/jar.inc.mn
index 2695515f554b..4726f5f8cfa7 100644
--- a/browser/themes/shared/jar.inc.mn
+++ b/browser/themes/shared/jar.inc.mn
@@ -123,6 +123,7 @@
skin/classic/browser/update-badge.svg (../shared/update-badge.svg)
skin/classic/browser/update-badge-failed.svg (../shared/update-badge-failed.svg)
skin/classic/browser/warning.svg (../shared/warning.svg)
+ skin/classic/browser/warning-white.svg (../shared/warning-white.svg)
skin/classic/browser/cert-error.svg (../shared/incontent-icons/cert-error.svg)
skin/classic/browser/session-restore.svg (../shared/incontent-icons/session-restore.svg)
skin/classic/browser/tab-crashed.svg (../shared/incontent-icons/tab-crashed.svg)
diff --git a/browser/themes/shared/notification-icons.inc.css b/browser/themes/shared/notification-icons.inc.css
index d48d058fedcd..178721e25fa6 100644
--- a/browser/themes/shared/notification-icons.inc.css
+++ b/browser/themes/shared/notification-icons.inc.css
@@ -155,6 +155,15 @@
list-style-image: url(chrome://browser/skin/notification-icons.svg#screen-blocked);
}
+#webRTC-preview:not([hidden]) {
+ display: -moz-stack;
+ border-radius: 4px;
+ border: 1px solid GrayText;
+ overflow: hidden;
+ min-width: 300px;
+ min-height: 10em;
+}
+
html|*#webRTC-previewVideo {
width: 300px;
/* If we don't set the min-width, width is ignored. */
@@ -162,6 +171,18 @@ html|*#webRTC-previewVideo {
max-height: 200px;
}
+#webRTC-previewWarning {
+ background: rgba(255, 217, 99, .8) url("chrome://browser/skin/warning-white.svg") no-repeat .75em .75em;
+ margin: 0;
+ padding: .5em;
+ padding-inline-start: calc(1.5em + 16px);
+ border-top: 1px solid GrayText;
+}
+
+#webRTC-previewWarning > .text-link {
+ margin-inline-start: 0;
+}
+
/* This icon has a block sign in it, so we don't need a blocked version. */
.popup-icon {
list-style-image: url("chrome://browser/skin/notification-icons.svg#popup");
diff --git a/browser/themes/shared/warning-white.svg b/browser/themes/shared/warning-white.svg
new file mode 100644
index 000000000000..942c23cf67c4
--- /dev/null
+++ b/browser/themes/shared/warning-white.svg
@@ -0,0 +1,6 @@
+
+