зеркало из https://github.com/mozilla/pjs.git
Bug 608316: Cancelling an uninstall while onUninstalling events are still being sent can leave the UI confused. r=Unfocused, a=blocks-final
This commit is contained in:
Родитель
c1db4da3bd
Коммит
d0155c52a2
|
@ -1354,7 +1354,6 @@
|
|||
this.mAddon.userDisabled = true;
|
||||
|
||||
// This won't update any other add-on manager views (bug 582002)
|
||||
this.setAttribute("restartrequired", false);
|
||||
this.setAttribute("pending", "uninstall");
|
||||
} else {
|
||||
this.mAddon.uninstall();
|
||||
|
@ -1418,8 +1417,7 @@
|
|||
<method name="onUninstalling">
|
||||
<parameter name="aRestartRequired"/>
|
||||
<body><![CDATA[
|
||||
this.setAttribute("restartrequired", aRestartRequired);
|
||||
this.setAttribute("pending", "uninstall");
|
||||
this._updateState();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
@ -1569,7 +1567,6 @@
|
|||
else if (this.getAttribute("wasDisabled") != "true")
|
||||
this.mAddon.userDisabled = false;
|
||||
|
||||
this.removeAttribute("restartrequired");
|
||||
this.removeAttribute("pending");
|
||||
]]></body>
|
||||
</method>
|
||||
|
@ -1598,7 +1595,6 @@
|
|||
if (!aNeedsRestart)
|
||||
this.mAddon = aAddon;
|
||||
|
||||
this.removeAttribute("restartrequired");
|
||||
this.removeAttribute("pending");
|
||||
]]></body>
|
||||
</method>
|
||||
|
@ -1621,7 +1617,6 @@
|
|||
if (!(aAddon.pendingOperations & AddonManager.PENDING_INSTALL))
|
||||
this.mAddon = aAddon;
|
||||
|
||||
this.removeAttribute("restartrequired");
|
||||
this.removeAttribute("pending");
|
||||
]]></body>
|
||||
</method>
|
||||
|
|
|
@ -60,6 +60,7 @@ _MAIN_TEST_FILES = \
|
|||
browser_bug587970.js \
|
||||
browser_bug591465.js \
|
||||
browser_bug596336.js \
|
||||
browser_bug608316.js \
|
||||
browser_details.js \
|
||||
browser_discovery.js \
|
||||
browser_dragdrop.js \
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/* 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: function(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();
|
||||
});
|
||||
});
|
||||
});
|
Загрузка…
Ссылка в новой задаче