diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /toolkit/mozapps/extensions/test/browser/browser_bug608316.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/mozapps/extensions/test/browser/browser_bug608316.js')
-rw-r--r-- | toolkit/mozapps/extensions/test/browser/browser_bug608316.js | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/toolkit/mozapps/extensions/test/browser/browser_bug608316.js b/toolkit/mozapps/extensions/test/browser/browser_bug608316.js new file mode 100644 index 000000000..72bb61f49 --- /dev/null +++ b/toolkit/mozapps/extensions/test/browser/browser_bug608316.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(); + }); + }); +}); |