Bug 1558898 - show a 'block' option for plugins in private browsing, r=johannh

Differential Revision: https://phabricator.services.mozilla.com/D34899

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gijs Kruitbosch 2019-06-22 22:36:17 +00:00
parent 16d0e92412
commit daf8e7418a
2 changed files with 17 additions and 23 deletions

View File

@ -156,7 +156,7 @@ var gPluginHandler = {
case "block":
permission = Ci.nsIPermissionManager.PROMPT_ACTION;
expireType = Ci.nsIPermissionManager.EXPIRE_NEVER;
expireType = Ci.nsIPermissionManager.EXPIRE_SESSION;
expireTime = 0;
histogram.add(2);
switch (aPluginInfo.blocklistState) {
@ -259,8 +259,6 @@ var gPluginHandler = {
if (plugins.length == 1) {
let pluginInfo = plugins[0];
let isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(window);
let active = pluginInfo.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE;
let options = {
@ -308,25 +306,21 @@ var gPluginHandler = {
accessKey: gNavigatorBundle.getString("flashActivate.allow.accesskey"),
dismiss: true,
};
let secondaryActions = null;
if (!isWindowPrivate) {
secondaryActions = [{
callback: () => {
let browserRef = weakBrowser.get();
if (browserRef) {
if (pluginInfo.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) {
this._updatePluginPermission(browserRef, pluginInfo, "block");
} else {
this._updatePluginPermission(browserRef, pluginInfo, "continueblocking");
}
let secondaryActions = [{
callback: () => {
let browserRef = weakBrowser.get();
if (browserRef) {
if (pluginInfo.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) {
this._updatePluginPermission(browserRef, pluginInfo, "block");
} else {
this._updatePluginPermission(browserRef, pluginInfo, "continueblocking");
}
},
label: gNavigatorBundle.getString("flashActivate.noAllow"),
accessKey: gNavigatorBundle.getString("flashActivate.noAllow.accesskey"),
dismiss: true,
}];
}
}
},
label: gNavigatorBundle.getString("flashActivate.noAllow"),
accessKey: gNavigatorBundle.getString("flashActivate.noAllow.accesskey"),
dismiss: true,
}];
PopupNotifications.show(browser, "click-to-play-plugins",
description, "plugins-notification-icon",

View File

@ -125,8 +125,8 @@ add_task(async function test2c() {
"Shown");
popupNotification.reshow();
await promiseShown;
is(gPrivateWindow.PopupNotifications.panel.firstElementChild.secondaryButton.hidden, true,
"Test 2c, Activated plugin in a private window should not have visible 'Block' button.");
is(gPrivateWindow.PopupNotifications.panel.firstElementChild.secondaryButton.hidden, false,
"Test 2c, Activated plugin in a private window should have visible 'Block' button.");
is(gPrivateWindow.PopupNotifications.panel.firstElementChild.checkbox.hidden, true,
"Test 2c, Activated plugin in a private window should not have visible 'Remember' checkbox.");