mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1284878 - display a scary warning when the user is about to share Firefox or the whole screen, r=Gijs.
This commit is contained in:
parent
71c85e91bb
commit
1806b991f7
@ -30,6 +30,10 @@
|
||||
|
||||
<popupnotificationcontent id="webRTC-preview" hidden="true">
|
||||
<html:video id="webRTC-previewVideo"/>
|
||||
<vbox id="webRTC-previewWarningBox">
|
||||
<spacer flex="1"/>
|
||||
<description id="webRTC-previewWarning"/>
|
||||
</vbox>
|
||||
</popupnotificationcontent>
|
||||
|
||||
<popupnotificationcontent id="webRTC-selectMicrophone" orient="vertical">
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
// <window count>\x1e<application name>
|
||||
@ -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 <type>" 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 =
|
||||
"<label class='text-link' href='" + baseURL + "screenshare-safety'>" +
|
||||
learnMoreText + "</label>";
|
||||
|
||||
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
|
||||
|
@ -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)
|
||||
|
@ -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");
|
||||
|
6
browser/themes/shared/warning-white.svg
Normal file
6
browser/themes/shared/warning-white.svg
Normal file
@ -0,0 +1,6 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
|
||||
<path fill="#fff" stroke="#000" stroke-opacity="0.3" d="M15.4,12.9 9.46,1.41 C9.12,0.756 8.59,0.381 8,0.381 7.41,0.381 6.88,0.756 6.54,1.41 L0.642,12.9 c-0.331,0.6 -0.348,1.3 -0.05,1.9 0.299,0.5 0.854,0.8 1.534,0.8 H13.9 c0.6,0 1.2,-0.3 1.5,-0.8 0.3,-0.6 0.3,-1.3 0,-1.9z M8.83,5.07 8.65,10.5 H7.34 L7.15,5.07 H8.83z M8,13.7 c-0.55,0 -0.99,-0.5 -0.99,-1 0,-0.6 0.44,-1 0.99,-1 0.56,0 0.99,0.4 0.99,1 0,0.5 -0.43,1 -0.99,1z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 711 B |
Loading…
Reference in New Issue
Block a user