Commit f66f9762 authored by Andreea Pavel's avatar Andreea Pavel
Browse files

Backed out 7 changesets (bug 1519434) for mochiest failures e.g...

Backed out 7 changesets (bug 1519434) for mochiest failures e.g test_bug1165981.html on a CLOSED TREE

Backed out changeset 1314623831ad (bug 1519434)
Backed out changeset 6dd4fa67e209 (bug 1519434)
Backed out changeset b241c580b293 (bug 1519434)
Backed out changeset b48dca2f487f (bug 1519434)
Backed out changeset 49c64ed2e67b (bug 1519434)
Backed out changeset dd009a001c6c (bug 1519434)
Backed out changeset 5b6ec4d2f0ab (bug 1519434)
parent 37b6282d
......@@ -3196,6 +3196,8 @@ pref("input_event_queue.default_duration_per_event", 1);
pref("input_event_queue.count_for_prediction", 9);
pref("plugins.load_appdir_plugins", false);
// If true, plugins will be click to play
pref("plugins.click_to_play", false);
// This only supports one hidden ctp plugin, edit nsPluginArray.cpp if adding a second
pref("plugins.navigator.hidden_ctp_plugin", "");
......
......@@ -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; Note: 1 and 3 are unused from Firefox 69 onwards.",
"description": "User actions taken in the plugin notification: 0: allownow 1: allowalways 2: block 3: blockalways",
"bug_numbers": [902075, 1345894, 1398972],
"alert_emails": ["flashvideo-2015@mozilla.com"]
},
......
......@@ -13,6 +13,7 @@ var classifierTester = {
NEVER_ACTIVATE_PREF_VALUE: 0,
ASK_TO_ACTIVATE_PREF_VALUE: 1,
ALWAYS_ACTIVATE_PREF_VALUE: 2,
ALLOW_CTA_PREF: "plugins.click_to_play",
dbUrls: [
{
......@@ -65,6 +66,7 @@ var classifierTester = {
flashBlockEnable);
Services.prefs.setIntPref(classifierTester.FLASH_PLUGIN_USER_SETTING_PREF,
flashSetting);
Services.prefs.setBoolPref(classifierTester.ALLOW_CTA_PREF, true);
},
unsetPrefs() {
......@@ -75,6 +77,7 @@ var classifierTester = {
Services.prefs.clearUserPref(classifierTester.URLCLASSIFIER_DISALLOW_COMPLETIONS_PREF);
Services.prefs.clearUserPref(classifierTester.FLASHBLOCK_ENABLE_PREF);
Services.prefs.clearUserPref(classifierTester.FLASH_PLUGIN_USER_SETTING_PREF);
Services.prefs.clearUserPref(classifierTester.ALLOW_CTA_PREF);
},
// The |domains| property describes the domains of the nested documents making
......@@ -305,11 +308,6 @@ var classifierTester = {
},
checkPluginInfo(pluginInfo, expectedClassification, flashSetting) {
// We've stopped allowing flash to be always activated, so check
// existing tests that attempt to do so get treated as using ask-to-activate.
if (flashSetting == classifierTester.ALWAYS_ACTIVATE_PREF_VALUE) {
flashSetting = classifierTester.ASK_TO_ACTIVATE_PREF_VALUE;
}
is(pluginInfo.flashClassification, expectedClassification,
"Page's classification should match expected");
......
......@@ -693,9 +693,7 @@ class PluginOptions extends AddonOptions {
if (action in userDisabledStates) {
let userDisabled = userDisabledStates[action];
el.checked = addon.userDisabled === userDisabled;
let resultProp = (action == "always-activate" && addon.isFlashPlugin) ?
"hidden" : "disabled";
el[resultProp] = !(el.checked || hasPermission(addon, action));
el.disabled = !(el.checked || hasPermission(addon, action));
} else {
super.setElementState(el, card, addon);
}
......
......@@ -1115,8 +1115,7 @@
this._enableBtn.disabled = true;
this._disableBtn.disabled = true;
this._askToActivateMenuitem.disabled = !this.hasPermission("ask_to_activate");
let alwaysActivateProp = this.mAddon.isFlashPlugin ? "hidden" : "disabled";
this._alwaysActivateMenuitem[alwaysActivateProp] = !this.hasPermission("enable");
this._alwaysActivateMenuitem.disabled = !this.hasPermission("enable");
this._neverActivateMenuitem.disabled = !this.hasPermission("disable");
if (!this.mAddon.isActive) {
this._stateMenulist.selectedItem = this._neverActivateMenuitem;
......@@ -1129,9 +1128,6 @@
["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;
......
......@@ -17,6 +17,7 @@ ChromeUtils.defineModuleGetter(this, "Blocklist",
const URI_EXTENSION_STRINGS = "chrome://mozapps/locale/extensions/extensions.properties";
const LIST_UPDATED_TOPIC = "plugins-list-updated";
const FLASH_MIME_TYPE = "application/x-shockwave-flash";
const {Log} = ChromeUtils.import("resource://gre/modules/Log.jsm");
const LOGGER_ID = "addons.plugins";
......@@ -232,9 +233,17 @@ var PluginProvider = {
},
};
function isFlashPlugin(aPlugin) {
for (let type of aPlugin.pluginMimeTypes) {
if (type.type == FLASH_MIME_TYPE) {
return true;
}
}
return false;
}
// Protected mode is win32-only, not win64
function canDisableFlashProtectedMode(aPlugin) {
return aPlugin.isFlashPlugin && Services.appinfo.XPCOMABI == "x86-msvc";
return isFlashPlugin(aPlugin) && Services.appinfo.XPCOMABI == "x86-msvc";
}
const wrapperMap = new WeakMap();
......@@ -296,21 +305,16 @@ PluginWrapper.prototype = {
if (tag.disabled)
return true;
if (tag.clicktoplay ||
if ((Services.prefs.getBoolPref("plugins.click_to_play") && tag.clicktoplay) ||
this.blocklistState == Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE ||
this.blocklistState == Ci.nsIBlocklistService.STATE_VULNERABLE_NO_UPDATE) {
this.blocklistState == Ci.nsIBlocklistService.STATE_VULNERABLE_NO_UPDATE)
return AddonManager.STATE_ASK_TO_ACTIVATE;
}
return false;
},
set userDisabled(val) {
let previousVal = this.userDisabled;
if (val === false && this.isFlashPlugin) {
val = AddonManager.STATE_ASK_TO_ACTIVATE;
}
if (val === previousVal)
return val;
......@@ -453,15 +457,18 @@ PluginWrapper.prototype = {
if (this.userDisabled !== true)
permissions |= AddonManager.PERM_CAN_DISABLE;
if (this.userDisabled !== AddonManager.STATE_ASK_TO_ACTIVATE) {
permissions |= AddonManager.PERM_CAN_ASK_TO_ACTIVATE;
}
let blocklistState = this.blocklistState;
let isCTPBlocklisted =
(blocklistState == Ci.nsIBlocklistService.STATE_VULNERABLE_NO_UPDATE ||
blocklistState == Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE);
if (this.userDisabled !== false && !isCTPBlocklisted && !this.isFlashPlugin) {
if (this.userDisabled !== AddonManager.STATE_ASK_TO_ACTIVATE &&
(Services.prefs.getBoolPref("plugins.click_to_play") ||
isCTPBlocklisted)) {
permissions |= AddonManager.PERM_CAN_ASK_TO_ACTIVATE;
}
if (this.userDisabled !== false && !isCTPBlocklisted) {
permissions |= AddonManager.PERM_CAN_ENABLE;
}
}
......@@ -512,10 +519,6 @@ PluginWrapper.prototype = {
if ("onUpdateFinished" in aListener)
aListener.onUpdateFinished(this);
},
get isFlashPlugin() {
return pluginFor(this).tags.some(t => t.isFlashPlugin);
},
};
AddonManagerPrivate.registerProvider(PluginProvider, [
......
......@@ -146,6 +146,9 @@ async function getTestPluginAddon() {
}
async function test_CTP_plugins(aboutAddonsType) {
await SpecialPowers.pushPrefEnv({"set": [
["plugins.click_to_play", true],
]});
let pluginTag = getTestPluginTag();
pluginTag.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
let managerWindow = await open_manager("addons://list/plugin");
......
......@@ -55,7 +55,8 @@ 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", "never-activate", "preferences", "expand",
"ask-to-activate", "always-activate", "never-activate", "preferences",
"expand",
], "The panel items are for a plugin");
checkItems(panelItems, "ask-to-activate");
......@@ -64,9 +65,18 @@ add_task(async function testAskToActivate() {
"Flash is ask-to-activate");
ok(flash.isActive, "Flash is active");
// Switch to never activate.
// Switch the plugin to always activate.
let updated = BrowserTestUtils.waitForEvent(card, "update");
card.querySelector("panel-item[action*=never]").click();
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();
await updated;
checkItems(panelItems, "never-activate");
ok(flash.userDisabled, `Flash is not userDisabled... for some reason`);
......@@ -74,7 +84,7 @@ add_task(async function testAskToActivate() {
// Switch it back to ask to activate.
updated = BrowserTestUtils.waitForEvent(card, "update");
card.querySelector("panel-item[action*=ask]").click();
panelItems[0].click();
await updated;
checkItems(panelItems, "ask-to-activate");
is(flash.userDisabled, AddonManager.STATE_ASK_TO_ACTIVATE,
......@@ -86,19 +96,28 @@ 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"}],
]);
});
......
......@@ -208,8 +208,9 @@ add_task(async function test_disable_blocklist() {
Assert.notEqual(blocklistState, Ci.nsIBlocklistService.STATE_VULNERABLE_NO_UPDATE);
Assert.notEqual(blocklistState, Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE);
// it should still be possible to make a plugin click-to-play
// by setting that plugin's enabled state to click-to-play
// it should still be possible to make a plugin click-to-play via the pref
// and setting that plugin's enabled state to click-to-play
Services.prefs.setBoolPref("plugins.click_to_play", true);
let previousEnabledState = plugin.enabledState;
plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
Assert.equal(gPluginHost.getStateForType("application/x-test"), Ci.nsIPluginTag.STATE_CLICKTOPLAY);
......
......@@ -23,6 +23,7 @@ function setTestPluginState(state) {
async function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
Services.prefs.setBoolPref("plugins.click_to_play", true);
Services.prefs.setBoolPref("plugin.load_flash_only", false);
setTestPluginState(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
......@@ -103,7 +104,7 @@ async function run_test_1() {
Assert.ok(p.isCompatible);
Assert.ok(p.providesUpdatesSecurely);
Assert.equal(p.blocklistState, 0);
Assert.equal(p.permissions, AddonManager.PERM_CAN_DISABLE);
Assert.equal(p.permissions, AddonManager.PERM_CAN_DISABLE | AddonManager.PERM_CAN_ENABLE);
Assert.equal(p.pendingOperations, 0);
Assert.ok(p.updateDate > 0);
Assert.ok("isCompatibleWith" in p);
......@@ -132,7 +133,6 @@ async function run_test_2(p) {
() => p.disable());
Assert.ok(p.userDisabled);
Assert.equal(p.permissions, AddonManager.PERM_CAN_ASK_TO_ACTIVATE);
Assert.ok(!p.appDisabled);
Assert.ok(!p.isActive);
......@@ -159,13 +159,13 @@ async function run_test_3(p) {
},
() => p.enable());
Assert.equal(p.userDisabled, "askToActivate");
Assert.ok(!p.userDisabled);
Assert.ok(!p.appDisabled);
Assert.ok(p.isActive);
let p2 = await AddonManager.getAddonByID(gID);
Assert.notEqual(p2, null);
Assert.equal(p2.userDisabled, "askToActivate");
Assert.ok(!p2.userDisabled);
Assert.ok(!p2.appDisabled);
Assert.ok(p2.isActive);
Assert.equal(p2.name, "Shockwave Flash");
......@@ -181,5 +181,7 @@ async function run_test_4() {
Assert.notEqual(p, null);
Assert.equal(p.name, "Shockwave Flash");
Services.prefs.clearUserPref("plugins.click_to_play");
executeSoon(do_test_finished);
}
......@@ -75,6 +75,7 @@ add_task(async function setup() {
registerCleanupFunction(function() {
Services.prefs.clearUserPref("extensions.blocklist.url");
Services.prefs.clearUserPref("extensions.blocklist.enabled");
Services.prefs.clearUserPref("plugins.click_to_play");
});
});
......@@ -151,8 +152,9 @@ add_task(async function test_disable_blocklist() {
Assert.notEqual(blocklistState, Ci.nsIBlocklistService.STATE_VULNERABLE_NO_UPDATE);
Assert.notEqual(blocklistState, Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE);
// it should still be possible to make a plugin click-to-play
// by setting that plugin's enabled state to click-to-play
// it should still be possible to make a plugin click-to-play via the pref
// and setting that plugin's enabled state to click-to-play
Services.prefs.setBoolPref("plugins.click_to_play", true);
let previousEnabledState = plugin.enabledState;
plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
Assert.equal(gPluginHost.getStateForType("application/x-test"), Ci.nsIPluginTag.STATE_CLICKTOPLAY);
......
......@@ -1004,6 +1004,10 @@ button.warning {
padding: 2px 4px;
}
.no-auto-hide .addon-control {
display: block !important;
}
button.button-link {
-moz-appearance: none;
background: transparent;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment