зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1519434 - remove 'always activate' and 'remember this decision' UI options, r=aswan,johannh
Differential Revision: https://phabricator.services.mozilla.com/D34215 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
7936fd6350
Коммит
d48b3702d3
|
@ -126,7 +126,11 @@ var gPluginHandler = {
|
|||
/**
|
||||
* Called from the plugin doorhanger to set the new permissions for a plugin
|
||||
* and activate plugins if necessary.
|
||||
* aNewState should be either "allownow" "allowalways" or "block"
|
||||
* aNewState should be one of:
|
||||
* - "allownow"
|
||||
* - "block"
|
||||
* - "continue"
|
||||
* - "continueblocking"
|
||||
*/
|
||||
_updatePluginPermission(aBrowser, aPluginInfo, aNewState) {
|
||||
let permission;
|
||||
|
@ -150,16 +154,6 @@ var gPluginHandler = {
|
|||
notification.options.extraAttr = "active";
|
||||
break;
|
||||
|
||||
case "allowalways":
|
||||
permission = Ci.nsIPermissionManager.ALLOW_ACTION;
|
||||
expireType = Ci.nsIPermissionManager.EXPIRE_TIME;
|
||||
expireTime = Date.now() +
|
||||
Services.prefs.getIntPref(this.PREF_PERSISTENT_DAYS) * 24 * 60 * 60 * 1000;
|
||||
histogram.add(1);
|
||||
aPluginInfo.fallbackType = Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE;
|
||||
notification.options.extraAttr = "active";
|
||||
break;
|
||||
|
||||
case "block":
|
||||
permission = Ci.nsIPermissionManager.PROMPT_ACTION;
|
||||
expireType = Ci.nsIPermissionManager.EXPIRE_NEVER;
|
||||
|
@ -180,15 +174,6 @@ var gPluginHandler = {
|
|||
notification.options.extraAttr = "inactive";
|
||||
break;
|
||||
|
||||
case "blockalways":
|
||||
permission = Ci.nsIObjectLoadingContent.PLUGIN_PERMISSION_PROMPT_ACTION_QUIET;
|
||||
expireType = Ci.nsIPermissionManager.EXPIRE_NEVER;
|
||||
expireTime = 0;
|
||||
histogram.add(3);
|
||||
aPluginInfo.fallbackType = Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY_QUIET;
|
||||
notification.options.extraAttr = "inactive";
|
||||
break;
|
||||
|
||||
// In case a plugin has already been allowed/disallowed in another tab, the
|
||||
// buttons matching the existing block state shouldn't change any permissions
|
||||
// but should run the plugin-enablement code below.
|
||||
|
@ -309,12 +294,10 @@ var gPluginHandler = {
|
|||
|
||||
let weakBrowser = Cu.getWeakReference(browser);
|
||||
let mainAction = {
|
||||
callback: ({checkboxChecked}) => {
|
||||
callback: () => {
|
||||
let browserRef = weakBrowser.get();
|
||||
if (browserRef) {
|
||||
if (checkboxChecked) {
|
||||
this._updatePluginPermission(browserRef, pluginInfo, "allowalways");
|
||||
} else if (pluginInfo.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) {
|
||||
if (pluginInfo.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) {
|
||||
this._updatePluginPermission(browserRef, pluginInfo, "continue");
|
||||
} else {
|
||||
this._updatePluginPermission(browserRef, pluginInfo, "allownow");
|
||||
|
@ -328,16 +311,11 @@ var gPluginHandler = {
|
|||
|
||||
let secondaryActions = null;
|
||||
if (!isWindowPrivate) {
|
||||
options.checkbox = {
|
||||
label: gNavigatorBundle.getString("flashActivate.remember"),
|
||||
};
|
||||
secondaryActions = [{
|
||||
callback: ({checkboxChecked}) => {
|
||||
callback: () => {
|
||||
let browserRef = weakBrowser.get();
|
||||
if (browserRef) {
|
||||
if (checkboxChecked) {
|
||||
this._updatePluginPermission(browserRef, pluginInfo, "blockalways");
|
||||
} else if (pluginInfo.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) {
|
||||
if (pluginInfo.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) {
|
||||
this._updatePluginPermission(browserRef, pluginInfo, "block");
|
||||
} else {
|
||||
this._updatePluginPermission(browserRef, pluginInfo, "continueblocking");
|
||||
|
|
|
@ -312,7 +312,6 @@ pluginInfo.unknownPlugin=Unknown
|
|||
# Flash activation doorhanger UI
|
||||
flashActivate.message=Do you want to allow Adobe Flash to run on this site? Only allow Adobe Flash on sites you trust.
|
||||
flashActivate.outdated.message=Do you want to allow an outdated version of Adobe Flash to run on this site? An outdated version can affect browser performance and security.
|
||||
flashActivate.remember=Remember this decision
|
||||
flashActivate.noAllow=Don’t Allow
|
||||
flashActivate.allow=Allow
|
||||
flashActivate.noAllow.accesskey=D
|
||||
|
|
|
@ -8522,7 +8522,7 @@
|
|||
"expires_in_version": "never",
|
||||
"kind": "enumerated",
|
||||
"n_values": 8,
|
||||
"description": "User actions taken in the plugin notification: 0: allownow 1: allowalways 2: block 3: blockalways",
|
||||
"description": "User actions taken in the plugin notification: 0: allownow 1: allowalways 2: block 3: blockalways; Note: 1 and 3 are unused from Firefox 69 onwards.",
|
||||
"bug_numbers": [902075, 1345894, 1398972],
|
||||
"alert_emails": ["flashvideo-2015@mozilla.com"]
|
||||
},
|
||||
|
|
|
@ -776,7 +776,9 @@ class PluginOptions extends AddonOptions {
|
|||
if (action in userDisabledStates) {
|
||||
let userDisabled = userDisabledStates[action];
|
||||
el.checked = addon.userDisabled === userDisabled;
|
||||
el.disabled = !(el.checked || hasPermission(addon, action));
|
||||
let resultProp = (action == "always-activate" && addon.isFlashPlugin) ?
|
||||
"hidden" : "disabled";
|
||||
el[resultProp] = !(el.checked || hasPermission(addon, action));
|
||||
} else {
|
||||
super.setElementState(el, card, addon);
|
||||
}
|
||||
|
|
|
@ -1115,7 +1115,8 @@
|
|||
this._enableBtn.disabled = true;
|
||||
this._disableBtn.disabled = true;
|
||||
this._askToActivateMenuitem.disabled = !this.hasPermission("ask_to_activate");
|
||||
this._alwaysActivateMenuitem.disabled = !this.hasPermission("enable");
|
||||
let alwaysActivateProp = this.mAddon.isFlashPlugin ? "hidden" : "disabled";
|
||||
this._alwaysActivateMenuitem[alwaysActivateProp] = !this.hasPermission("enable");
|
||||
this._neverActivateMenuitem.disabled = !this.hasPermission("disable");
|
||||
if (!this.mAddon.isActive) {
|
||||
this._stateMenulist.selectedItem = this._neverActivateMenuitem;
|
||||
|
@ -1128,6 +1129,9 @@
|
|||
["ask_to_activate", "enable", "disable"].some(perm => this.hasPermission(perm));
|
||||
this._stateMenulist.disabled = !hasActivatePermission;
|
||||
this._stateMenulist.hidden = false;
|
||||
this._askToActivateMenuitem.classList.add("no-auto-hide");
|
||||
this._alwaysActivateMenuitem.classList.add("no-auto-hide");
|
||||
this._neverActivateMenuitem.classList.add("no-auto-hide");
|
||||
this._stateMenulist.classList.add("no-auto-hide");
|
||||
} else {
|
||||
this._stateMenulist.hidden = true;
|
||||
|
|
|
@ -55,8 +55,7 @@ add_task(async function testAskToActivate() {
|
|||
let panelItems = card.querySelectorAll("panel-item:not([hidden])");
|
||||
let actions = Array.from(panelItems).map(item => item.getAttribute("action"));
|
||||
Assert.deepEqual(actions, [
|
||||
"ask-to-activate", "always-activate", "never-activate", "preferences",
|
||||
"expand",
|
||||
"ask-to-activate", "never-activate", "preferences", "expand",
|
||||
], "The panel items are for a plugin");
|
||||
|
||||
checkItems(panelItems, "ask-to-activate");
|
||||
|
@ -65,18 +64,9 @@ add_task(async function testAskToActivate() {
|
|||
"Flash is ask-to-activate");
|
||||
ok(flash.isActive, "Flash is active");
|
||||
|
||||
// Switch the plugin to always activate.
|
||||
let updated = BrowserTestUtils.waitForEvent(card, "update");
|
||||
panelItems[1].click();
|
||||
await updated;
|
||||
checkItems(panelItems, "always-activate");
|
||||
ok(flash.userDisabled != AddonManager.STATE_ASK_TO_ACTIVATE,
|
||||
"Flash isn't ask-to-activate");
|
||||
ok(flash.isActive, "Flash is still active");
|
||||
|
||||
// Switch to never activate.
|
||||
updated = BrowserTestUtils.waitForEvent(card, "update");
|
||||
panelItems[2].click();
|
||||
let updated = BrowserTestUtils.waitForEvent(card, "update");
|
||||
card.querySelector("panel-item[action*=never]").click();
|
||||
await updated;
|
||||
checkItems(panelItems, "never-activate");
|
||||
ok(flash.userDisabled, `Flash is not userDisabled... for some reason`);
|
||||
|
@ -84,7 +74,7 @@ add_task(async function testAskToActivate() {
|
|||
|
||||
// Switch it back to ask to activate.
|
||||
updated = BrowserTestUtils.waitForEvent(card, "update");
|
||||
panelItems[0].click();
|
||||
card.querySelector("panel-item[action*=ask]").click();
|
||||
await updated;
|
||||
checkItems(panelItems, "ask-to-activate");
|
||||
is(flash.userDisabled, AddonManager.STATE_ASK_TO_ACTIVATE,
|
||||
|
@ -96,28 +86,19 @@ add_task(async function testAskToActivate() {
|
|||
card.querySelector("[action=expand]").click();
|
||||
await loaded;
|
||||
|
||||
// Set the state to always activate.
|
||||
card = doc.querySelector("addon-card");
|
||||
panelItems = card.querySelectorAll("panel-item");
|
||||
checkItems(panelItems, "ask-to-activate");
|
||||
updated = BrowserTestUtils.waitForEvent(card, "update");
|
||||
panelItems[1].click();
|
||||
await updated;
|
||||
checkItems(panelItems, "always-activate");
|
||||
|
||||
await closeView(win);
|
||||
|
||||
assertAboutAddonsTelemetryEvents([
|
||||
["addonsManager", "view", "aboutAddons", "list", {type: "plugin"}],
|
||||
["addonsManager", "action", "aboutAddons", null,
|
||||
{type: "plugin", addonId, view: "list", action: "enable"}],
|
||||
["addonsManager", "action", "aboutAddons", null,
|
||||
{type: "plugin", addonId, view: "list", action: "disable"}],
|
||||
// Ask-to-activate doesn't trigger a telemetry event.
|
||||
["addonsManager", "view", "aboutAddons", "detail",
|
||||
{type: "plugin", addonId}],
|
||||
["addonsManager", "action", "aboutAddons", null,
|
||||
{type: "plugin", addonId, view: "detail", action: "enable"}],
|
||||
]);
|
||||
});
|
||||
|
||||
|
|
|
@ -1009,10 +1009,6 @@ button.warning {
|
|||
padding: 2px 4px;
|
||||
}
|
||||
|
||||
.no-auto-hide .addon-control {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
button.button-link {
|
||||
-moz-appearance: none;
|
||||
background: transparent;
|
||||
|
|
Загрузка…
Ссылка в новой задаче