Bug 1447831: Part 1 - Remove about:addons support for restart-required extensions. r=aswan

MozReview-Commit-ID: 2v5YsosDN9R

--HG--
extra : rebase_source : b2d056ef81605c9abd72d1bfe19200927aa66aa1
This commit is contained in:
Kris Maglione 2018-03-26 16:47:06 -07:00
parent f4c6f935b4
commit 81e92377b6
12 changed files with 43 additions and 1316 deletions

View File

@ -42,16 +42,8 @@ notification.vulnerableUpdatable.link=Update Now
#LOCALIZATION NOTE (notification.vulnerableNoUpdate) %1$S is the add-on name
notification.vulnerableNoUpdate=%1$S is known to be vulnerable. Use with caution.
notification.vulnerableNoUpdate.link=More Information
#LOCALIZATION NOTE (notification.enable) %1$S is the add-on name, %2$S is brand name
notification.enable=%1$S will be enabled after you restart %2$S.
#LOCALIZATION NOTE (notification.disable) %1$S is the add-on name, %2$S is brand name
notification.disable=%1$S will be disabled after you restart %2$S.
#LOCALIZATION NOTE (notification.install) %1$S is the add-on name, %2$S is brand name
notification.install=%1$S will be installed after you restart %2$S.
#LOCALIZATION NOTE (notification.uninstall) %1$S is the add-on name, %2$S is brand name
notification.uninstall=%1$S will be uninstalled after you restart %2$S.
#LOCALIZATION NOTE (notification.upgrade) %1$S is the add-on name, %2$S is brand name
notification.upgrade=%1$S will be updated after you restart %2$S.
#LOCALIZATION NOTE (notification.restartless-uninstall) %1$S is the add-on name
notification.restartless-uninstall=%1$S will be uninstalled after you close this tab.
#LOCALIZATION NOTE (notification.downloadError) %1$S is the add-on name.
notification.downloadError=There was an error downloading %1$S.
notification.downloadError.retry=Try again
@ -71,8 +63,6 @@ installDownloaded=Downloaded
installDownloadFailed=Error downloading
installVerifying=Verifying
installInstalling=Installing
installEnablePending=Restart to enable
installDisablePending=Restart to disable
installFailed=Error installing
installCancelled=Install cancelled
@ -97,16 +87,8 @@ details.notification.vulnerableUpdatable.link=Update Now
#LOCALIZATION NOTE (details.notification.vulnerableNoUpdate) %1$S is the add-on name
details.notification.vulnerableNoUpdate=%1$S is known to be vulnerable. Use with caution.
details.notification.vulnerableNoUpdate.link=More Information
#LOCALIZATION NOTE (details.notification.enable) %1$S is the add-on name, %2$S is brand name
details.notification.enable=%1$S will be enabled after you restart %2$S.
#LOCALIZATION NOTE (details.notification.disable) %1$S is the add-on name, %2$S is brand name
details.notification.disable=%1$S will be disabled after you restart %2$S.
#LOCALIZATION NOTE (details.notification.install) %1$S is the add-on name, %2$S is brand name
details.notification.install=%1$S will be installed after you restart %2$S.
#LOCALIZATION NOTE (details.notification.uninstall) %1$S is the add-on name, %2$S is brand name
details.notification.uninstall=%1$S will be uninstalled after you restart %2$S.
#LOCALIZATION NOTE (details.notification.upgrade) %1$S is the add-on name, %2$S is brand name
details.notification.upgrade=%1$S will be updated after you restart %2$S.
#LOCALIZATION NOTE (details.notification.restartless-uninstall) %1$S is the add-on name.
details.notification.restartless-uninstall=%1$S will be uninstalled after you close this tab.
#LOCALIZATION NOTE (details.notification.gmpPending) %1$S is the add-on name
details.notification.gmpPending=%1$S will be installed shortly.
@ -152,11 +134,8 @@ installFromFile.dialogTitle=Select add-on to install
installFromFile.filterName=Add-ons
uninstallAddonTooltip=Uninstall this add-on
uninstallAddonRestartRequiredTooltip=Uninstall this add-on (restart required)
enableAddonTooltip=Enable this add-on
enableAddonRestartRequiredTooltip=Enable this add-on (restart required)
disableAddonTooltip=Disable this add-on
disableAddonRestartRequiredTooltip=Disable this add-on (restart required)
#LOCALIZATION NOTE (eulaHeader) %S is name of the add-on asking the user to agree to the EULA
eulaHeader=%S requires that you accept the following End User License Agreement before installation can proceed:

View File

@ -933,22 +933,6 @@ var gViewController = {
}
},
cmd_restartApp: {
isEnabled() {
return true;
},
doCommand() {
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].
createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
"restart");
if (cancelQuit.data)
return; // somebody canceled our quit request
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
}
},
cmd_enableCheckCompatibility: {
isEnabled() {
return true;
@ -1053,7 +1037,6 @@ var gViewController = {
var pendingChecks = 0;
var numUpdated = 0;
var numManualUpdates = 0;
var restartNeeded = false;
let updateStatus = () => {
if (pendingChecks > 0)
@ -1076,12 +1059,7 @@ var gViewController = {
return;
}
if (restartNeeded) {
document.getElementById("updates-downloaded").hidden = false;
document.getElementById("updates-restart-btn").hidden = false;
} else {
document.getElementById("updates-installed").hidden = false;
}
document.getElementById("updates-installed").hidden = false;
};
var updateInstallListener = {
@ -1100,8 +1078,6 @@ var gViewController = {
onInstallEnded(aInstall, aAddon) {
pendingChecks--;
numUpdated++;
if (isPending(aInstall.existingAddon, "upgrade"))
restartNeeded = true;
updateStatus();
}
};
@ -1238,8 +1214,6 @@ var gViewController = {
getTooltip(aAddon) {
if (!aAddon)
return "";
if (aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_ENABLE)
return gStrings.ext.GetStringFromName("enableAddonRestartRequiredTooltip");
return gStrings.ext.GetStringFromName("enableAddonTooltip");
}
},
@ -1258,8 +1232,6 @@ var gViewController = {
getTooltip(aAddon) {
if (!aAddon)
return "";
if (aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_DISABLE)
return gStrings.ext.GetStringFromName("disableAddonRestartRequiredTooltip");
return gStrings.ext.GetStringFromName("disableAddonTooltip");
}
},
@ -1301,8 +1273,6 @@ var gViewController = {
getTooltip(aAddon) {
if (!aAddon)
return "";
if (aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL)
return gStrings.ext.GetStringFromName("uninstallAddonRestartRequiredTooltip");
return gStrings.ext.GetStringFromName("uninstallAddonTooltip");
}
},
@ -1372,16 +1342,8 @@ var gViewController = {
return aAddon.pendingOperations != AddonManager.PENDING_NONE;
},
doCommand(aAddon) {
if (isPending(aAddon, "install")) {
aAddon.install.cancel();
} else if (isPending(aAddon, "upgrade")) {
aAddon.pendingUpgrade.install.cancel();
} else if (isPending(aAddon, "uninstall")) {
if (isPending(aAddon, "uninstall")) {
aAddon.cancelUninstall();
} else if (isPending(aAddon, "enable")) {
aAddon.userDisabled = true;
} else if (isPending(aAddon, "disable")) {
aAddon.userDisabled = false;
}
}
},
@ -1785,8 +1747,7 @@ function doPendingUninstalls(aListBox) {
var items = [];
var listitem = aListBox.firstChild;
while (listitem) {
if (listitem.getAttribute("pending") == "uninstall" &&
!(listitem.opRequiresRestart("UNINSTALL")))
if (listitem.getAttribute("pending") == "uninstall")
items.push(listitem.mAddon);
listitem = listitem.nextSibling;
}
@ -1925,7 +1886,7 @@ var gCategories = {
this._maybeShowCategory(aAddon);
},
onExternalInstall(aAddon, aExistingAddon, aRequiresRestart) {
onExternalInstall(aAddon, aExistingAddon) {
this._maybeShowCategory(aAddon);
},
@ -2588,7 +2549,7 @@ var gListView = {
sortList(this._listBox, aSortBy, aAscending);
},
onExternalInstall(aAddon, aExistingAddon, aRequiresRestart) {
onExternalInstall(aAddon, aExistingAddon) {
// The existing list item will take care of upgrade installs
if (aExistingAddon)
return;
@ -2980,22 +2941,15 @@ var gDetailView = {
gViewController.updateCommands();
var pending = this._addon.pendingOperations;
if (pending != AddonManager.PENDING_NONE) {
if (pending & AddonManager.PENDING_UNINSTALL) {
this.node.removeAttribute("notification");
pending = null;
const PENDING_OPERATIONS = ["enable", "disable", "install", "uninstall",
"upgrade"];
for (let op of PENDING_OPERATIONS) {
if (isPending(this._addon, op))
pending = op;
}
this.node.setAttribute("pending", pending);
// We don't care about pending operations other than uninstall.
// They're transient, and cannot be undone.
this.node.setAttribute("pending", "uninstall");
document.getElementById("detail-pending").textContent = gStrings.ext.formatStringFromName(
"details.notification." + pending,
[this._addon.name, gStrings.brandShortName], 2
);
"details.notification.restartless-uninstall",
[this._addon.name], 1);
} else {
this.node.removeAttribute("pending");
@ -3329,9 +3283,9 @@ var gDetailView = {
this.fillSettingsRows();
},
onDisabling(aNeedsRestart) {
onDisabling() {
this.updateState();
if (!aNeedsRestart && hasInlineOptions(this._addon)) {
if (hasInlineOptions(this._addon)) {
Services.obs.notifyObservers(document,
AddonManager.OPTIONS_NOTIFICATION_HIDDEN,
this._addon.id);
@ -3368,15 +3322,12 @@ var gDetailView = {
this.updateState();
},
onExternalInstall(aAddon, aExistingAddon, aNeedsRestart) {
onExternalInstall(aAddon, aExistingAddon) {
// Only care about upgrades for the currently displayed add-on
if (!aExistingAddon || aExistingAddon.id != this._addon.id)
return;
if (!aNeedsRestart)
this._updateView(aAddon, false);
else
this.updateState();
this._updateView(aAddon, false);
},
onInstallCancelled(aInstall) {

View File

@ -467,10 +467,6 @@
document.getAnonymousElementByAttribute(this, "anonid",
"install-remote-btn");
</field>
<field name="_restartNeeded">
document.getAnonymousElementByAttribute(this, "anonid",
"restart-needed");
</field>
<field name="_undo">
document.getAnonymousElementByAttribute(this, "anonid",
"undo-btn");
@ -601,19 +597,6 @@
]]></body>
</method>
<method name="undoAction">
<body><![CDATA[
if (!this.mAddon)
return;
var pending = this.mAddon.pendingOperations;
if (pending & AddonManager.PENDING_ENABLE)
this.mAddon.userDisabled = true;
else if (pending & AddonManager.PENDING_DISABLE)
this.mAddon.userDisabled = false;
this.refreshState();
]]></body>
</method>
<method name="onDownloadStarted">
<body><![CDATA[
this.refreshState();
@ -684,14 +667,6 @@
]]></body>
</method>
<method name="opRequiresRestart">
<parameter name="aOperation"/>
<body><![CDATA[
var operation = AddonManager["OP_NEEDS_RESTART_" + aOperation.toUpperCase()];
return !!(this.mAddon.operationsRequiringRestart & operation);
]]></body>
</method>
<method name="isPending">
<parameter name="aAction"/>
<body><![CDATA[
@ -742,9 +717,6 @@
class="pending">
<xul:image class="pending-icon"/>
<xul:label anonid="pending" flex="1"/>
<xul:button anonid="restart-btn" class="button-link"
label="&addon.restartNow.label;"
oncommand="document.getBindingParent(this).restart();"/>
<xul:button anonid="undo-btn" class="button-link"
label="&addon.undoAction.label;"
tooltipText="&addon.undoAction.tooltip;"
@ -1150,22 +1122,15 @@
gViewController.updateCommands();
var pending = this.mAddon.pendingOperations;
if (pending != AddonManager.PENDING_NONE) {
if (pending & AddonManager.PENDING_UNINSTALL) {
this.removeAttribute("notification");
pending = null;
const PENDING_OPERATIONS = ["enable", "disable", "install",
"uninstall", "upgrade"];
for (let op of PENDING_OPERATIONS) {
if (this.isPending(op))
pending = op;
}
this.setAttribute("pending", pending);
// We don't care about pending operations other than uninstall.
// They're transient, and cannot be undone.
this.setAttribute("pending", "uninstall");
this._pending.textContent = gStrings.ext.formatStringFromName(
"notification." + pending,
[this.mAddon.name, gStrings.brandShortName], 2
);
"notification.restartless-uninstall",
[this.mAddon.name], 1);
} else {
this.removeAttribute("pending");
@ -1483,12 +1448,6 @@
]]></body>
</method>
<method name="restart">
<body><![CDATA[
gViewController.commands.cmd_restartApp.doCommand();
]]></body>
</method>
<method name="undo">
<body><![CDATA[
gViewController.commands.cmd_cancelOperation.doCommand(this.mAddon);
@ -1497,11 +1456,12 @@
<method name="uninstall">
<body><![CDATA[
// If uninstalling does not require a restart and the type doesn't
// support undoing of restartless uninstalls, then we fake it by
// just disabling it it, and doing the real uninstall later.
if (!this.opRequiresRestart("uninstall") &&
!this.typeHasFlag("SUPPORTS_UNDO_RESTARTLESS_UNINSTALL")) {
// If the type doesn't support undoing of restartless uninstalls,
// then we fake it by just disabling it it, and doing the real
// uninstall later.
if (this.typeHasFlag("SUPPORTS_UNDO_RESTARTLESS_UNINSTALL")) {
this.mAddon.uninstall(true);
} else {
this.setAttribute("wasDisabled", this.mAddon.userDisabled);
// We must set userDisabled to true first, this will call
@ -1510,8 +1470,6 @@
// This won't update any other add-on manager views (bug 582002)
this.setAttribute("pending", "uninstall");
} else {
this.mAddon.uninstall(true);
}
]]></body>
</method>
@ -1591,7 +1549,6 @@
</method>
<method name="onUninstalling">
<parameter name="aRestartRequired"/>
<body><![CDATA[
this._updateState();
]]></body>
@ -1634,17 +1591,11 @@
<method name="onExternalInstall">
<parameter name="aAddon"/>
<parameter name="aExistingAddon"/>
<parameter name="aNeedsRestart"/>
<body><![CDATA[
if (aExistingAddon.id != this.mAddon.id)
return;
// If the install completed without needing a restart then switch to
// using the new Addon
if (!aNeedsRestart)
this._initWithAddon(aAddon);
else
this._updateState();
this._initWithAddon(aAddon);
]]></body>
</method>
@ -1684,12 +1635,7 @@
<parameter name="aInstall"/>
<parameter name="aAddon"/>
<body><![CDATA[
// If the install completed without needing a restart then switch to
// using the new Addon
if (!(aAddon.pendingOperations & AddonManager.PENDING_INSTALL))
this._initWithAddon(aAddon);
else
this._updateState();
this._initWithAddon(aAddon);
]]></body>
</method>
@ -1739,9 +1685,6 @@
<xul:hbox class="pending">
<xul:image class="pending-icon"/>
<xul:label anonid="notice" flex="1"/>
<xul:button anonid="restart-btn" class="button-link"
label="&addon.restartNow.label;"
command="cmd_restartApp"/>
<xul:button anonid="undo-btn" class="button-link"
label="&addon.undoRemove.label;"
tooltiptext="&addon.undoRemove.tooltip;"
@ -1756,9 +1699,6 @@
[this.mAddon.name],
1);
if (!this.opRequiresRestart("uninstall"))
this._restartBtn.setAttribute("hidden", true);
gEventManager.registerAddonListener(this, this.mAddon.id);
]]></constructor>
@ -1769,9 +1709,6 @@
<field name="_notice" readonly="true">
document.getAnonymousElementByAttribute(this, "anonid", "notice");
</field>
<field name="_restartBtn" readonly="true">
document.getAnonymousElementByAttribute(this, "anonid", "restart-btn");
</field>
<method name="cancelUninstall">
<body><![CDATA[
@ -1788,17 +1725,9 @@
]]></body>
</method>
<method name="onOperationCancelled">
<body><![CDATA[
if (!this.isPending("uninstall"))
this.removeAttribute("pending");
]]></body>
</method>
<method name="onExternalInstall">
<parameter name="aAddon"/>
<parameter name="aExistingAddon"/>
<parameter name="aNeedsRestart"/>
<body><![CDATA[
if (aExistingAddon.id != this.mAddon.id)
return;
@ -1807,10 +1736,7 @@
if (this.hasAttribute("wasDisabled"))
aAddon.userDisabled = this.getAttribute("wasDisabled") == "true";
// If the install completed without needing a restart then switch to
// using the new Addon
if (!aNeedsRestart)
this.mAddon = aAddon;
this.mAddon = aAddon;
this.removeAttribute("pending");
]]></body>
@ -1829,10 +1755,7 @@
<parameter name="aInstall"/>
<parameter name="aAddon"/>
<body><![CDATA[
// If the install completed without needing a restart then switch to
// using the new Addon
if (!(aAddon.pendingOperations & AddonManager.PENDING_INSTALL))
this.mAddon = aAddon;
this.mAddon = aAddon;
this.removeAttribute("pending");
]]></body>

View File

@ -46,7 +46,6 @@ skip-if = buildapp == 'mulet'
[browser_bug567137.js]
[browser_bug570760.js]
[browser_bug572561.js]
[browser_bug573062.js]
[browser_bug577990.js]
[browser_bug580298.js]
[browser_bug586574.js]
@ -55,7 +54,6 @@ skip-if = buildapp == 'mulet'
skip-if = os == "linux" && !debug # Bug 1395539 - fails on multi-core
[browser_bug591663.js]
[browser_bug596336.js]
[browser_bug608316.js]
[browser_bug616841.js]
[browser_bug618502.js]
[browser_bug679604.js]

View File

@ -1,116 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
function test() {
waitForExplicitFinish();
var gProvider = new MockProvider();
let perms = AddonManager.PERM_CAN_UNINSTALL |
AddonManager.PERM_CAN_ENABLE | AddonManager.PERM_CAN_DISABLE;
gProvider.createAddons([{
id: "restart-enable-disable@tests.mozilla.org",
name: "restart-enable-disable",
description: "foo",
permissions: perms,
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_ENABLE |
AddonManager.OP_NEEDS_RESTART_DISABLE
},
{
id: "restart-uninstall@tests.mozilla.org",
name: "restart-uninstall",
description: "foo",
permissions: perms,
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_UNINSTALL
},
{
id: "no-restart-required@tests.mozilla.org",
name: "no-restart-required",
description: "bar",
permissions: perms,
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE
}]);
open_manager("addons://list/extension", function(aWindow) {
let addonList = aWindow.document.getElementById("addon-list");
let ed_r_Item, un_r_Item, no_r_Item;
for (let addonItem of addonList.childNodes) {
let name = addonItem.getAttribute("name");
switch (name) {
case "restart-enable-disable":
ed_r_Item = addonItem;
break;
case "restart-uninstall":
un_r_Item = addonItem;
break;
case "no-restart-required":
no_r_Item = addonItem;
break;
}
}
// Check the buttons in the list view.
function checkTooltips(aItem, aEnable, aDisable, aRemove) {
is(aItem._enableBtn.getAttribute("tooltiptext"), aEnable);
is(aItem._disableBtn.getAttribute("tooltiptext"), aDisable);
is(aItem._removeBtn.getAttribute("tooltiptext"), aRemove);
}
let strs = aWindow.gStrings.ext;
addonList.selectedItem = ed_r_Item;
let ed_args = [ed_r_Item,
strs.GetStringFromName("enableAddonRestartRequiredTooltip"),
strs.GetStringFromName("disableAddonRestartRequiredTooltip"),
strs.GetStringFromName("uninstallAddonTooltip")];
checkTooltips.apply(null, ed_args);
addonList.selectedItem = un_r_Item;
let un_args = [un_r_Item,
strs.GetStringFromName("enableAddonTooltip"),
strs.GetStringFromName("disableAddonTooltip"),
strs.GetStringFromName("uninstallAddonRestartRequiredTooltip")];
checkTooltips.apply(null, un_args);
addonList.selectedItem = no_r_Item;
let no_args = [no_r_Item,
strs.GetStringFromName("enableAddonTooltip"),
strs.GetStringFromName("disableAddonTooltip"),
strs.GetStringFromName("uninstallAddonTooltip")];
checkTooltips.apply(null, no_args);
// Check the buttons in the details view.
function checkTooltips2(aItem, aEnable, aDisable, aRemove) {
let detailEnable = aWindow.document.getElementById("detail-enable-btn");
let detailDisable = aWindow.document.getElementById("detail-disable-btn");
let detailUninstall = aWindow.document.getElementById("detail-uninstall-btn");
ok(detailEnable.getAttribute("tooltiptext") == aEnable);
ok(detailDisable.getAttribute("tooltiptext") == aDisable);
ok(detailUninstall.getAttribute("tooltiptext") == aRemove);
}
function showInDetailView(aAddonId) {
aWindow.gViewController.loadView("addons://detail/" +
aWindow.encodeURIComponent(aAddonId));
}
// enable-disable:
showInDetailView("restart-enable-disable@tests.mozilla.org");
wait_for_view_load(aWindow, function() {
checkTooltips2.apply(null, ed_args);
// uninstall:
showInDetailView("restart-uninstall@tests.mozilla.org");
wait_for_view_load(aWindow, function() {
checkTooltips2.apply(null, un_args);
// no restart:
showInDetailView("no-restart-required@tests.mozilla.org");
wait_for_view_load(aWindow, function() {
checkTooltips2.apply(null, no_args);
aWindow.close();
finish();
});
});
});
});
}

View File

@ -1,65 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Bug 608316 - Test that cancelling an uninstall during the onUninstalling
// event doesn't confuse the UI
var gProvider;
function test() {
waitForExplicitFinish();
gProvider = new MockProvider();
gProvider.createAddons([{
id: "addon1@tests.mozilla.org",
name: "addon 1",
version: "1.0"
}]);
run_next_test();
}
function end_test() {
finish();
}
add_test(function() {
var sawUninstall = false;
var listener = {
onUninstalling(aAddon, aRestartRequired) {
if (aAddon.id != "addon1@tests.mozilla.org")
return;
sawUninstall = true;
aAddon.cancelUninstall();
}
};
// Important to add this before opening the UI so it gets its events first
AddonManager.addAddonListener(listener);
registerCleanupFunction(function() {
AddonManager.removeAddonListener(listener);
});
open_manager("addons://list/extension", function(aManager) {
var addon = get_addon_element(aManager, "addon1@tests.mozilla.org");
isnot(addon, null, "Should see the add-on in the list");
var removeBtn = aManager.document.getAnonymousElementByAttribute(addon, "anonid", "remove-btn");
EventUtils.synthesizeMouseAtCenter(removeBtn, { }, aManager);
ok(sawUninstall, "Should have seen the uninstall event");
sawUninstall = false;
is(addon.getAttribute("pending"), "", "Add-on should not be uninstalling");
close_manager(aManager, function() {
ok(!sawUninstall, "Should not have seen another uninstall event");
run_next_test();
});
});
});

View File

@ -107,13 +107,6 @@ function test() {
thumbnailWidth: 160,
thumbnailHeight: 120
}],
}, {
id: "addon4@tests.mozilla.org",
blocklistURL: "http://example.com/addon4@tests.mozilla.org",
name: "Test add-on 4",
_userDisabled: true,
isActive: false,
blocklistState: Ci.nsIBlocklistService.STATE_SOFTBLOCKED
}, {
id: "addon5@tests.mozilla.org",
blocklistURL: "http://example.com/addon5@tests.mozilla.org",
@ -121,17 +114,6 @@ function test() {
isActive: false,
blocklistState: Ci.nsIBlocklistService.STATE_BLOCKED,
appDisabled: true
}, {
id: "addon6@tests.mozilla.org",
blocklistURL: "http://example.com/addon6@tests.mozilla.org",
name: "Test add-on 6",
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE
}, {
id: "addon7@tests.mozilla.org",
blocklistURL: "http://example.com/addon7@tests.mozilla.org",
name: "Test add-on 7",
_userDisabled: true,
isActive: false
}, {
id: "addon8@tests.mozilla.org",
blocklistURL: "http://example.com/addon8@tests.mozilla.org",
@ -177,104 +159,6 @@ function end_test() {
});
}
// Opens and tests the details view for add-on 1
add_test(function() {
open_details("addon1@tests.mozilla.org", "extension", function() {
is(get("detail-name").textContent, "Test add-on 1", "Name should be correct");
is_element_visible(get("detail-version"), "Version should not be hidden");
is(get("detail-version").value, "2.1", "Version should be correct");
is(get("detail-icon").src, "chrome://foo/skin/icon64.png", "Icon should be correct");
is_element_hidden(get("detail-creator"), "Creator should be hidden");
is_element_hidden(get("detail-screenshot-box"), "Screenshot should be hidden");
is(get("detail-screenshot").width, "", "Screenshot dimensions should not be set");
is(get("detail-screenshot").height, "", "Screenshot dimensions should not be set");
is(get("detail-desc").textContent, "Short description", "Description should be correct");
is(get("detail-fulldesc").textContent, "Longer description", "Full description should be correct");
is_element_visible(get("detail-contributions"), "Contributions section should be visible");
is_element_visible(get("detail-updates-row"), "Updates should not be hidden");
is_element_hidden(get("detail-dateUpdated"), "Update date should be hidden");
is_element_visible(get("detail-rating-row"), "Rating row should not be hidden");
is_element_visible(get("detail-rating"), "Rating should not be hidden");
is(get("detail-rating").averageRating, 4, "Rating should be correct");
is_element_visible(get("detail-reviews"), "Reviews should not be hidden");
is(get("detail-reviews").href, "http://example.com/reviews", "Review URL should be correct");
is(get("detail-reviews").value, "5 reviews", "Review text should be correct");
is_element_visible(get("detail-homepage-row"), "Homepage should be visible");
ok(get("detail-homepage").href, "http://example.com/addon1");
is_element_hidden(get("detail-repository-row"), "Repository profile should not be visible");
is_element_hidden(get("detail-size"), "Size should be hidden");
is_element_visible(get("detail-autoUpdate"), "Updates should not be hidden");
ok(get("detail-autoUpdate").childNodes[1].selected, "Updates ahould be automatic");
is_element_hidden(get("detail-findUpdates-btn"), "Check for updates should be hidden");
EventUtils.synthesizeMouseAtCenter(get("detail-autoUpdate").lastChild, {}, gManagerWindow);
ok(get("detail-autoUpdate").lastChild.selected, "Updates should be manual");
is_element_visible(get("detail-findUpdates-btn"), "Check for updates should be visible");
EventUtils.synthesizeMouseAtCenter(get("detail-autoUpdate").firstChild, {}, gManagerWindow);
ok(get("detail-autoUpdate").firstChild.selected, "Updates should be automatic");
is_element_hidden(get("detail-findUpdates-btn"), "Check for updates should be hidden");
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
// Disable it
EventUtils.synthesizeMouseAtCenter(get("detail-disable-btn"), {}, gManagerWindow);
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_visible(get("detail-enable-btn"), "Enable button should be visible");
is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_visible(get("detail-pending"), "Pending message should be visible");
is(get("detail-pending").textContent, "Test add-on 1 will be disabled after you restart " + gApp + ".", "Pending message should be correct");
// Reopen it
open_details("addon1@tests.mozilla.org", "extension", function() {
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_visible(get("detail-enable-btn"), "Enable button should be visible");
is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_visible(get("detail-pending"), "Pending message should be visible");
is(get("detail-pending").textContent, "Test add-on 1 will be disabled after you restart " + gApp + ".", "Pending message should be correct");
// Undo disabling
EventUtils.synthesizeMouseAtCenter(get("detail-undo-btn"), {}, gManagerWindow);
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
run_next_test();
});
});
});
// Opens and tests the details view for add-on 2
add_test(function() {
open_details("addon2@tests.mozilla.org", "extension", function() {
@ -408,74 +292,6 @@ add_test(function() {
});
});
// Opens and tests the details view for add-on 4
add_test(function() {
open_details("addon4@tests.mozilla.org", "extension", function() {
is(get("detail-name").textContent, "Test add-on 4", "Name should be correct");
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_visible(get("detail-enable-btn"), "Enable button should be visible");
is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_visible(get("detail-warning"), "Warning message should be visible");
is(get("detail-warning").textContent, "Test add-on 4 is known to cause security or stability issues.", "Warning message should be correct");
is_element_visible(get("detail-warning-link"), "Warning link should be visible");
is(get("detail-warning-link").value, "More Information", "Warning link text should be correct");
is(get("detail-warning-link").href, "http://example.com/addon4@tests.mozilla.org", "Warning link should be correct");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
// Enable it
EventUtils.synthesizeMouseAtCenter(get("detail-enable-btn"), {}, gManagerWindow);
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_visible(get("detail-pending"), "Pending message should be visible");
is(get("detail-pending").textContent, "Test add-on 4 will be enabled after you restart " + gApp + ".", "Pending message should be correct");
// Reopen it
open_details("addon4@tests.mozilla.org", "extension", function() {
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_visible(get("detail-pending"), "Pending message should be visible");
is(get("detail-pending").textContent, "Test add-on 4 will be enabled after you restart " + gApp + ".", "Pending message should be correct");
// Undo enabling
EventUtils.synthesizeMouseAtCenter(get("detail-undo-btn"), {}, gManagerWindow);
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_visible(get("detail-enable-btn"), "Enable button should be visible");
is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_visible(get("detail-warning"), "Warning message should be visible");
is(get("detail-warning").textContent, "Test add-on 4 is known to cause security or stability issues.", "Warning message should be correct");
is_element_visible(get("detail-warning-link"), "Warning link should be visible");
is(get("detail-warning-link").value, "More Information", "Warning link text should be correct");
is(get("detail-warning-link").href, "http://example.com/addon4@tests.mozilla.org", "Warning link should be correct");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
run_next_test();
});
});
});
// Opens and tests the details view for add-on 5
add_test(function() {
open_details("addon5@tests.mozilla.org", "extension", function() {
@ -499,196 +315,6 @@ add_test(function() {
});
});
// Opens and tests the details view for add-on 6
add_test(function() {
open_details("addon6@tests.mozilla.org", "extension", function() {
is(get("detail-name").textContent, "Test add-on 6", "Name should be correct");
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
// Disable it
EventUtils.synthesizeMouseAtCenter(get("detail-disable-btn"), {}, gManagerWindow);
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_visible(get("detail-enable-btn"), "Enable button should be visible");
is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
// Reopen it
open_details("addon6@tests.mozilla.org", "extension", function() {
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_visible(get("detail-enable-btn"), "Enable button should be visible");
is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be visible");
// Enable it
EventUtils.synthesizeMouseAtCenter(get("detail-enable-btn"), {}, gManagerWindow);
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
run_next_test();
});
});
});
// Opens and tests the details view for add-on 7
add_test(function() {
open_details("addon7@tests.mozilla.org", "extension", function() {
is(get("detail-name").textContent, "Test add-on 7", "Name should be correct");
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_visible(get("detail-enable-btn"), "Enable button should be visible");
is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
// Enable it
EventUtils.synthesizeMouseAtCenter(get("detail-enable-btn"), {}, gManagerWindow);
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_visible(get("detail-pending"), "Pending message should be visible");
is(get("detail-pending").textContent, "Test add-on 7 will be enabled after you restart " + gApp + ".", "Pending message should be correct");
// Reopen it
open_details("addon7@tests.mozilla.org", "extension", function() {
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_visible(get("detail-pending"), "Pending message should be visible");
is(get("detail-pending").textContent, "Test add-on 7 will be enabled after you restart " + gApp + ".", "Pending message should be correct");
// Undo enabling
EventUtils.synthesizeMouseAtCenter(get("detail-undo-btn"), {}, gManagerWindow);
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_visible(get("detail-enable-btn"), "Enable button should be visible");
is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
run_next_test();
});
});
});
// Opens and tests the details view for add-on 8
add_test(function() {
open_details("addon8@tests.mozilla.org", "extension", function() {
is(get("detail-name").textContent, "Test add-on 8", "Name should be correct");
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_visible(get("detail-warning"), "Warning message should be visible");
is(get("detail-warning").textContent, "An important update is available for Test add-on 8.", "Warning message should be correct");
is_element_visible(get("detail-warning-link"), "Warning link should be visible");
is(get("detail-warning-link").value, "Update Now", "Warning link text should be correct");
is(get("detail-warning-link").href, "http://example.com/addon8@tests.mozilla.org", "Warning link should be correct");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
// Disable it
EventUtils.synthesizeMouseAtCenter(get("detail-disable-btn"), {}, gManagerWindow);
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_visible(get("detail-enable-btn"), "Enable button should be visible");
is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_visible(get("detail-pending"), "Pending message should be visible");
is(get("detail-pending").textContent, "Test add-on 8 will be disabled after you restart " + gApp + ".", "Pending message should be correct");
// Reopen it
open_details("addon8@tests.mozilla.org", "extension", function() {
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_visible(get("detail-enable-btn"), "Enable button should be visible");
is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_visible(get("detail-pending"), "Pending message should be visible");
is(get("detail-pending").textContent, "Test add-on 8 will be disabled after you restart " + gApp + ".", "Pending message should be correct");
// Undo disabling
EventUtils.synthesizeMouseAtCenter(get("detail-undo-btn"), {}, gManagerWindow);
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
is_element_visible(get("detail-warning"), "Warning message should be visible");
is(get("detail-warning").textContent, "An important update is available for Test add-on 8.", "Warning message should be correct");
is_element_visible(get("detail-warning-link"), "Warning link should be visible");
is(get("detail-warning-link").value, "Update Now", "Warning link text should be correct");
is(get("detail-warning-link").href, "http://example.com/addon8@tests.mozilla.org", "Warning link should be correct");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
run_next_test();
});
});
});
// These tests are only appropriate when signing can be turned off
if (!AppConstants.MOZ_REQUIRE_SIGNING) {
// Opens and tests the details view for add-on 9

View File

@ -18,7 +18,7 @@ var gVersion = Services.appinfo.version;
var gDate = new Date(2010, 7, 16);
var infoURL = Services.urlFormatter.formatURLPref("app.support.baseURL") + "unsigned-addons";
const EXPECTED_ADDONS = 13;
const EXPECTED_ADDONS = 11;
var gLWTheme = {
id: "4",
@ -59,13 +59,6 @@ add_task(async function() {
permissions: AddonManager.PERM_CAN_ENABLE |
AddonManager.PERM_CAN_DISABLE |
AddonManager.PERM_CAN_UPGRADE
}, {
id: "addon4@tests.mozilla.org",
blocklistURL: "http://example.com/addon4@tests.mozilla.org",
name: "Test add-on 4",
_userDisabled: true,
isActive: false,
blocklistState: Ci.nsIBlocklistService.STATE_SOFTBLOCKED
}, {
id: "addon5@tests.mozilla.org",
blocklistURL: "http://example.com/addon5@tests.mozilla.org",
@ -78,11 +71,6 @@ add_task(async function() {
blocklistURL: "http://example.com/addon6@tests.mozilla.org",
name: "Test add-on 6",
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE
}, {
id: "addon7@tests.mozilla.org",
blocklistURL: "http://example.com/addon7@tests.mozilla.org",
name: "Test add-on 7",
blocklistState: Ci.nsIBlocklistService.STATE_OUTDATED,
}, {
id: "addon8@tests.mozilla.org",
blocklistURL: "http://example.com/addon8@tests.mozilla.org",
@ -155,84 +143,10 @@ add_task(async function() {
let items = get_test_items();
is(Object.keys(items).length, EXPECTED_ADDONS, "Should be the right number of add-ons installed");
info("Addon 1");
let addon = items["Test add-on"];
info("Addon 3");
let addon = items["Test add-on 3"];
addon.parentNode.ensureElementIsVisible(addon);
let { name, version } = await get_tooltip_info(addon);
is(get_node(addon, "name").value, "Test add-on", "Name should be correct");
is(name, "Test add-on", "Tooltip name should be correct");
is(version, "1.0", "Tooltip version should be correct");
is(get_node(addon, "description").value, "A test add-on", "Description should be correct");
is_element_hidden(get_class_node(addon, "disabled-postfix"), "Disabled postfix should be hidden");
is_element_hidden(get_class_node(addon, "update-postfix"), "Update postfix should be hidden");
is(get_node(addon, "date-updated").value, formatDate(gDate), "Update date should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_hidden(get_node(addon, "warning"), "Warning message should be hidden");
is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
info("Disabling");
EventUtils.synthesizeMouseAtCenter(get_node(addon, "disable-btn"), {}, gManagerWindow);
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_visible(get_node(addon, "enable-btn"), "Enable button should be visible");
is_element_hidden(get_node(addon, "disable-btn"), "Disable button should be hidden");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_hidden(get_node(addon, "warning"), "Warning message should be visible");
is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_visible(get_node(addon, "pending"), "Pending message should be visible");
is(get_node(addon, "pending").textContent, "Test add-on will be disabled after you restart " + gApp + ".", "Pending message should be correct");
info("Addon 2");
addon = items["Test add-on 2"];
addon.parentNode.ensureElementIsVisible(addon);
({ name, version } = await get_tooltip_info(addon));
is(get_node(addon, "name").value, "Test add-on 2", "Name should be correct");
is(name, "Test add-on 2", "Tooltip name should be correct");
is(version, "2.0", "Tooltip version should be correct");
is_element_hidden(get_node(addon, "description"), "Description should be hidden");
is_element_visible(get_class_node(addon, "disabled-postfix"), "Disabled postfix should be visible");
is_element_hidden(get_class_node(addon, "update-postfix"), "Update postfix should be hidden");
is(get_node(addon, "date-updated").value, "Unknown", "Date should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_visible(get_node(addon, "enable-btn"), "Enable button should be visible");
is_element_hidden(get_node(addon, "disable-btn"), "Disable button should be hidden");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_hidden(get_node(addon, "warning"), "Warning message should be hidden");
is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
info("Enabling");
EventUtils.synthesizeMouseAtCenter(get_node(addon, "enable-btn"), {}, gManagerWindow);
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_hidden(get_node(addon, "warning"), "Warning message should be hidden");
is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_visible(get_node(addon, "pending"), "Pending message should be visible");
is(get_node(addon, "pending").textContent, "Test add-on 2 will be enabled after you restart " + gApp + ".", "Pending message should be correct");
info("Addon 3");
addon = items["Test add-on 3"];
addon.parentNode.ensureElementIsVisible(addon);
({ name, version } = await get_tooltip_info(addon));
is(get_node(addon, "name").value, "Test add-on 3", "Name should be correct");
is(name, "Test add-on 3", "Tooltip name should be correct");
is(version, undefined, "Tooltip version should be hidden");
@ -249,41 +163,6 @@ add_task(async function() {
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
info("Addon 4");
addon = items["Test add-on 4"];
addon.parentNode.ensureElementIsVisible(addon);
({ name, version } = await get_tooltip_info(addon));
is(get_node(addon, "name").value, "Test add-on 4", "Name should be correct");
is(name, "Test add-on 4", "Tooltip name should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_visible(get_node(addon, "enable-btn"), "Enable button should be visible");
is_element_hidden(get_node(addon, "disable-btn"), "Disable button should be hidden");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_visible(get_node(addon, "warning"), "Warning message should be visible");
is(get_node(addon, "warning").textContent, "Test add-on 4 is known to cause security or stability issues.", "Warning message should be correct");
is_element_visible(get_node(addon, "warning-link"), "Warning link should be visible");
is(get_node(addon, "warning-link").value, "More Information", "Warning link text should be correct");
is(get_node(addon, "warning-link").href, "http://example.com/addon4@tests.mozilla.org", "Warning link should be correct");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
info("Enabling");
EventUtils.synthesizeMouseAtCenter(get_node(addon, "enable-btn"), {}, gManagerWindow);
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_hidden(get_node(addon, "warning"), "Warning message should be hidden");
is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_visible(get_node(addon, "pending"), "Pending message should be visible");
is(get_node(addon, "pending").textContent, "Test add-on 4 will be enabled after you restart " + gApp + ".", "Pending message should be correct");
info("Addon 5");
addon = items["Test add-on 5"];
addon.parentNode.ensureElementIsVisible(addon);
@ -339,41 +218,6 @@ add_task(async function() {
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
info("Addon 7");
addon = items["Test add-on 7"];
addon.parentNode.ensureElementIsVisible(addon);
({ name, version } = await get_tooltip_info(addon));
is(get_node(addon, "name").value, "Test add-on 7", "Name should be correct");
is(name, "Test add-on 7", "Tooltip name should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_visible(get_node(addon, "warning"), "Warning message should be hidden");
is(get_node(addon, "warning").textContent, "An important update is available for Test add-on 7.", "Warning message should be correct");
is_element_visible(get_node(addon, "warning-link"), "Warning link should be visible");
is(get_node(addon, "warning-link").value, "Update Now", "Warning link text should be correct");
is(get_node(addon, "warning-link").href, "http://example.com/addon7@tests.mozilla.org", "Warning link should be correct");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
info("Disabling");
EventUtils.synthesizeMouseAtCenter(get_node(addon, "disable-btn"), {}, gManagerWindow);
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_visible(get_node(addon, "enable-btn"), "Enable button should be visible");
is_element_hidden(get_node(addon, "disable-btn"), "Disable button should be hidden");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_hidden(get_node(addon, "warning"), "Warning message should be visible");
is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_visible(get_node(addon, "pending"), "Pending message should be visible");
is(get_node(addon, "pending").textContent, "Test add-on 7 will be disabled after you restart " + gApp + ".", "Pending message should be correct");
info("Addon 8");
addon = items["Test add-on 8"];
addon.parentNode.ensureElementIsVisible(addon);
@ -468,17 +312,6 @@ add_task(async function() {
}
});
// Check the add-ons are now in the right state
add_task(async function() {
let [a1, a2, a4] = await promiseAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"addon4@tests.mozilla.org"]);
is(a1.pendingOperations, AddonManager.PENDING_DISABLE, "Add-on 1 should be pending disable");
is(a2.pendingOperations, AddonManager.PENDING_ENABLE, "Add-on 2 should be pending enable");
is(a4.pendingOperations, AddonManager.PENDING_ENABLE, "Add-on 4 should be pending enable");
});
// Reload the list to make sure the changes are still pending and that undoing
// works
add_task(async function() {
@ -488,120 +321,10 @@ add_task(async function() {
let items = get_test_items();
is(Object.keys(items).length, EXPECTED_ADDONS, "Should be the right number of add-ons installed");
info("Addon 1");
let addon = items["Test add-on"];
addon.parentNode.ensureElementIsVisible(addon);
let { name, version } = await get_tooltip_info(addon);
is(get_node(addon, "name").value, "Test add-on", "Name should be correct");
is(name, "Test add-on", "Tooltip name should be correct");
is(version, "1.0", "Tooltip version should be correct");
is_element_visible(get_node(addon, "description"), "Description should be visible");
is(get_node(addon, "description").value, "A test add-on", "Description should be correct");
is_element_hidden(get_class_node(addon, "disabled-postfix"), "Disabled postfix should be hidden");
is_element_hidden(get_class_node(addon, "update-postfix"), "Update postfix should be hidden");
is(get_node(addon, "date-updated").value, formatDate(gDate), "Update date should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_visible(get_node(addon, "enable-btn"), "Enable button should be visible");
is_element_hidden(get_node(addon, "disable-btn"), "Disable button should be hidden");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_hidden(get_node(addon, "warning"), "Warning message should be hidden");
is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_visible(get_node(addon, "pending"), "Pending message should be visible");
is(get_node(addon, "pending").textContent, "Test add-on will be disabled after you restart " + gApp + ".", "Pending message should be correct");
info("Undoing");
EventUtils.synthesizeMouseAtCenter(get_node(addon, "undo-btn"), {}, gManagerWindow);
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_hidden(get_node(addon, "warning"), "Warning message should be hidden");
is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
info("Addon 2");
addon = items["Test add-on 2"];
addon.parentNode.ensureElementIsVisible(addon);
({ name, version } = await get_tooltip_info(addon));
is(get_node(addon, "name").value, "Test add-on 2", "Name should be correct");
is(name, "Test add-on 2", "Tooltip name should be correct");
is(version, "2.0", "Tooltip version should be correct");
is_element_hidden(get_node(addon, "description"), "Description should be hidden");
is_element_visible(get_class_node(addon, "disabled-postfix"), "Disabled postfix should be visible");
is_element_hidden(get_class_node(addon, "update-postfix"), "Update postfix should be hidden");
is(get_node(addon, "date-updated").value, "Unknown", "Date should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_hidden(get_node(addon, "warning"), "Warning message should be hidden");
is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_visible(get_node(addon, "pending"), "Pending message should be visible");
is(get_node(addon, "pending").textContent, "Test add-on 2 will be enabled after you restart " + gApp + ".", "Pending message should be correct");
info("Undoing");
EventUtils.synthesizeMouseAtCenter(get_node(addon, "undo-btn"), {}, gManagerWindow);
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_visible(get_node(addon, "enable-btn"), "Enable button should be visible");
is_element_hidden(get_node(addon, "disable-btn"), "Disable button should be hidden");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_hidden(get_node(addon, "warning"), "Warning message should be hidden");
is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
info("Addon 4");
addon = items["Test add-on 4"];
addon.parentNode.ensureElementIsVisible(addon);
({ name, version } = await get_tooltip_info(addon));
is(get_node(addon, "name").value, "Test add-on 4", "Name should be correct");
is(name, "Test add-on 4", "Tooltip name should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_hidden(get_node(addon, "warning"), "Warning message should be hidden");
is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_visible(get_node(addon, "pending"), "Pending message should be visible");
is(get_node(addon, "pending").textContent, "Test add-on 4 will be enabled after you restart " + gApp + ".", "Pending message should be correct");
info("Undoing");
EventUtils.synthesizeMouseAtCenter(get_node(addon, "undo-btn"), {}, gManagerWindow);
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_visible(get_node(addon, "enable-btn"), "Enable button should be visible");
is_element_hidden(get_node(addon, "disable-btn"), "Disable button should be hidden");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_visible(get_node(addon, "warning"), "Warning message should be visible");
is(get_node(addon, "warning").textContent, "Test add-on 4 is known to cause security or stability issues.", "Warning message should be correct");
is_element_visible(get_node(addon, "warning-link"), "Warning link should be visible");
is(get_node(addon, "warning-link").value, "More Information", "Warning link text should be correct");
is(get_node(addon, "warning-link").href, "http://example.com/addon4@tests.mozilla.org", "Warning link should be correct");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
info("Addon 6");
addon = items["Test add-on 6"];
let addon = items["Test add-on 6"];
addon.parentNode.ensureElementIsVisible(addon);
({ name, version } = await get_tooltip_info(addon));
let { name } = await get_tooltip_info(addon);
is(get_node(addon, "name").value, "Test add-on 6", "Name should be correct");
is(name, "Test add-on 6", "Tooltip name should be correct");
is_element_visible(get_class_node(addon, "disabled-postfix"), "Disabled postfix should be visible");
@ -631,52 +354,6 @@ add_task(async function() {
is_element_hidden(get_node(addon, "error"), "Error message should be visible");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
info("Addon 7");
addon = items["Test add-on 7"];
addon.parentNode.ensureElementIsVisible(addon);
({ name, version } = await get_tooltip_info(addon));
is(get_node(addon, "name").value, "Test add-on 7", "Name should be correct");
is(name, "Test add-on 7", "Tooltip name should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_visible(get_node(addon, "enable-btn"), "Enable button should be visible");
is_element_hidden(get_node(addon, "disable-btn"), "Disable button should be hidden");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_hidden(get_node(addon, "warning"), "Warning message should be visible");
is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_visible(get_node(addon, "pending"), "Pending message should be visible");
is(get_node(addon, "pending").textContent, "Test add-on 7 will be disabled after you restart " + gApp + ".", "Pending message should be correct");
info("Undoing");
EventUtils.synthesizeMouseAtCenter(get_node(addon, "undo-btn"), {}, gManagerWindow);
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_visible(get_node(addon, "warning"), "Warning message should be hidden");
is(get_node(addon, "warning").textContent, "An important update is available for Test add-on 7.", "Warning message should be correct");
is_element_visible(get_node(addon, "warning-link"), "Warning link should be visible");
is(get_node(addon, "warning-link").value, "Update Now", "Warning link text should be correct");
is(get_node(addon, "warning-link").href, "http://example.com/addon7@tests.mozilla.org", "Warning link should be correct");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
});
// Check the add-ons are now in the right state
add_task(async function() {
let [a1, a2, a4] = await promiseAddonsByIDs(["addon1@tests.mozilla.org",
"addon2@tests.mozilla.org",
"addon4@tests.mozilla.org"]);
is(a1.pendingOperations, 0, "Add-on 1 should not have any pending operations");
is(a2.pendingOperations, 0, "Add-on 1 should not have any pending operations");
is(a4.pendingOperations, 0, "Add-on 1 should not have any pending operations");
});
// Check that upgrades with onExternalInstall take effect immediately
@ -738,6 +415,7 @@ add_task(async function() {
Services.prefs.setBoolPref("accessibility.tabfocus_applies_to_xul", false);
let items = get_test_items();
is(Object.keys(items).length, EXPECTED_ADDONS, "Should be the right number of add-ons installed");
let addon = items["Test add-on 6"];
addon.parentNode.ensureElementIsVisible(addon);

View File

@ -44,6 +44,7 @@ add_test(function() {
name: "manually updating addon",
version: "1.0",
isCompatible: false,
operationsRequiringRestart: 0,
blocklistState: Ci.nsIBlocklistService.STATE_BLOCKED,
applyBackgroundUpdates: AddonManager.AUTOUPDATE_DISABLE
}]);
@ -177,7 +178,7 @@ add_test(function() {
info("Install started");
is_element_visible(item._installStatus, "Install progress widget should be visible");
},
onInstallEnded() {
onInstallEnded(...args) {
install.removeTestListener(this);
info("Install ended");
is_element_hidden(item._installStatus, "Install progress widget should be hidden");

View File

@ -14,11 +14,6 @@ function test() {
gProvider = new MockProvider();
gProvider.createAddons([{
id: "addon1@tests.mozilla.org",
name: "Uninstall needs restart",
type: "extension",
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_UNINSTALL
}, {
id: "addon2@tests.mozilla.org",
name: "Uninstall doesn't need restart 1",
type: "extension",
@ -86,56 +81,6 @@ function get_item_in_list(aId, aList) {
return null;
}
// Tests that uninstalling a normal add-on from the list view can be undone
add_test(function() {
var ID = "addon1@tests.mozilla.org";
var list = gDocument.getElementById("addon-list");
// Select the extensions category
gCategoryUtilities.openType("extension", function() {
is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
AddonManager.getAddonByID(ID, function(aAddon) {
ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
ok(aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL, "Add-on should require a restart to uninstall");
var item = get_item_in_list(ID, list);
isnot(item, null, "Should have found the add-on in the list");
var button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
isnot(button, null, "Should have a remove button");
ok(!button.disabled, "Button should not be disabled");
EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
// Force XBL to apply
item.clientTop;
is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
ok(!!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should be pending uninstall");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "restart-btn");
isnot(button, null, "Should have a restart button");
ok(!button.hidden, "Restart button should not be hidden");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
isnot(button, null, "Should have an undo button");
EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
// Force XBL to apply
item.clientTop;
ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
isnot(button, null, "Should have a remove button");
ok(!button.disabled, "Button should not be disabled");
run_next_test();
});
});
});
// Tests that uninstalling a restartless add-on from the list view can be undone
add_test(function() {
var ID = "addon2@tests.mozilla.org";
@ -167,9 +112,6 @@ add_test(function() {
ok(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL, "Add-on should be pending uninstall");
ok(!aAddon.isActive, "Add-on should be inactive");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "restart-btn");
isnot(button, null, "Should have a restart button");
ok(button.hidden, "Restart button should be hidden");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
isnot(button, null, "Should have an undo button");
@ -222,9 +164,6 @@ add_test(function() {
ok(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL, "Add-on should be pending uninstall");
ok(!aAddon.isActive, "Add-on should be inactive");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "restart-btn");
isnot(button, null, "Should have a restart button");
ok(button.hidden, "Restart button should be hidden");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
isnot(button, null, "Should have an undo button");
@ -246,69 +185,6 @@ add_test(function() {
});
});
// Tests that uninstalling a normal add-on from the details view switches back
// to the list view and can be undone
add_test(function() {
var ID = "addon1@tests.mozilla.org";
var list = gDocument.getElementById("addon-list");
// Select the extensions category
gCategoryUtilities.openType("extension", function() {
is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
AddonManager.getAddonByID(ID, function(aAddon) {
ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
ok(aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL, "Add-on should require a restart to uninstall");
var item = get_item_in_list(ID, list);
isnot(item, null, "Should have found the add-on in the list");
EventUtils.synthesizeMouseAtCenter(item, { clickCount: 1 }, gManagerWindow);
EventUtils.synthesizeMouseAtCenter(item, { clickCount: 2 }, gManagerWindow);
wait_for_view_load(gManagerWindow, function() {
is(get_current_view(gManagerWindow).id, "detail-view", "Should be in the detail view");
var button = gDocument.getElementById("detail-uninstall-btn");
isnot(button, null, "Should have a remove button");
ok(!button.disabled, "Button should not be disabled");
EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
wait_for_view_load(gManagerWindow, function() {
is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
var item = get_item_in_list(ID, list);
isnot(item, null, "Should have found the add-on in the list");
is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
ok(!!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should be pending uninstall");
// Force XBL to apply
item.clientTop;
var button = gDocument.getAnonymousElementByAttribute(item, "anonid", "restart-btn");
isnot(button, null, "Should have a restart button");
ok(!button.hidden, "Restart button should not be hidden");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
isnot(button, null, "Should have an undo button");
EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
// Force XBL to apply
item.clientTop;
ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
isnot(button, null, "Should have a remove button");
ok(!button.disabled, "Button should not be disabled");
run_next_test();
});
});
});
});
});
// Tests that uninstalling a restartless add-on from the details view switches
// back to the list view and can be undone
add_test(function() {
@ -351,9 +227,6 @@ add_test(function() {
// Force XBL to apply
item.clientTop;
var button = gDocument.getAnonymousElementByAttribute(item, "anonid", "restart-btn");
isnot(button, null, "Should have a restart button");
ok(button.hidden, "Restart button should be hidden");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
isnot(button, null, "Should have an undo button");
@ -418,9 +291,6 @@ add_test(function() {
// Force XBL to apply
item.clientTop;
var button = gDocument.getAnonymousElementByAttribute(item, "anonid", "restart-btn");
isnot(button, null, "Should have a restart button");
ok(button.hidden, "Restart button should be hidden");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
isnot(button, null, "Should have an undo button");
@ -444,74 +314,6 @@ add_test(function() {
});
});
// Tests that a normal add-on pending uninstall shows up in the list view
add_test(function() {
var ID = "addon1@tests.mozilla.org";
var list = gDocument.getElementById("addon-list");
// Select the extensions category
gCategoryUtilities.openType("extension", function() {
is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
AddonManager.getAddonByID(ID, function(aAddon) {
ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
ok(aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL, "Add-on should require a restart to uninstall");
var item = get_item_in_list(ID, list);
isnot(item, null, "Should have found the add-on in the list");
var button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
isnot(button, null, "Should have a remove button");
ok(!button.disabled, "Button should not be disabled");
EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
// Force XBL to apply
item.clientTop;
is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
ok(!!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should be pending uninstall");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "restart-btn");
isnot(button, null, "Should have a restart button");
ok(!button.hidden, "Restart button should not be hidden");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
isnot(button, null, "Should have an undo button");
gCategoryUtilities.openType("plugin", function() {
is(gCategoryUtilities.selectedCategory, "plugin", "View should have changed to plugin");
gCategoryUtilities.openType("extension", function() {
is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
var item = get_item_in_list(ID, list);
isnot(item, null, "Should have found the add-on in the list");
is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
ok(!!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should be pending uninstall");
var button = gDocument.getAnonymousElementByAttribute(item, "anonid", "restart-btn");
isnot(button, null, "Should have a restart button");
ok(!button.hidden, "Restart button should not be hidden");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
isnot(button, null, "Should have an undo button");
EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
// Force XBL to apply
item.clientTop;
ok(!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should not be pending uninstall");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
isnot(button, null, "Should have a remove button");
ok(!button.disabled, "Button should not be disabled");
run_next_test();
});
});
});
});
});
// Tests that switching away from the list view finalises the uninstall of
// multiple restartless add-ons
add_test(function() {
@ -544,9 +346,6 @@ add_test(function() {
ok(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL, "Add-on should be pending uninstall");
ok(!aAddon.isActive, "Add-on should be inactive");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "restart-btn");
isnot(button, null, "Should have a restart button");
ok(button.hidden, "Restart button should be hidden");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
isnot(button, null, "Should have an undo button");
@ -615,9 +414,6 @@ add_test(function() {
ok(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL, "Add-on should be pending uninstall");
ok(!aAddon.isActive, "Add-on should be inactive");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "restart-btn");
isnot(button, null, "Should have a restart button");
ok(button.hidden, "Restart button should be hidden");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
isnot(button, null, "Should have an undo button");

View File

@ -8,8 +8,6 @@ var gProvider;
var gManagerWindow;
var gCategoryUtilities;
var gApp = document.getElementById("bundle_brand").getString("brandShortName");
function test() {
waitForExplicitFinish();
@ -65,20 +63,3 @@ add_test(function() {
});
});
});
add_test(function() {
var item = get_addon_element(gManagerWindow, "addon1@tests.mozilla.org");
var update = gManagerWindow.document.getAnonymousElementByAttribute(item, "anonid", "update-btn");
EventUtils.synthesizeMouseAtCenter(update, { }, gManagerWindow);
var pending = gManagerWindow.document.getAnonymousElementByAttribute(item, "anonid", "pending");
is_element_visible(pending, "Pending message should be visible");
is(pending.textContent,
get_string("notification.upgrade", "manually updating addon", gApp),
"Pending message should be correct");
item = get_addon_element(gManagerWindow, "addon2@tests.mozilla.org");
is(item, null, "Should not show the new version in the list");
run_next_test();
});

View File

@ -14,7 +14,6 @@ async function getListenerEvents(browser) {
return result.split("\n").map(JSON.parse);
}
const RESTART_ID = "restart@tests.mozilla.org";
const RESTART_DISABLED_ID = "restart_disabled@tests.mozilla.org";
const RESTARTLESS_ID = "restartless@tests.mozilla.org";
const INSTALL_ID = "install@tests.mozilla.org";
@ -22,10 +21,6 @@ const CANCEL_ID = "cancel@tests.mozilla.org";
let provider = new MockProvider(false);
provider.createAddons([
{
id: RESTART_ID,
name: "Add-on that requires restart",
},
{
id: RESTART_DISABLED_ID,
name: "Disabled add-on that requires restart",
@ -42,26 +37,6 @@ provider.createAddons([
},
]);
// Test disable of add-on requiring restart
add_task(async function test_disable() {
await BrowserTestUtils.withNewTab(TESTPAGE, async function(browser) {
let addon = await promiseAddonByID(RESTART_ID);
is(addon.userDisabled, false, "addon is enabled");
// disable it
addon.userDisabled = true;
is(addon.userDisabled, true, "addon was disabled successfully");
let events = await getListenerEvents(browser);
// Just a single onDisabling since restart is needed to complete
let expected = [
{id: RESTART_ID, needsRestart: true, event: "onDisabling"},
];
Assert.deepEqual(events, expected, "Got expected disable event");
});
});
// Test enable of add-on requiring restart
add_task(async function test_enable() {
await BrowserTestUtils.withNewTab(TESTPAGE, async function(browser) {