Bug 886423 - Turn on the click-to-play UI by default in Firefox desktop. As a side effect, remove the plugin permission from about:permissions because we're using per-plugin permission not per-site and about:permissions doesn't know about that. (page info knows about it) r=keeler

This commit is contained in:
Benjamin Smedberg 2013-06-25 11:57:30 -04:00
parent ddcec6be65
commit dc3478faea
5 changed files with 6 additions and 48 deletions

View File

@ -632,7 +632,7 @@ pref("plugins.hide_infobar_for_outdated_plugin", false);
pref("plugins.update.url", "https://www.mozilla.org/%LOCALE%/plugincheck/"); pref("plugins.update.url", "https://www.mozilla.org/%LOCALE%/plugincheck/");
pref("plugins.update.notifyUser", false); pref("plugins.update.notifyUser", false);
pref("plugins.click_to_play", false); pref("plugins.click_to_play", true);
// display door hanger if flash not installed // display door hanger if flash not installed
pref("plugins.notifyMissingFlash", true); pref("plugins.notifyMissingFlash", true);

View File

@ -321,17 +321,6 @@ let PermissionDefaults = {
Services.prefs.setBoolPref("dom.disable_open_during_load", value); Services.prefs.setBoolPref("dom.disable_open_during_load", value);
}, },
get plugins() {
if (Services.prefs.getBoolPref("plugins.click_to_play")) {
return this.UNKNOWN;
}
return this.ALLOW;
},
set plugins(aValue) {
let value = (aValue != this.ALLOW);
Services.prefs.setBoolPref("plugins.click_to_play", value);
},
get fullscreen() { get fullscreen() {
if (!Services.prefs.getBoolPref("full-screen-api.enabled")) { if (!Services.prefs.getBoolPref("full-screen-api.enabled")) {
return this.DENY; return this.DENY;
@ -380,7 +369,7 @@ let AboutPermissions = {
* *
* Potential future additions: "sts/use", "sts/subd" * Potential future additions: "sts/use", "sts/subd"
*/ */
_supportedPermissions: ["password", "cookie", "geo", "indexedDB", "popup", "plugins", "fullscreen"], _supportedPermissions: ["password", "cookie", "geo", "indexedDB", "popup", "fullscreen"],
/** /**
* Permissions that don't have a global "Allow" option. * Permissions that don't have a global "Allow" option.
@ -390,7 +379,7 @@ let AboutPermissions = {
/** /**
* Permissions that don't have a global "Deny" option. * Permissions that don't have a global "Deny" option.
*/ */
_noGlobalDeny: ["plugins"], _noGlobalDeny: [],
_stringBundle: Services.strings. _stringBundle: Services.strings.
createBundle("chrome://browser/locale/preferences/aboutPermissions.properties"), createBundle("chrome://browser/locale/preferences/aboutPermissions.properties"),
@ -412,7 +401,6 @@ let AboutPermissions = {
Services.prefs.addObserver("geo.enabled", this, false); Services.prefs.addObserver("geo.enabled", this, false);
Services.prefs.addObserver("dom.indexedDB.enabled", this, false); Services.prefs.addObserver("dom.indexedDB.enabled", this, false);
Services.prefs.addObserver("dom.disable_open_during_load", this, false); Services.prefs.addObserver("dom.disable_open_during_load", this, false);
Services.prefs.addObserver("plugins.click_to_play", this, false);
Services.prefs.addObserver("full-screen-api.enabled", this, false); Services.prefs.addObserver("full-screen-api.enabled", this, false);
Services.obs.addObserver(this, "perm-changed", false); Services.obs.addObserver(this, "perm-changed", false);
@ -434,7 +422,6 @@ let AboutPermissions = {
Services.prefs.removeObserver("geo.enabled", this, false); Services.prefs.removeObserver("geo.enabled", this, false);
Services.prefs.removeObserver("dom.indexedDB.enabled", this, false); Services.prefs.removeObserver("dom.indexedDB.enabled", this, false);
Services.prefs.removeObserver("dom.disable_open_during_load", this, false); Services.prefs.removeObserver("dom.disable_open_during_load", this, false);
Services.prefs.removeObserver("plugins.click_to_play", this, false);
Services.prefs.removeObserver("full-screen-api.enabled", this, false); Services.prefs.removeObserver("full-screen-api.enabled", this, false);
Services.obs.removeObserver(this, "perm-changed"); Services.obs.removeObserver(this, "perm-changed");
@ -758,18 +745,11 @@ let AboutPermissions = {
if (!this._selectedSite) { if (!this._selectedSite) {
// If there is no selected site, we are updating the default permissions interface. // If there is no selected site, we are updating the default permissions interface.
permissionValue = PermissionDefaults[aType]; permissionValue = PermissionDefaults[aType];
if (aType == "plugins") if (aType == "cookie")
document.getElementById("plugins-pref-item").hidden = false;
else if (aType == "cookie")
// cookie-9 corresponds to ALLOW_FIRST_PARTY_ONLY, which is reserved // cookie-9 corresponds to ALLOW_FIRST_PARTY_ONLY, which is reserved
// for site-specific preferences only. // for site-specific preferences only.
document.getElementById("cookie-9").hidden = true; document.getElementById("cookie-9").hidden = true;
} else { } else {
if (aType == "plugins") {
document.getElementById("plugins-pref-item").hidden =
!Services.prefs.getBoolPref("plugins.click_to_play");
return;
}
if (aType == "cookie") if (aType == "cookie")
document.getElementById("cookie-9").hidden = false; document.getElementById("cookie-9").hidden = false;
let result = {}; let result = {};

View File

@ -191,27 +191,6 @@
</vbox> </vbox>
</hbox> </hbox>
<!-- Opt-in activation of Plug-ins -->
<hbox id="plugins-pref-item"
class="pref-item" align="top">
<image class="pref-icon" type="plugins"/>
<vbox>
<label class="pref-title" value="&plugins.label;"/>
<hbox>
<menulist id="plugins-menulist"
class="pref-menulist"
type="plugins"
oncommand="AboutPermissions.onPermissionCommand(event);">
<menupopup>
<menuitem id="plugins-0" value="0" label="&permission.alwaysAsk;"/>
<menuitem id="plugins-1" value="1" label="&permission.allow;"/>
<menuitem id="plugins-2" value="2" label="&permission.block;"/>
</menupopup>
</menulist>
</hbox>
</vbox>
</hbox>
<!-- Fullscreen --> <!-- Fullscreen -->
<hbox id="fullscreen-pref-item" <hbox id="fullscreen-pref-item"
class="pref-item" align="top"> class="pref-item" align="top">

View File

@ -26,7 +26,6 @@ const TEST_PERMS = {
"geo": PERM_UNKNOWN, "geo": PERM_UNKNOWN,
"indexedDB": PERM_UNKNOWN, "indexedDB": PERM_UNKNOWN,
"popup": PERM_DENY, "popup": PERM_DENY,
"plugins" : PERM_ALLOW,
"fullscreen" : PERM_UNKNOWN, "fullscreen" : PERM_UNKNOWN,
}; };
@ -37,7 +36,7 @@ const NO_GLOBAL_ALLOW = [
]; ];
// number of managed permissions in the interface // number of managed permissions in the interface
const TEST_PERMS_COUNT = 7; const TEST_PERMS_COUNT = 6;
function test() { function test() {
waitForExplicitFinish(); waitForExplicitFinish();

View File

@ -91,7 +91,7 @@ function run_test_1() {
do_check_true(p.isCompatible); do_check_true(p.isCompatible);
do_check_true(p.providesUpdatesSecurely); do_check_true(p.providesUpdatesSecurely);
do_check_eq(p.blocklistState, 0); do_check_eq(p.blocklistState, 0);
do_check_eq(p.permissions, AddonManager.PERM_CAN_DISABLE); do_check_eq(p.permissions, AddonManager.PERM_CAN_DISABLE | AddonManager.PERM_CAN_ASK_TO_ACTIVATE);
do_check_eq(p.pendingOperations, 0); do_check_eq(p.pendingOperations, 0);
do_check_true(p.size > 0); do_check_true(p.size > 0);
do_check_eq(p.size, getFileSize(testPlugin)); do_check_eq(p.size, getFileSize(testPlugin));