--- a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties
+++ b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties
@@ -37,26 +37,18 @@ notification.softblocked.link=More Infor
notification.outdated=An important update is available for %1$S.
notification.outdated.link=Update Now
#LOCALIZATION NOTE (notification.vulnerableUpdatable) %1$S is the add-on name
notification.vulnerableUpdatable=%1$S is known to be vulnerable and should be updated.
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
notification.downloadError.retry.tooltip=Try downloading this add-on again
#LOCALIZATION NOTE (notification.installError) %1$S is the add-on name.
notification.installError=There was an error installing %1$S.
notification.installError.retry=Try again
notification.installError.retry.tooltip=Try downloading and installing this add-on again
@@ -66,18 +58,16 @@ notification.gmpPending=%1$S will be ins
#LOCALIZATION NOTE (contributionAmount2) %S is the currency amount recommended for contributions
contributionAmount2=Suggested Contribution: %S
installDownloading=Downloading
installDownloaded=Downloaded
installDownloadFailed=Error downloading
installVerifying=Verifying
installInstalling=Installing
-installEnablePending=Restart to enable
-installDisablePending=Restart to disable
installFailed=Error installing
installCancelled=Install cancelled
#LOCALIZATION NOTE (details.notification.incompatible) %1$S is the add-on name, %2$S is brand name, %3$S is application version
details.notification.incompatible=%1$S is incompatible with %2$S %3$S.
#LOCALIZATION NOTE (details.notification.unsigned, details.notification.unsignedAndDisabled) %1$S is the add-on name, %2$S is brand name
details.notification.unsignedAndDisabled=%1$S could not be verified for use in %2$S and has been disabled.
details.notification.unsigned=%1$S could not be verified for use in %2$S. Proceed with caution.
@@ -92,26 +82,18 @@ details.notification.softblocked.link=Mo
details.notification.outdated=An important update is available for %1$S.
details.notification.outdated.link=Update Now
#LOCALIZATION NOTE (details.notification.vulnerableUpdatable) %1$S is the add-on name
details.notification.vulnerableUpdatable=%1$S is known to be vulnerable and should be updated.
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.
# LOCALIZATION NOTE (details.experiment.time.daysRemaining):
# Semicolon-separated list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# #1 is the number of days from now that the experiment will remain active (detail view).
details.experiment.time.daysRemaining=#1 day remaining;#1 days remaining
@@ -147,21 +129,18 @@ experiment.time.endedToday=Less than a d
experiment.state.active=Active
#LOCALIZATION NOTE (experiment.state.complete) This experiment is complete (it was previously active) (list view item).
experiment.state.complete=Complete
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:
type.extension.name=Extensions
type.themes.name=Themes
type.locale.name=Languages
type.plugin.name=Plugins
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -925,32 +925,16 @@ var gViewController = {
cmd_focusSearch: {
isEnabled: () => true,
doCommand() {
gHeader.focusSearchBox();
}
},
- 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;
},
doCommand() {
AddonManager.checkCompatibility = true;
}
},
@@ -1045,17 +1029,16 @@ var gViewController = {
gViewController.updateCommand("cmd_findAllUpdates");
document.getElementById("updates-noneFound").hidden = true;
document.getElementById("updates-progress").hidden = false;
document.getElementById("updates-manualUpdatesFound-btn").hidden = true;
var pendingChecks = 0;
var numUpdated = 0;
var numManualUpdates = 0;
- var restartNeeded = false;
let updateStatus = () => {
if (pendingChecks > 0)
return;
this.inProgress = false;
gViewController.updateCommand("cmd_findAllUpdates");
document.getElementById("updates-progress").hidden = true;
@@ -1068,22 +1051,17 @@ var gViewController = {
return;
}
if (numUpdated == 0) {
document.getElementById("updates-noneFound").hidden = false;
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 = {
onDownloadFailed() {
pendingChecks--;
updateStatus();
},
onInstallCancelled() {
@@ -1092,18 +1070,16 @@ var gViewController = {
},
onInstallFailed() {
pendingChecks--;
updateStatus();
},
onInstallEnded(aInstall, aAddon) {
pendingChecks--;
numUpdated++;
- if (isPending(aInstall.existingAddon, "upgrade"))
- restartNeeded = true;
updateStatus();
}
};
var updateCheckListener = {
onUpdateAvailable(aAddon, aInstall) {
gEventManager.delegateAddonEvent("onUpdateAvailable",
[aAddon, aInstall]);
@@ -1230,18 +1206,16 @@ var gViewController = {
return;
}
}
aAddon.userDisabled = false;
},
getTooltip(aAddon) {
if (!aAddon)
return "";
- if (aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_ENABLE)
- return gStrings.ext.GetStringFromName("enableAddonRestartRequiredTooltip");
return gStrings.ext.GetStringFromName("enableAddonTooltip");
}
},
cmd_disableItem: {
isEnabled(aAddon) {
if (!aAddon)
return false;
@@ -1250,18 +1224,16 @@ var gViewController = {
hasPermission(aAddon, "disable"));
},
doCommand(aAddon) {
aAddon.userDisabled = true;
},
getTooltip(aAddon) {
if (!aAddon)
return "";
- if (aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_DISABLE)
- return gStrings.ext.GetStringFromName("disableAddonRestartRequiredTooltip");
return gStrings.ext.GetStringFromName("disableAddonTooltip");
}
},
cmd_installItem: {
isEnabled(aAddon) {
if (!aAddon)
return false;
@@ -1293,18 +1265,16 @@ var gViewController = {
gViewController.popState(function() {
gViewController.currentViewObj.getListItemForID(aAddon.id).uninstall();
});
},
getTooltip(aAddon) {
if (!aAddon)
return "";
- if (aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL)
- return gStrings.ext.GetStringFromName("uninstallAddonRestartRequiredTooltip");
return gStrings.ext.GetStringFromName("uninstallAddonTooltip");
}
},
cmd_cancelUninstallItem: {
isEnabled(aAddon) {
if (!aAddon)
return false;
@@ -1364,26 +1334,18 @@ var gViewController = {
cmd_cancelOperation: {
isEnabled(aAddon) {
if (!aAddon)
return false;
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;
}
}
},
cmd_contribute: {
isEnabled(aAddon) {
if (!aAddon)
return false;
@@ -1777,18 +1739,17 @@ function getAddonsAndInstalls(aType, aCa
}
function doPendingUninstalls(aListBox) {
// Uninstalling add-ons can mutate the list so find the add-ons first then
// uninstall them
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;
}
for (let addon of items)
addon.uninstall();
}
@@ -1917,17 +1878,17 @@ var gCategories = {
onInstallStarted(aInstall) {
this._maybeShowCategory(aInstall);
},
onInstallEnded(aInstall, aAddon) {
this._maybeShowCategory(aAddon);
},
- onExternalInstall(aAddon, aExistingAddon, aRequiresRestart) {
+ onExternalInstall(aAddon, aExistingAddon) {
this._maybeShowCategory(aAddon);
},
_maybeShowCategory: aAddon => {
if (aType.id == aAddon.type) {
this.get(aViewId).hidden = false;
Services.prefs.setBoolPref(prefName, false);
gEventManager.unregisterInstallListener(this);
@@ -2581,17 +2542,17 @@ var gListView = {
this._emptyNotice.hidden = !aShow;
this._listBox.hidden = aShow;
},
onSortChanged(aSortBy, aAscending) {
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;
if (aAddon.hidden)
return;
this.addItem(aAddon);
@@ -2973,32 +2934,25 @@ var gDetailView = {
Services.prefs.savePrefFile(null);
}
},
updateState() {
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");
if (this._addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) {
this.node.setAttribute("notification", "error");
document.getElementById("detail-error").textContent = gStrings.ext.formatStringFromName(
"details.notification.blocked",
[this._addon.name], 1
@@ -3322,19 +3276,19 @@ var gDetailView = {
this.updateState();
},
onEnabled() {
this.updateState();
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);
}
},
onDisabled() {
this.updateState();
@@ -3361,25 +3315,22 @@ var gDetailView = {
}
if (aProperties.includes("appDisabled") ||
aProperties.includes("signedState") ||
aProperties.includes("userDisabled"))
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) {
if (aInstall.addon.id == this._addon.id)
gViewController.popState();
}
};
--- a/toolkit/mozapps/extensions/content/extensions.xml
+++ b/toolkit/mozapps/extensions/content/extensions.xml
@@ -462,20 +462,16 @@
</field>
<field name="_progress">
document.getAnonymousElementByAttribute(this, "anonid", "progress");
</field>
<field name="_installRemote">
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");
</field>
<method name="initWithInstall">
<parameter name="aInstall"/>
<body><![CDATA[
@@ -596,29 +592,16 @@
};
Services.obs.notifyObservers(subject, "webextension-permission-prompt");
});
}
this.mInstall.install();
]]></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();
]]></body>
</method>
<method name="onDownloadEnded">
<body><![CDATA[
@@ -679,24 +662,16 @@
<method name="hasPermission">
<parameter name="aPerm"/>
<body><![CDATA[
var perm = AddonManager["PERM_CAN_" + aPerm.toUpperCase()];
return !!(this.mAddon.permissions & perm);
]]></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[
var action = AddonManager["PENDING_" + aAction.toUpperCase()];
return !!(this.mAddon.pendingOperations & action);
]]></body>
</method>
@@ -737,19 +712,16 @@
<xul:label anonid="error" flex="1"/>
<xul:label anonid="error-link" class="text-link" hidden="true"/>
<xul:spacer flex="5000"/> <!-- Necessary to allow the message to wrap -->
</xul:hbox>
<xul:hbox anonid="pending-container"
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;"
oncommand="document.getBindingParent(this).undo();"/>
<xul:spacer flex="5000"/> <!-- Necessary to allow the message to wrap -->
</xul:hbox>
<xul:hbox class="content-container" align="center">
@@ -1145,32 +1117,25 @@
</method>
<method name="_updateState">
<body><![CDATA[
if (this.parentNode.selectedItem == this)
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");
var isUpgrade = this.hasAttribute("upgrade");
var install = this._installStatus.mInstall;
if (install && install.state == AddonManager.STATE_DOWNLOAD_FAILED) {
this.setAttribute("notification", "warning");
@@ -1479,45 +1444,38 @@
var uri = this.mManualUpdate ?
this.mManualUpdate.releaseNotesURI :
this.mAddon.releaseNotesURI;
this._fetchReleaseNotes(uri);
}
]]></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);
]]></body>
</method>
<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
// _updateState which will clear any pending attribute set.
this.mAddon.userDisabled = true;
// This won't update any other add-on manager views (bug 582002)
this.setAttribute("pending", "uninstall");
- } else {
- this.mAddon.uninstall(true);
}
]]></body>
</method>
<method name="showPreferences">
<body><![CDATA[
gViewController.doCommand("cmd_showItemPreferences", this.mAddon);
]]></body>
@@ -1587,17 +1545,16 @@
<method name="onDisabled">
<body><![CDATA[
this._updateState();
]]></body>
</method>
<method name="onUninstalling">
- <parameter name="aRestartRequired"/>
<body><![CDATA[
this._updateState();
]]></body>
</method>
<method name="onOperationCancelled">
<body><![CDATA[
this._updateState();
@@ -1630,27 +1587,21 @@
<body><![CDATA[
this._updateState();
]]></body>
</method>
<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>
<method name="onNewInstall">
<parameter name="aInstall"/>
<body><![CDATA[
if (this.mAddon.applyBackgroundUpdates == AddonManager.AUTOUPDATE_ENABLE)
return;
@@ -1680,22 +1631,17 @@
this._installStatus.initWithInstall(aInstall);
]]></body>
</method>
<method name="onInstallEnded">
<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>
<method name="onDownloadFailed">
<body><![CDATA[
this._updateState();
]]></body>
</method>
@@ -1735,88 +1681,68 @@
<!-- Addon - uninstalled - An uninstalled addon that can be re-installed. -->
<binding id="addon-uninstalled"
extends="chrome://mozapps/content/extensions/extensions.xml#addon-base">
<content>
<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;"
oncommand="document.getBindingParent(this).cancelUninstall();"/>
<xul:spacer flex="5000"/> <!-- Necessary to allow the message to wrap -->
</xul:hbox>
</content>
<implementation>
<constructor><![CDATA[
this._notice.textContent = gStrings.ext.formatStringFromName("uninstallNotice",
[this.mAddon.name],
1);
- if (!this.opRequiresRestart("uninstall"))
- this._restartBtn.setAttribute("hidden", true);
-
gEventManager.registerAddonListener(this, this.mAddon.id);
]]></constructor>
<destructor><![CDATA[
gEventManager.unregisterAddonListener(this, this.mAddon.id);
]]></destructor>
<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[
// This assumes that disabling does not require a restart when
// uninstalling doesn't. Things will still work if not, the add-on
// will just still be active until finally getting uninstalled.
if (this.isPending("uninstall"))
this.mAddon.cancelUninstall();
else if (this.getAttribute("wasDisabled") != "true")
this.mAddon.userDisabled = false;
this.removeAttribute("pending");
]]></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;
// Make sure any newly installed add-on has the correct disabled state
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>
</method>
<method name="onInstallStarted">
<parameter name="aInstall"/>
<body><![CDATA[
@@ -1825,20 +1751,17 @@
aInstall.addon.userDisabled = this.getAttribute("wasDisabled") == "true";
]]></body>
</method>
<method name="onInstallEnded">
<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>
</method>
</implementation>
</binding>
--- a/toolkit/mozapps/extensions/test/browser/browser.ini
+++ b/toolkit/mozapps/extensions/test/browser/browser.ini
@@ -40,26 +40,24 @@ skip-if = os == 'linux' || os == 'win' #
skip-if = os == 'win' && !debug # Disabled on Windows opt/PGO builds due to intermittent failures (bug 1135866)
[browser_bug562899.js]
skip-if = buildapp == 'mulet'
[browser_bug562992.js]
[browser_bug567127.js]
[browser_bug567137.js]
[browser_bug570760.js]
[browser_bug572561.js]
-[browser_bug573062.js]
[browser_bug577990.js]
[browser_bug580298.js]
[browser_bug586574.js]
[browser_bug587970.js]
[browser_bug591465.js]
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]
[browser_bug590347.js]
[browser_checkAddonCompatibility.js]
[browser_details.js]
[browser_discovery.js]
[browser_dragdrop.js]
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/browser_bug573062.js
+++ /dev/null
@@ -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();
- });
- });
- });
-
- });
-}
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/browser_bug608316.js
+++ /dev/null
@@ -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();
- });
- });
-});
--- a/toolkit/mozapps/extensions/test/browser/browser_details.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_details.js
@@ -103,41 +103,23 @@ function test() {
url: "http://example.com/screenshot",
width: 400,
height: 300,
thumbnailURL: "chrome://branding/content/icon64.png",
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",
name: "Test add-on 5",
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",
name: "Test add-on 8",
blocklistState: Ci.nsIBlocklistService.STATE_OUTDATED
}, {
id: "addon9@tests.mozilla.org",
name: "Test add-on 9",
signedState: AddonManager.SIGNEDSTATE_MISSING,
@@ -172,114 +154,16 @@ function test() {
}
function end_test() {
close_manager(gManagerWindow, function() {
finish();
});
}
-// 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() {
is(get("detail-name").textContent, "Test add-on 2", "Name should be correct");
is_element_visible(get("detail-version"), "Version should not be hidden");
is(get("detail-version").value, "2.2", "Version should be correct");
is(get("detail-icon").src, "chrome://foo/skin/icon.png", "Icon should be correct");
@@ -403,84 +287,16 @@ add_test(function() {
get("detail-screenshot").addEventListener("load", function() {
is(this.hasAttribute("loading"), false, "Screenshot should not have loading attribute");
run_next_test();
}, {once: true});
});
});
-// 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() {
is(get("detail-name").textContent, "Test add-on 5", "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_hidden(get("detail-disable-btn"), "Disable button should be hidden");
@@ -494,206 +310,16 @@ add_test(function() {
is(get("detail-error-link").value, "More Information", "Error link text should be correct");
is(get("detail-error-link").href, "http://example.com/addon5@tests.mozilla.org", "Error link should be correct");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
run_next_test();
});
});
-// 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
add_test(function() {
open_details("addon9@tests.mozilla.org", "extension", function() {
is(get("detail-name").textContent, "Test add-on 9", "Name should be correct");
is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
--- a/toolkit/mozapps/extensions/test/browser/browser_list.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_list.js
@@ -13,17 +13,17 @@ var gProvider;
var gManagerWindow;
var gCategoryUtilities;
var gApp = document.getElementById("bundle_brand").getString("brandShortName");
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",
version: "1",
name: "Bling",
description: "SO MUCH BLING!",
author: "Pixel Pusher",
homepageURL: "http://mochi.test:8888/data/index.html",
@@ -55,40 +55,28 @@ add_task(async function() {
longDescription: " A longer description",
isActive: false,
isCompatible: false,
appDisabled: true,
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",
name: "Test add-on 5",
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",
- blocklistState: Ci.nsIBlocklistService.STATE_OUTDATED,
- }, {
id: "addon8@tests.mozilla.org",
blocklistURL: "http://example.com/addon8@tests.mozilla.org",
name: "Test add-on 8",
blocklistState: Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE,
}, {
id: "addon9@tests.mozilla.org",
blocklistURL: "http://example.com/addon9@tests.mozilla.org",
name: "Test add-on 9",
@@ -150,145 +138,36 @@ function get_class_node(parent, cls) {
// Check that the list appears to have displayed correctly and trigger some
// changes
add_task(async function() {
await gCategoryUtilities.openType("extension");
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");
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_hidden(get_node(addon, "disable-btn"), "Disable button should be hidden");
is_element_hidden(get_node(addon, "remove-btn"), "Remove button should be hidden");
is_element_visible(get_node(addon, "warning"), "Warning message should be visible");
is(get_node(addon, "warning").textContent, "Test add-on 3 is incompatible with " + gApp + " " + gVersion + ".", "Warning message should be correct");
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_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);
({ name, version } = await get_tooltip_info(addon));
is(get_node(addon, "name").value, "Test add-on 5", "Name should be correct");
is(name, "Test add-on 5", "Tooltip name should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
@@ -334,51 +213,16 @@ add_task(async function() {
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 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_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);
({ name, version } = await get_tooltip_info(addon));
is(get_node(addon, "name").value, "Test add-on 8", "Name should be correct");
is(name, "Test add-on 8", "Tooltip name should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
@@ -463,150 +307,29 @@ add_task(async function() {
let showAllButton = gManagerWindow.document.getElementById("show-all-extensions");
let signingInfoUI = gManagerWindow.document.getElementById("disabled-unsigned-addons-info");
is_element_hidden(filterButton, "Button for showing disabled unsigned extensions should be hidden");
is_element_hidden(showAllButton, "Button for showing all extensions should be hidden");
is_element_hidden(signingInfoUI, "Signing info UI 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, 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() {
await gCategoryUtilities.openType("plugin");
await gCategoryUtilities.openType("extension");
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"];
+ info("Addon 6");
+ let addon = items["Test add-on 6"];
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"];
- 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");
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");
@@ -626,62 +349,16 @@ add_task(async function() {
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 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
add_task(async function() {
gProvider.createAddons([{
id: "addon1@tests.mozilla.org",
name: "Test add-on replacement",
version: "2.0",
@@ -733,16 +410,17 @@ add_task(async function() {
return true;
return false;
}
// Ignore the OSX full keyboard access setting
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);
EventUtils.synthesizeMouseAtCenter(addon, { }, gManagerWindow);
is(Services.focus.focusedElement, addon.parentNode, "Focus should have moved to the list");
EventUtils.synthesizeKey("VK_TAB", { }, gManagerWindow);
is(Services.focus.focusedElement, get_node(addon, "details-btn"), "Focus should have moved to the more button");
--- a/toolkit/mozapps/extensions/test/browser/browser_manualupdates.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_manualupdates.js
@@ -39,16 +39,17 @@ add_test(function() {
gAvailableCategory = gManagerWindow.gCategories.get("addons://updates/available");
is(gCategoryUtilities.isVisible(gAvailableCategory), false, "Available Updates category should initially be hidden");
gProvider.createAddons([{
id: "addon2@tests.mozilla.org",
name: "manually updating addon",
version: "1.0",
isCompatible: false,
+ operationsRequiringRestart: 0,
blocklistState: Ci.nsIBlocklistService.STATE_BLOCKED,
applyBackgroundUpdates: AddonManager.AUTOUPDATE_DISABLE
}]);
is(gCategoryUtilities.isVisible(gAvailableCategory), false, "Available Updates category should still be hidden");
run_next_test();
});
@@ -172,17 +173,17 @@ add_test(function() {
is_element_visible(updateBtn, "Update button should be visible");
var install = gProvider.installs[0];
var listener = {
onInstallStarted() {
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");
if (badgeUpdated)
run_next_test();
else
installCompleted = true;
--- a/toolkit/mozapps/extensions/test/browser/browser_uninstalling.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_uninstalling.js
@@ -9,21 +9,16 @@ var gProvider;
function test() {
requestLongerTimeout(2);
waitForExplicitFinish();
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",
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE
}, {
id: "addon3@tests.mozilla.org",
name: "Uninstall doesn't need restart 2",
type: "extension",
@@ -81,66 +76,16 @@ function get_item_in_list(aId, aList) {
aList.ensureElementIsVisible(item);
return item;
}
item = item.nextSibling;
}
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";
var list = gDocument.getElementById("addon-list");
// Select the extensions category
gCategoryUtilities.openType("extension", function() {
is(gCategoryUtilities.selectedCategory, "extension", "View should have changed to extension");
@@ -162,19 +107,16 @@ add_test(function() {
// 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");
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");
EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
// Force XBL to apply
item.clientTop;
@@ -217,19 +159,16 @@ add_test(function() {
// 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");
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");
EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
// Force XBL to apply
item.clientTop;
@@ -241,79 +180,16 @@ add_test(function() {
aAddon.userDisabled = false;
ok(aAddon.isActive, "Add-on should be active");
run_next_test();
});
});
});
-// 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() {
var ID = "addon2@tests.mozilla.org";
var list = gDocument.getElementById("addon-list");
// Select the extensions category
gCategoryUtilities.openType("extension", function() {
@@ -346,19 +222,16 @@ add_test(function() {
is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
ok(!!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should be pending uninstall");
ok(!aAddon.isActive, "Add-on should be inactive");
// 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");
EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
// Force XBL to apply
item.clientTop;
@@ -413,19 +286,16 @@ add_test(function() {
is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
ok(!!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL), "Add-on should be pending uninstall");
ok(!aAddon.isActive, "Add-on should be inactive");
// 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");
EventUtils.synthesizeMouseAtCenter(button, { }, gManagerWindow);
// Force XBL to apply
item.clientTop;
@@ -439,84 +309,16 @@ add_test(function() {
run_next_test();
});
});
});
});
});
-// 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() {
var ID = "addon2@tests.mozilla.org";
var ID2 = "addon6@tests.mozilla.org";
var list = gDocument.getElementById("addon-list");
// Select the extensions category
@@ -539,19 +341,16 @@ add_test(function() {
// 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");
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");
item = get_item_in_list(ID2, list);
isnot(item, null, "Should have found the add-on in the list");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
isnot(button, null, "Should have a remove button");
@@ -610,19 +409,16 @@ add_test(function() {
// 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");
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");
item = get_item_in_list(ID2, list);
isnot(item, null, "Should have found the add-on in the list");
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
isnot(button, null, "Should have a remove button");
--- a/toolkit/mozapps/extensions/test/browser/browser_updateid.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_updateid.js
@@ -60,25 +60,8 @@ add_test(function() {
item = get_addon_element(gManagerWindow, "addon2@tests.mozilla.org");
is(item, null, "Should not show the new version in the list");
run_next_test();
});
});
});
-
-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();
-});
--- a/toolkit/mozapps/extensions/test/browser/browser_webapi_addon_listener.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_webapi_addon_listener.js
@@ -9,64 +9,39 @@ registerCleanupFunction(() => {
async function getListenerEvents(browser) {
let result = await ContentTask.spawn(browser, null, async function() {
return content.document.getElementById("result").textContent;
});
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";
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",
userDisabled: true,
},
{
id: RESTARTLESS_ID,
name: "Restartless add-on",
operationsRequiringRestart: AddonManager.OP_NEED_RESTART_NONE,
},
{
id: CANCEL_ID,
name: "Add-on for uninstall cancel",
},
]);
-// 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) {
let addon = await promiseAddonByID(RESTART_DISABLED_ID);
is(addon.userDisabled, true, "addon is disabled");
// enable it
addon.userDisabled = false;