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
......@@ -8,6 +8,7 @@ add_task(async function() {
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins", gTestBrowser);
resetBlocklist();
Services.prefs.clearUserPref("plugins.click_to_play");
gBrowser.removeCurrentTab();
window.focus();
gTestBrowser = null;
......@@ -15,6 +16,7 @@ add_task(async function() {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gTestBrowser = gBrowser.selectedBrowser;
Services.prefs.setBoolPref("plugins.click_to_play", true);
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
// Prime the blocklist service, the remote service doesn't launch on startup.
......
......@@ -4,6 +4,7 @@ var gTestBrowser = null;
add_task(async function() {
registerCleanupFunction(function() {
clearAllPluginPermissions();
Services.prefs.clearUserPref("plugins.click_to_play");
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
gBrowser.removeCurrentTab();
......@@ -13,6 +14,8 @@ add_task(async function() {
});
add_task(async function() {
Services.prefs.setBoolPref("plugins.click_to_play", true);
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gTestBrowser = gBrowser.selectedBrowser;
......
......@@ -5,6 +5,7 @@ var gNumPluginBindingsAttached = 0;
add_task(async function() {
registerCleanupFunction(function() {
clearAllPluginPermissions();
Services.prefs.clearUserPref("plugins.click_to_play");
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
gBrowser.removeCurrentTab();
......@@ -14,6 +15,8 @@ add_task(async function() {
});
add_task(async function() {
Services.prefs.setBoolPref("plugins.click_to_play", true);
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gTestBrowser = gBrowser.selectedBrowser;
......
......@@ -32,6 +32,7 @@ function stored(needles) {
add_task(async function() {
registerCleanupFunction(function() {
clearAllPluginPermissions();
Services.prefs.clearUserPref("plugins.click_to_play");
Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
......@@ -42,6 +43,8 @@ add_task(async function() {
gTestBrowser = null;
});
Services.prefs.setBoolPref("plugins.click_to_play", true);
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
});
......
......@@ -10,6 +10,7 @@ function updateAllTestPlugins(aState) {
add_task(async function() {
registerCleanupFunction(async function() {
clearAllPluginPermissions();
Services.prefs.clearUserPref("plugins.click_to_play");
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins", gTestBrowser);
......@@ -25,6 +26,7 @@ add_task(async function() {
gTestBrowser = gBrowser.selectedBrowser;
Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
Services.prefs.setBoolPref("plugins.click_to_play", true);
updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
......
......@@ -10,6 +10,7 @@ function updateAllTestPlugins(aState) {
add_task(async function() {
registerCleanupFunction(async function() {
clearAllPluginPermissions();
Services.prefs.clearUserPref("plugins.click_to_play");
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins", gTestBrowser);
......@@ -25,6 +26,7 @@ add_task(async function() {
gTestBrowser = gBrowser.selectedBrowser;
Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
Services.prefs.setBoolPref("plugins.click_to_play", true);
updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
......
......@@ -40,6 +40,7 @@ add_task(async function test() {
gTestBrowser = gBrowser.selectedBrowser;
let promise = BrowserTestUtils.browserLoaded(gTestBrowser);
Services.prefs.setBoolPref("plugins.click_to_play", true);
getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
await promise;
......
......@@ -2271,7 +2271,7 @@ BrowserGlue.prototype = {
_migrateUI: function BG__migrateUI() {
// Use an increasing number to keep track of the current migration state.
// Completely unrelated to the current Firefox release number.
const UI_VERSION = 84;
const UI_VERSION = 83;
const BROWSER_DOCURL = AppConstants.BROWSER_CHROME_URL;
let currentUIVersion;
......@@ -2581,20 +2581,6 @@ BrowserGlue.prototype = {
Services.prefs.clearUserPref("browser.search.reset.status");
}
if (currentUIVersion < 84) {
// Reset flash "always allow/block" permissions
// We keep session and policy permissions, which could both be
// the result of enterprise policy settings. "Never/Always allow"
// settings for flash were actually time-bound on recent-ish Firefoxen,
// so we remove EXPIRE_TIME entries, too.
const {EXPIRE_NEVER, EXPIRE_TIME} = Services.perms;
let flashPermissions =
Services.perms.getAllWithTypePrefix("plugin:flash").filter(p =>
p.type == "plugin:flash" &&
(p.expireType == EXPIRE_NEVER || p.expireType == EXPIRE_TIME));
flashPermissions.forEach(p => Services.perms.removePermission(p));
}
// Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},
......
......@@ -696,10 +696,13 @@ var Policies = {
const FLASH_NEVER_ACTIVATE = 0;
const FLASH_ASK_TO_ACTIVATE = 1;
const FLASH_ALWAYS_ACTIVATE = 2;
let flashPrefVal;
if (param.Default === undefined || param.Default) {
if (param.Default === undefined) {
flashPrefVal = FLASH_ASK_TO_ACTIVATE;
} else if (param.Default) {
flashPrefVal = FLASH_ALWAYS_ACTIVATE;
} else {
flashPrefVal = FLASH_NEVER_ACTIVATE;
}
......
......@@ -2,6 +2,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const labelTextAlwaysActivate = "Always Activate";
const labelTextAskToActivate = "Ask to Activate";
const labelTextNeverActivate = "Never Activate";
......@@ -28,9 +29,7 @@ async function assert_flash_locked_status(win, locked, expectedLabelText) {
// are expected to be disabled if locked is true.
for (const item of pluginOptions.querySelectorAll("panel-item")) {
const actionName = item.getAttribute("action");
if (actionName.includes("always")) {
ok(item.hidden, `Plugin action "${actionName}" should be hidden.`);
} else if (!item.hasAttribute("checked") && actionName !== "expand" &&
if (!item.hasAttribute("checked") && actionName !== "expand" &&
actionName !== "preferences") {
is(item.shadowRoot.querySelector("button").disabled, locked,
`Plugin action "${actionName}" should be ${locked ? "disabled" : "enabled"}`);
......@@ -72,7 +71,7 @@ add_task(async function test_enabled() {
});
const testCase = () => test_flash_status({
expectedLabelText: labelTextAskToActivate,
expectedLabelText: labelTextAlwaysActivate,
locked: false,
});
await testOnAboutAddonsType("XUL", testCase);
......@@ -92,7 +91,7 @@ add_task(async function test_enabled_locked() {
});
const testCase = () => test_flash_status({
expectedLabelText: labelTextAskToActivate,
expectedLabelText: labelTextAlwaysActivate,
locked: true,
});
await testOnAboutAddonsType("XUL", testCase);
......
......@@ -121,6 +121,10 @@ add_task(async function testPluginData() {
BrowserTestUtils.removeTab(tab);
}
Services.prefs.setBoolPref("plugins.click_to_play", true);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("plugins.click_to_play");
});
PLUGIN_TAG.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
await extension.startup();
......
......@@ -312,6 +312,7 @@ 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
......
......@@ -46,5 +46,6 @@ permission.shortcuts.label = Override Keyboard Shortcuts
permission.focus-tab-by-prompt.label = Switch to this Tab
permission.persistent-storage.label = Store Data in Persistent Storage
permission.canvas.label = Extract Canvas Data
permission.flash-plugin.label = Run Adobe Flash
permission.midi.label = Access MIDI Devices
permission.midi-sysex.label = Access MIDI Devices with SysEx Support
......@@ -238,11 +238,14 @@ const GloballyBlockedPermissions = {
*/
var SitePermissions = {
// Permission states.
// PROMPT_HIDE state is only used to show the "Hide Prompt" state in the identity panel
// for the "plugin:flash" permission and not in pageinfo.
UNKNOWN: Services.perms.UNKNOWN_ACTION,
ALLOW: Services.perms.ALLOW_ACTION,
BLOCK: Services.perms.DENY_ACTION,
PROMPT: Services.perms.PROMPT_ACTION,
ALLOW_COOKIES_FOR_SESSION: Ci.nsICookiePermission.ACCESS_SESSION,
PROMPT_HIDE: Ci.nsIObjectLoadingContent.PLUGIN_PERMISSION_PROMPT_ACTION_QUIET,
AUTOPLAY_BLOCKED_ALL: Ci.nsIAutoplay.BLOCKED_ALL,
// Permission scopes.
......@@ -822,6 +825,12 @@ var SitePermissions = {
* unknown state was passed.
*/
getCurrentStateLabel(state, id, scope = null) {
// We try to avoid a collision between SitePermissions.PROMPT_HIDE
// and SitePermissions.ALLOW_COOKIES_FOR_SESSION which share the same const value.
if (id.startsWith("plugin") && state == SitePermissions.PROMPT_HIDE) {
return gStringBundle.GetStringFromName("state.current.hide");
}
switch (state) {
case this.PROMPT:
return gStringBundle.GetStringFromName("state.current.prompt");
......@@ -864,6 +873,8 @@ var gPermissionObject = {
* - states
* Array of permission states to be exposed to the user.
* Defaults to ALLOW, BLOCK and the default state (see getDefault).
* The PROMPT_HIDE state is deliberately excluded from "plugin:flash" since we
* don't want to expose a "Hide Prompt" button to the user through pageinfo.
*/
"autoplay-media": {
......@@ -976,6 +987,11 @@ var gPermissionObject = {
"canvas": {
},
"plugin:flash": {
labelID: "flash-plugin",
states: [ SitePermissions.UNKNOWN, SitePermissions.ALLOW, SitePermissions.BLOCK ],
},
"midi": {
exactHostMatch: true,
},
......
......@@ -30,7 +30,7 @@ add_task(async function testNsIURI() {
add_task(async function testPermissionsListing() {
let expectedPermissions = ["autoplay-media", "camera", "cookie", "desktop-notification", "focus-tab-by-prompt",
"geo", "image", "install", "microphone", "popup", "screen", "shortcuts",
"geo", "image", "install", "microphone", "plugin:flash", "popup", "screen", "shortcuts",
"persistent-storage", "storage-access"];
if (RESIST_FINGERPRINTING_ENABLED) {
// Canvas permission should be hidden unless privacy.resistFingerprinting
......@@ -133,7 +133,7 @@ add_task(async function testExactHostMatch() {
exactHostMatched.push("midi");
exactHostMatched.push("midi-sysex");
}
let nonExactHostMatched = ["image", "cookie", "popup", "install", "shortcuts",
let nonExactHostMatched = ["image", "cookie", "plugin:flash", "popup", "install", "shortcuts",
"storage-access"];
let permissions = SitePermissions.listPermissions();
......
......@@ -291,6 +291,10 @@ html|*#webRTC-previewVideo {
transition: fill 1.5s;
}
.plugin-icon.blocked-permission-icon {
list-style-image: url(chrome://global/skin/plugins/plugin-blocked.svg);
}
#plugin-icon-badge {
list-style-image: url(chrome://browser/skin/notification-icons/plugin-badge.svg);
opacity: 0;
......
......@@ -58,8 +58,6 @@ interface nsIPluginTag : nsISupports
readonly attribute PRTime lastModifiedTime;
readonly attribute boolean isFlashPlugin;
Array<AUTF8String> getMimeTypes();
Array<AUTF8String> getMimeDescriptions();
Array<AUTF8String> getExtensions();
......
......@@ -442,12 +442,6 @@ nsPluginTag::GetDescription(nsACString& aDescription) {
return NS_OK;
}
NS_IMETHODIMP
nsPluginTag::GetIsFlashPlugin(bool* aIsFlash) {
*aIsFlash = mIsFlashPlugin;
return NS_OK;
}
NS_IMETHODIMP
nsPluginTag::GetFilename(nsACString& aFileName) {
aFileName = mFileName;
......@@ -522,9 +516,6 @@ nsPluginTag::GetEnabledState(uint32_t* aEnabledState) {
int32_t enabledState;
nsresult rv =
Preferences::GetInt(GetStatePrefNameForPlugin(this).get(), &enabledState);
if (enabledState == nsIPluginTag::STATE_ENABLED && mIsFlashPlugin) {
enabledState = nsIPluginTag::STATE_CLICKTOPLAY;
}
if (NS_SUCCEEDED(rv) && enabledState >= nsIPluginTag::STATE_DISABLED &&
enabledState <= nsIPluginTag::STATE_ENABLED) {
*aEnabledState = (uint32_t)enabledState;
......@@ -535,9 +526,6 @@ nsPluginTag::GetEnabledState(uint32_t* aEnabledState) {
mIsFromExtension ? kPrefDefaultEnabledStateXpi : kPrefDefaultEnabledState;
enabledState = Preferences::GetInt(pref, nsIPluginTag::STATE_ENABLED);
if (enabledState == nsIPluginTag::STATE_ENABLED && mIsFlashPlugin) {
enabledState = nsIPluginTag::STATE_CLICKTOPLAY;
}
if (enabledState >= nsIPluginTag::STATE_DISABLED &&
enabledState <= nsIPluginTag::STATE_ENABLED) {
*aEnabledState = (uint32_t)enabledState;
......@@ -550,9 +538,6 @@ nsPluginTag::GetEnabledState(uint32_t* aEnabledState) {
NS_IMETHODIMP
nsPluginTag::SetEnabledState(uint32_t aEnabledState) {
if (aEnabledState >= ePluginState_MaxValue) return NS_ERROR_ILLEGAL_VALUE;
if (aEnabledState == nsIPluginTag::STATE_ENABLED && mIsFlashPlugin) {
aEnabledState = nsIPluginTag::STATE_CLICKTOPLAY;
}
uint32_t oldState = nsIPluginTag::STATE_DISABLED;
GetEnabledState(&oldState);
if (oldState != aEnabledState) {
......@@ -771,12 +756,6 @@ nsFakePluginTag::GetDescription(/* utf-8 */ nsACString& aResult) {
return NS_OK;
}
NS_IMETHODIMP
nsFakePluginTag::GetIsFlashPlugin(bool* aIsFlash) {
*aIsFlash = false;
return NS_OK;
}
NS_IMETHODIMP
nsFakePluginTag::GetFilename(/* utf-8 */ nsACString& aResult) {
aResult = mFileName;
......
......@@ -7,6 +7,7 @@
<script type="application/javascript" src="plugin-utils.js"></script>
<script type="application/javascript">
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
Services.prefs.setBoolPref("plugins.click_to_play", true);
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_CLICKTOPLAY);
</script>
</head>
......@@ -73,6 +74,7 @@
ok(false, "plugin.getMouseUpEventCount() shouldn't throw");
}
Services.prefs.clearUserPref("plugins.click_to_play");
SimpleTest.finish();
}
......
......@@ -9,6 +9,7 @@
<body>
<script class="testbody" type="application/javascript">
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
Services.prefs.setBoolPref("plugins.click_to_play", true);
var pluginHost = Cc["@mozilla.org/plugin/host;1"]
.getService(Ci.nsIPluginHost);
......@@ -27,6 +28,8 @@
testPlugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
is(pluginHost.getStateForType("application/x-test"), Ci.nsIPluginTag.STATE_CLICKTOPLAY, "click-to-play should be on for Test Plug-in now");
Services.prefs.clearUserPref("plugins.click_to_play");
</script>
</body>
</html>
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