Backed out 4 changesets (bug 1635257, bug 1637336) fr causing failures in browser_all_files_referenced.js CLOSED TREE

Backed out changeset 732ef8965a6e (bug 1635257)
Backed out changeset e3b350425e08 (bug 1635257)
Backed out changeset 2052da1ed54c (bug 1635257)
Backed out changeset 01ea90534f02 (bug 1637336)
This commit is contained in:
Noemi Erli 2020-05-16 03:21:32 +03:00
Родитель d2bfedea15
Коммит 573977550b
12 изменённых файлов: 35 добавлений и 289 удалений

Просмотреть файл

@ -23,18 +23,6 @@ XPCOMUtils.defineLazyServiceGetter(
const kBrowserURL = AppConstants.BROWSER_CHROME_URL;
class WebRTCChild extends JSWindowActorChild {
actorCreated() {
// The user might request that DOM notifications be silenced
// when sharing the screen. There doesn't seem to be a great
// way of storing that state in any of the objects going into
// the WebRTC API or coming out via the observer notification
// service, so we store it here on the actor.
//
// If the user chooses to silence notifications during screen
// share, this will get set to true.
this.suppressNotifications = false;
}
// Called only for 'unload' to remove pending gUM prompts in reloaded frames.
static handleEvent(aEvent) {
let contentWindow = aEvent.target.defaultView;
@ -107,9 +95,6 @@ class WebRTCChild extends JSWindowActorChild {
"getUserMedia:response:allow",
callID
);
this.suppressNotifications = !!aMessage.data.suppressNotifications;
break;
}
case "webrtc:Deny":
@ -416,7 +401,6 @@ function updateIndicators(aSubject, aTopic, aData) {
if (actor) {
let tabState = getTabStateForContentWindow(contentWindow, false);
tabState.windowId = getInnerWindowIDForWindow(contentWindow);
tabState.suppressNotifications = actor.suppressNotifications;
actor.sendAsyncMessage("webrtc:UpdateIndicators", tabState);
}

Просмотреть файл

@ -480,10 +480,6 @@ function prompt(aActor, aBrowser, aRequest) {
let chromeDoc = aBrowser.ownerDocument;
let stringBundle = chromeDoc.defaultView.gNavigatorBundle;
let localization = new Localization(
["branding/brand.ftl", "preview/popup-notifications.ftl"],
true
);
// Mind the order, because for simplicity we're iterating over the list using
// "includes()". This allows the rotation of string identifiers. We list the
@ -533,113 +529,37 @@ function prompt(aActor, aBrowser, aRequest) {
callback() {},
};
let notificationSilencingEnabled = Services.prefs.getBoolPref(
"privacy.webrtc.allowSilencingNotifications"
);
let secondaryActions = [];
if (notificationSilencingEnabled && sharingScreen) {
// We want to free up the checkbox at the bottom of the permission
// panel for the notification silencing option, so we use a
// different configuration for the permissions panel when
// notification silencing is enabled.
// The formatMessagesSync method returns an array of results
// for each message that was requested, and for the ones with
// attributes, returns an attributes array with objects like:
//
// { name: "someName", value: "somevalue" }
//
// For these strings, which use .label and .accesskey attributes,
// this convertAttributesToObjects function looks at the attributes
// property of each message, and returns back an array of objects,
// where each object property is one of the attribute names, and
// the property value is the attribute value.
//
// So, the above example would be converted into:
//
// { someName: "someValue" }
//
// which is much easier to access and pass along to other things.
let convertAttributesToObjects = messages => {
return messages.map(msg => {
return msg.attributes.reduce((acc, attribute) => {
acc[attribute.name] = attribute.value;
return acc;
}, {});
});
};
let [notNow, never] = convertAttributesToObjects(
localization.formatMessagesSync([
{ id: "popup-screen-sharing-not-now" },
{ id: "popup-screen-sharing-never" },
])
);
secondaryActions = [
{
label: notNow.label,
accessKey: notNow.accesskey,
callback(aState) {
aActor.denyRequest(aRequest);
let secondaryActions = [
{
label: stringBundle.getString("getUserMedia.dontAllow.label"),
accessKey: stringBundle.getString("getUserMedia.dontAllow.accesskey"),
callback(aState) {
aActor.denyRequest(aRequest);
let scope = SitePermissions.SCOPE_TEMPORARY;
if (aState && aState.checkboxChecked) {
scope = SitePermissions.SCOPE_PERSISTENT;
}
if (audioDevices.length) {
SitePermissions.setForPrincipal(
principal,
"screen",
"microphone",
SitePermissions.BLOCK,
SitePermissions.SCOPE_TEMPORARY,
scope,
notification.browser
);
},
},
{
label: never.label,
accessKey: never.accesskey,
callback(aState) {
aActor.denyRequest(aRequest);
}
if (videoDevices.length) {
SitePermissions.setForPrincipal(
principal,
"screen",
sharingScreen ? "screen" : "camera",
SitePermissions.BLOCK,
SitePermissions.SCOPE_PERSISTENT,
scope,
notification.browser
);
},
}
},
];
} else {
secondaryActions = [
{
label: stringBundle.getString("getUserMedia.dontAllow.label"),
accessKey: stringBundle.getString("getUserMedia.dontAllow.accesskey"),
callback(aState) {
aActor.denyRequest(aRequest);
let scope = SitePermissions.SCOPE_TEMPORARY;
if (aState && aState.checkboxChecked) {
scope = SitePermissions.SCOPE_PERSISTENT;
}
if (audioDevices.length) {
SitePermissions.setForPrincipal(
principal,
"microphone",
SitePermissions.BLOCK,
scope,
notification.browser
);
}
if (videoDevices.length) {
SitePermissions.setForPrincipal(
principal,
sharingScreen ? "screen" : "camera",
SitePermissions.BLOCK,
scope,
notification.browser
);
}
},
},
];
}
},
];
let productName = gBrandBundle.GetStringFromName("brandShortName");
@ -973,15 +893,7 @@ function prompt(aActor, aBrowser, aRequest) {
}
this.mainAction.callback = async function(aState) {
let remember = false;
let silenceNotifications = false;
if (notificationSilencingEnabled && sharingScreen) {
silenceNotifications = aState && aState.checkboxChecked;
} else {
remember = aState && aState.checkboxChecked;
}
let remember = aState && aState.checkboxChecked;
let allowedDevices = [];
let perms = Services.perms;
if (videoDevices.length) {
@ -1087,7 +999,6 @@ function prompt(aActor, aBrowser, aRequest) {
callID: aRequest.callID,
windowID: aRequest.windowID,
devices: allowedDevices,
suppressNotifications: silenceNotifications,
});
};
@ -1133,38 +1044,19 @@ function prompt(aActor, aBrowser, aRequest) {
"getUserMedia.reasonForNoPermanentAllow.insecure";
}
if (notificationSilencingEnabled && sharingScreen) {
let [
silenceNotifications,
silenceNotificationsWarning,
] = localization.formatMessagesSync([
{ id: "popup-silence-notifications-checkbox" },
{ id: "popup-silence-notifications-checkbox-warning" },
]);
options.checkbox = {
label: silenceNotifications.value,
checked: false,
checkedState: {
disableMainAction: false,
warningLabel: silenceNotificationsWarning.value,
},
};
} else {
options.checkbox = {
label: stringBundle.getString("getUserMedia.remember"),
checked: principal.isAddonOrExpandedAddonPrincipal,
checkedState: reasonForNoPermanentAllow
? {
disableMainAction: true,
warningLabel: stringBundle.getFormattedString(
reasonForNoPermanentAllow,
[productName]
),
}
: undefined,
};
}
options.checkbox = {
label: stringBundle.getString("getUserMedia.remember"),
checked: principal.isAddonOrExpandedAddonPrincipal,
checkedState: reasonForNoPermanentAllow
? {
disableMainAction: true,
warningLabel: stringBundle.getFormattedString(
reasonForNoPermanentAllow,
[productName]
),
}
: undefined,
};
}
let iconType = "Devices";

Просмотреть файл

@ -1649,10 +1649,6 @@ pref("privacy.userContext.extension", "");
// tab in the default container
pref("privacy.userContext.newTabContainerOnLeftClick.enabled", false);
// Set to true to allow the user to silence all notifications when
// sharing the screen.
pref("privacy.webrtc.allowSilencingNotifications", false);
// Start the browser in e10s mode
pref("browser.tabs.remote.autostart", true);
pref("browser.tabs.remote.desktopbehavior", true);

Просмотреть файл

@ -1,19 +0,0 @@
# 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/.
# Note: This is currently placed under browser/base/content so that we can
# get the strings to appear without having our localization community need
# to go through and translate everything. Once these strings are ready for
# translation, we'll move it to the locales folder.
popup-screen-sharing-not-now =
.label = Not Now
.accesskey = w
popup-screen-sharing-never =
.label = Never Allow
.accesskey = N
popup-silence-notifications-checkbox = Disable notifications from { -brand-short-name } while sharing
popup-silence-notifications-checkbox-warning = { -brand-short-name } will not display notifications while you are sharing.

Просмотреть файл

@ -10,7 +10,6 @@
[localization] @AB_CD@.jar:
preview/protections.ftl (../components/protections/content/protections.ftl)
preview/interventions.ftl (../components/urlbar/content/interventions.ftl)
preview/popup-notifications.ftl (../base/content/popup-notifications.ftl)
browser (%browser/**/*.ftl)
@AB_CD@.jar:

Просмотреть файл

@ -280,11 +280,8 @@ var webrtcUI = {
let sharedWindowRawDeviceIds = new Set();
this.sharingScreen = false;
let suppressNotifications = false;
for (let stream of this._streams) {
let { state } = stream;
suppressNotifications |= state.suppressNotifications;
for (let device of state.devices) {
if (!device.scary) {
continue;
@ -316,18 +313,6 @@ var webrtcUI = {
this.sharedWindows.add(win);
}
}
if (
Services.prefs.getBoolPref(
"privacy.webrtc.allowSilencingNotifications",
false
)
) {
let alertsService = Cc["@mozilla.org/alerts-service;1"]
.getService(Ci.nsIAlertsService)
.QueryInterface(Ci.nsIAlertsDoNotDisturb);
alertsService.suppressForScreenSharing = suppressNotifications;
}
},
/**

Просмотреть файл

@ -152,16 +152,6 @@ bool nsAlertsService::ShouldShowAlert() {
}
#endif
nsCOMPtr<nsIAlertsDoNotDisturb> alertsDND(GetDNDBackend());
if (alertsDND) {
bool suppressForScreenSharing = false;
nsresult rv =
alertsDND->GetSuppressForScreenSharing(&suppressForScreenSharing);
if (NS_SUCCEEDED(rv)) {
result &= !suppressForScreenSharing;
}
}
return result;
}
@ -296,26 +286,6 @@ NS_IMETHODIMP nsAlertsService::SetManualDoNotDisturb(bool aDoNotDisturb) {
#endif
}
NS_IMETHODIMP nsAlertsService::GetSuppressForScreenSharing(bool* aRetVal) {
#ifdef MOZ_WIDGET_ANDROID
return NS_ERROR_NOT_IMPLEMENTED;
#else
nsCOMPtr<nsIAlertsDoNotDisturb> alertsDND(GetDNDBackend());
NS_ENSURE_TRUE(alertsDND, NS_ERROR_NOT_IMPLEMENTED);
return alertsDND->GetSuppressForScreenSharing(aRetVal);
#endif
}
NS_IMETHODIMP nsAlertsService::SetSuppressForScreenSharing(bool aSuppress) {
#ifdef MOZ_WIDGET_ANDROID
return NS_ERROR_NOT_IMPLEMENTED;
#else
nsCOMPtr<nsIAlertsDoNotDisturb> alertsDND(GetDNDBackend());
NS_ENSURE_TRUE(alertsDND, NS_ERROR_NOT_IMPLEMENTED);
return alertsDND->SetSuppressForScreenSharing(aSuppress);
#endif
}
already_AddRefed<nsIAlertsDoNotDisturb> nsAlertsService::GetDNDBackend() {
nsCOMPtr<nsIAlertsService> backend;
// Try the system notification service.

Просмотреть файл

@ -228,13 +228,6 @@ interface nsIAlertsDoNotDisturb : nsISupports
* disrupting a user if we simply create a notification like usual.
*/
attribute bool manualDoNotDisturb;
/**
* Toggles a mode for the service to suppress all notifications from
* being dispatched when sharing the screen via the getMediaDisplay
* API.
*/
attribute bool suppressForScreenSharing;
};
[scriptable, uuid(fc6d7f0a-0cf6-4268-8c71-ab640842b9b1)]

Просмотреть файл

@ -377,19 +377,6 @@ nsXULAlerts::GetManualDoNotDisturb(bool* aRetVal) {
return NS_OK;
}
NS_IMETHODIMP
nsXULAlerts::GetSuppressForScreenSharing(bool* aRetVal) {
NS_ENSURE_ARG(aRetVal);
*aRetVal = mSuppressForScreenSharing;
return NS_OK;
}
NS_IMETHODIMP
nsXULAlerts::SetSuppressForScreenSharing(bool aSuppress) {
mSuppressForScreenSharing = aSuppress;
return NS_OK;
}
NS_IMETHODIMP
nsXULAlerts::CloseAlert(const nsAString& aAlertName, nsIPrincipal* aPrincipal) {
mozIDOMWindowProxy* alert = mNamedWindows.GetWeak(aAlertName);

Просмотреть файл

@ -46,9 +46,6 @@ class nsXULAlerts : public nsIAlertsService,
uint32_t mPersistentAlertCount = 0;
nsTArray<PendingAlert> mPendingPersistentAlerts;
bool mDoNotDisturb = false;
private:
bool mSuppressForScreenSharing = false;
};
/**

Просмотреть файл

@ -28,13 +28,11 @@ class OSXNotificationInfo;
class OSXNotificationCenter : public nsIAlertsService,
public nsIAlertsIconData,
public nsIAlertsDoNotDisturb,
public nsIAlertNotificationImageListener {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIALERTSSERVICE
NS_DECL_NSIALERTSICONDATA
NS_DECL_NSIALERTSDONOTDISTURB
NS_DECL_NSIALERTNOTIFICATIONIMAGELISTENER
OSXNotificationCenter();
@ -52,7 +50,6 @@ class OSXNotificationCenter : public nsIAlertsService,
mozNotificationCenterDelegate* mDelegate;
nsTArray<RefPtr<OSXNotificationInfo> > mActiveAlerts;
nsTArray<RefPtr<OSXNotificationInfo> > mPendingAlerts;
bool mSuppressForScreenSharing;
};
} // namespace mozilla

Просмотреть файл

@ -190,7 +190,6 @@ OSXNotificationCenter::OSXNotificationCenter() {
mDelegate = [[mozNotificationCenterDelegate alloc] initWithOSXNC:this];
GetNotificationCenter().delegate = mDelegate;
mSuppressForScreenSharing = false;
NS_OBJC_END_TRY_ABORT_BLOCK;
}
@ -204,7 +203,7 @@ OSXNotificationCenter::~OSXNotificationCenter() {
NS_OBJC_END_TRY_ABORT_BLOCK;
}
NS_IMPL_ISUPPORTS(OSXNotificationCenter, nsIAlertsService, nsIAlertsIconData, nsIAlertsDoNotDisturb,
NS_IMPL_ISUPPORTS(OSXNotificationCenter, nsIAlertsService, nsIAlertsIconData,
nsIAlertNotificationImageListener)
nsresult OSXNotificationCenter::Init() {
@ -251,10 +250,6 @@ OSXNotificationCenter::ShowAlertWithIconData(nsIAlertNotification* aAlert,
NS_ENSURE_ARG(aAlert);
if (mSuppressForScreenSharing) {
return NS_OK;
}
Class unClass = NSClassFromString(@"NSUserNotification");
id<FakeNSUserNotification> notification = [[unClass alloc] init];
@ -539,34 +534,4 @@ OSXNotificationCenter::OnImageReady(nsISupports* aUserData, imgIRequest* aReques
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
// nsIAlertsDoNotDisturb
NS_IMETHODIMP
OSXNotificationCenter::GetManualDoNotDisturb(bool* aRetVal) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHODIMP
OSXNotificationCenter::SetManualDoNotDisturb(bool aDoNotDisturb) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
OSXNotificationCenter::GetSuppressForScreenSharing(bool* aRetVal) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT
NS_ENSURE_ARG(aRetVal);
*aRetVal = mSuppressForScreenSharing;
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT
}
NS_IMETHODIMP
OSXNotificationCenter::SetSuppressForScreenSharing(bool aSuppress) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT
mSuppressForScreenSharing = aSuppress;
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT
}
} // namespace mozilla