mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset adaf86c7288e (bug 1034679)
This commit is contained in:
parent
c94f6f6c8d
commit
38cd72b7cc
@ -3106,13 +3106,13 @@ var gDetailView = {
|
||||
|
||||
let menulist = document.getElementById("detail-state-menulist");
|
||||
let addonType = AddonManager.addonTypes[this._addon.type];
|
||||
if (addonType.flags & AddonManager.TYPE_SUPPORTS_ASK_TO_ACTIVATE) {
|
||||
if (addonType.flags & AddonManager.TYPE_SUPPORTS_ASK_TO_ACTIVATE &&
|
||||
(hasPermission(this._addon, "ask_to_activate") ||
|
||||
hasPermission(this._addon, "enable") ||
|
||||
hasPermission(this._addon, "disable"))) {
|
||||
let askItem = document.getElementById("detail-ask-to-activate-menuitem");
|
||||
let alwaysItem = document.getElementById("detail-always-activate-menuitem");
|
||||
let neverItem = document.getElementById("detail-never-activate-menuitem");
|
||||
let hasActivatePermission =
|
||||
["ask_to_activate", "enable", "disable"].some(perm => hasPermission(this._addon, perm));
|
||||
|
||||
if (this._addon.userDisabled === true) {
|
||||
menulist.selectedItem = neverItem;
|
||||
} else if (this._addon.userDisabled == AddonManager.STATE_ASK_TO_ACTIVATE) {
|
||||
@ -3120,10 +3120,7 @@ var gDetailView = {
|
||||
} else {
|
||||
menulist.selectedItem = alwaysItem;
|
||||
}
|
||||
|
||||
menulist.disabled = !hasActivatePermission;
|
||||
menulist.hidden = false;
|
||||
menulist.classList.add('no-auto-hide');
|
||||
} else {
|
||||
menulist.hidden = true;
|
||||
}
|
||||
|
@ -1306,7 +1306,10 @@
|
||||
this.mAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_INFO;
|
||||
|
||||
let addonType = AddonManager.addonTypes[this.mAddon.type];
|
||||
if (addonType.flags & AddonManager.TYPE_SUPPORTS_ASK_TO_ACTIVATE) {
|
||||
if (addonType.flags & AddonManager.TYPE_SUPPORTS_ASK_TO_ACTIVATE &&
|
||||
(this.hasPermission("ask_to_activate") ||
|
||||
this.hasPermission("enable") ||
|
||||
this.hasPermission("disable"))) {
|
||||
this._enableBtn.disabled = true;
|
||||
this._disableBtn.disabled = true;
|
||||
this._askToActivateMenuitem.disabled = !this.hasPermission("ask_to_activate");
|
||||
@ -1319,13 +1322,10 @@
|
||||
} else {
|
||||
this._stateMenulist.selectedItem = this._alwaysActivateMenuitem;
|
||||
}
|
||||
let hasActivatePermission =
|
||||
["ask_to_activate", "enable", "disable"].some(perm => this.hasPermission(perm));
|
||||
this._stateMenulist.disabled = !hasActivatePermission;
|
||||
this._stateMenulist.hidden = false;
|
||||
this._stateMenulist.classList.add('no-auto-hide');
|
||||
this._stateMenulist.selectedItem.disabled = false;
|
||||
this._stateMenulist.disabled = false;
|
||||
} else {
|
||||
this._stateMenulist.hidden = true;
|
||||
this._stateMenulist.disabled = true;
|
||||
if (this.hasPermission("enable")) {
|
||||
this._enableBtn.hidden = false;
|
||||
let tooltip = gViewController.commands["cmd_enableItem"]
|
||||
|
@ -461,9 +461,6 @@ function PluginWrapper(aId, aName, aDescription, aTags) {
|
||||
|
||||
this.__defineGetter__("permissions", function() {
|
||||
let permissions = 0;
|
||||
if (aTags[0].isEnabledStateLocked) {
|
||||
return permissions;
|
||||
}
|
||||
if (!this.appDisabled) {
|
||||
|
||||
if (this.userDisabled !== true)
|
||||
|
@ -44,7 +44,6 @@ skip-if = buildapp == 'mulet'
|
||||
[browser_searching.js]
|
||||
[browser_sorting.js]
|
||||
[browser_sorting_plugins.js]
|
||||
[browser_plugin_enabled_state_locked.js]
|
||||
skip-if = e10s # Bug ?????? - leaked until shutdown [nsGlobalWindow #1760 about:blank]
|
||||
[browser_uninstalling.js]
|
||||
skip-if = e10s # Bug ?????? - leaked until shutdown [nsGlobalWindow #1760 about:blank]
|
||||
|
@ -200,7 +200,7 @@ function part12(aWindow) {
|
||||
let pluginEl = get_addon_element(gManagerWindow, gTestPluginId);
|
||||
pluginEl.parentNode.ensureElementIsVisible(pluginEl);
|
||||
let menu = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "state-menulist");
|
||||
is(menu.disabled, true, "part12: state menu should be disabled");
|
||||
is_element_hidden(menu, "part12: state menu should be hidden");
|
||||
|
||||
let details = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "details-btn");
|
||||
EventUtils.synthesizeMouseAtCenter(details, {}, gManagerWindow);
|
||||
@ -209,7 +209,7 @@ function part12(aWindow) {
|
||||
|
||||
function part13() {
|
||||
let menu = gManagerWindow.document.getElementById("detail-state-menulist");
|
||||
is(menu.disabled, true, "part13: detail state menu should be disabled");
|
||||
is_element_hidden(menu, "part13: detail state menu should be hidden");
|
||||
|
||||
setAndUpdateBlocklist(gHttpTestRoot + "blockNoPlugins.xml", function() {
|
||||
run_next_test();
|
||||
|
@ -1,121 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests that state menu is displayed correctly (enabled or disabled) in the add-on manager
|
||||
// when the preference is unlocked / locked
|
||||
const {classes: Cc, interfaces: Ci} = Components;
|
||||
const gIsWindows = ("@mozilla.org/windows-registry-key;1" in Cc);
|
||||
const gIsOSX = ("nsILocalFileMac" in Ci);
|
||||
const gIsLinux = ("@mozilla.org/gnome-gconf-service;1" in Cc) ||
|
||||
("@mozilla.org/gio-service;1" in Cc);
|
||||
|
||||
let gManagerWindow;
|
||||
let gCategoryUtilities;
|
||||
let gPluginElement;
|
||||
|
||||
function getTestPluginPref() {
|
||||
let prefix = "plugin.state.";
|
||||
if (gIsWindows)
|
||||
return prefix + "nptest";
|
||||
else if (gIsLinux)
|
||||
return prefix + "libnptest";
|
||||
else
|
||||
return prefix + "test";
|
||||
}
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
Services.prefs.unlockPref(getTestPluginPref());
|
||||
Services.prefs.clearUserPref(getTestPluginPref());
|
||||
});
|
||||
|
||||
function getPlugins() {
|
||||
let deferred = Promise.defer();
|
||||
AddonManager.getAddonsByTypes(["plugin"], plugins => deferred.resolve(plugins));
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function getTestPlugin(aPlugins) {
|
||||
let testPluginId;
|
||||
|
||||
for (let plugin of aPlugins) {
|
||||
if (plugin.name == "Test Plug-in") {
|
||||
testPluginId = plugin.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Assert.ok(testPluginId, "Test Plug-in should exist");
|
||||
|
||||
let pluginElement = get_addon_element(gManagerWindow, testPluginId);
|
||||
pluginElement.parentNode.ensureElementIsVisible(pluginElement);
|
||||
|
||||
return pluginElement;
|
||||
}
|
||||
|
||||
function checkStateMenu(locked) {
|
||||
Assert.equal(Services.prefs.prefIsLocked(getTestPluginPref()), locked,
|
||||
"Preference lock state should be correct.");
|
||||
let menuList = gManagerWindow.document.getAnonymousElementByAttribute(gPluginElement, "anonid", "state-menulist");
|
||||
|
||||
is_element_visible(menuList, "State menu should be visible.");
|
||||
Assert.equal(menuList.disabled, locked,
|
||||
"State menu should" + (locked === true ? "" : " not") + " be disabled.");
|
||||
}
|
||||
|
||||
function checkStateMenuDetail(locked) {
|
||||
Assert.equal(Services.prefs.prefIsLocked(getTestPluginPref()), locked,
|
||||
"Preference should be " + (locked === true ? "" : "un") + "locked.");
|
||||
|
||||
// open details menu
|
||||
let details = gManagerWindow.document.getAnonymousElementByAttribute(gPluginElement, "anonid", "details-btn");
|
||||
is_element_visible(details, "Details link should be visible.");
|
||||
EventUtils.synthesizeMouseAtCenter(details, {}, gManagerWindow);
|
||||
|
||||
let deferred = Promise.defer();
|
||||
wait_for_view_load(gManagerWindow, function() {
|
||||
let menuList = gManagerWindow.document.getElementById("detail-state-menulist");
|
||||
is_element_visible(menuList, "Details state menu should be visible.");
|
||||
Assert.equal(menuList.disabled, locked,
|
||||
"Details state menu enabled state should be correct.");
|
||||
deferred.resolve();
|
||||
});
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
add_task(function* initializeState() {
|
||||
Services.prefs.setIntPref(getTestPluginPref(), Ci.nsIPluginTag.STATE_ENABLED);
|
||||
Services.prefs.unlockPref(getTestPluginPref());
|
||||
gManagerWindow = yield open_manager();
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
yield gCategoryUtilities.openType("plugin");
|
||||
|
||||
let plugins = yield getPlugins();
|
||||
gPluginElement = getTestPlugin(plugins);
|
||||
});
|
||||
|
||||
// Tests that plugin state menu is enabled if the preference is unlocked
|
||||
add_task(function* taskCheckStateMenuIsEnabled() {
|
||||
checkStateMenu(false);
|
||||
yield checkStateMenuDetail(false);
|
||||
});
|
||||
|
||||
// Lock the preference and then reload the plugin category
|
||||
add_task(function* reinitializeState() {
|
||||
// lock the preference
|
||||
Services.prefs.lockPref(getTestPluginPref());
|
||||
yield gCategoryUtilities.openType("plugin");
|
||||
// Retrieve the test plugin element
|
||||
let plugins = yield getPlugins();
|
||||
gPluginElement = getTestPlugin(plugins);
|
||||
});
|
||||
|
||||
// Tests that plugin state menu is disabled if the preference is locked
|
||||
add_task(function* taskCheckStateMenuIsDisabled() {
|
||||
checkStateMenu(true);
|
||||
yield checkStateMenuDetail(true);
|
||||
});
|
||||
|
||||
add_task(function* testCleanup() {
|
||||
yield close_manager(gManagerWindow);
|
||||
});
|
@ -884,10 +884,6 @@ setting[type="radio"] > radiogroup {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.addon-control.no-auto-hide {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.addon-control.enable {
|
||||
list-style-image: url("moz-icon://stock/gtk-yes?size=button");
|
||||
}
|
||||
|
@ -1108,10 +1108,6 @@ setting[type="radio"] > radiogroup {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.addon-control.no-auto-hide {
|
||||
display: block;
|
||||
}
|
||||
|
||||
button.button-link {
|
||||
-moz-appearance: none;
|
||||
background: transparent;
|
||||
|
@ -1124,10 +1124,6 @@ menulist { /* Fixes some styling inconsistencies */
|
||||
display: none;
|
||||
}
|
||||
|
||||
.addon-control.no-auto-hide {
|
||||
display: block;
|
||||
}
|
||||
|
||||
button.button-link {
|
||||
-moz-appearance: none;
|
||||
background: transparent;
|
||||
|
Loading…
Reference in New Issue
Block a user