diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-07-18 08:24:24 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-07-18 08:24:24 +0200 |
commit | fc61780b35af913801d72086456f493f63197da6 (patch) | |
tree | f85891288a7bd988da9f0f15ae64e5c63f00d493 /toolkit/mozapps/extensions/test/browser/browser_bug593535.js | |
parent | 69f7f9e5f1475891ce11cc4f431692f965b0cd30 (diff) | |
parent | 50d3e596bbe89c95615f96eb71f6bc5be737a1db (diff) | |
download | UXP-2018.07.18.tar UXP-2018.07.18.tar.gz UXP-2018.07.18.tar.lz UXP-2018.07.18.tar.xz UXP-2018.07.18.zip |
Merge commit '50d3e596bbe89c95615f96eb71f6bc5be737a1db' into Basilisk-releasev2018.07.18
# Conflicts:
# browser/app/profile/firefox.js
# browser/components/preferences/jar.mn
Diffstat (limited to 'toolkit/mozapps/extensions/test/browser/browser_bug593535.js')
-rw-r--r-- | toolkit/mozapps/extensions/test/browser/browser_bug593535.js | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/toolkit/mozapps/extensions/test/browser/browser_bug593535.js b/toolkit/mozapps/extensions/test/browser/browser_bug593535.js deleted file mode 100644 index a78ef9a23..000000000 --- a/toolkit/mozapps/extensions/test/browser/browser_bug593535.js +++ /dev/null @@ -1,118 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Bug 593535 - Failure to download extension causes about:addons to list the -// addon with no way to restart the download - -const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url"; -const SEARCH_URL = TESTROOT + "browser_bug593535.xml"; -const QUERY = "NOTFOUND"; - -var gProvider; - -function test() { - waitForExplicitFinish(); - - // Turn on searching for this test - Services.prefs.setIntPref(PREF_SEARCH_MAXRESULTS, 15); - - open_manager("addons://list/extension", function(aWindow) { - gManagerWindow = aWindow; - run_next_test(); - }); -} - -function end_test() { - close_manager(gManagerWindow, function() { - AddonManager.getAllInstalls(function(aInstallsList) { - for (var install of aInstallsList) { - var sourceURI = install.sourceURI.spec; - if (sourceURI.match(/^http:\/\/example\.com\/(.+)\.xpi$/) != null) - install.cancel(); - } - - finish(); - }); - }); -} - -function search(aQuery, aCallback) { - // Point search to the correct xml test file - Services.prefs.setCharPref(PREF_GETADDONS_GETSEARCHRESULTS, SEARCH_URL); - - var searchBox = gManagerWindow.document.getElementById("header-search"); - searchBox.value = aQuery; - - EventUtils.synthesizeMouseAtCenter(searchBox, { }, gManagerWindow); - EventUtils.synthesizeKey("VK_RETURN", { }, gManagerWindow); - - wait_for_view_load(gManagerWindow, function() { - var remoteFilter = gManagerWindow.document.getElementById("search-filter-remote"); - EventUtils.synthesizeMouseAtCenter(remoteFilter, { }, gManagerWindow); - - aCallback(); - }); -} - -function get_addon_item(aName) { - var id = aName + "@tests.mozilla.org"; - var list = gManagerWindow.document.getElementById("search-list"); - var rows = list.getElementsByTagName("richlistitem"); - for (let row of rows) { - if (row.mAddon && row.mAddon.id == id) - return row; - } - - return null; -} - -function get_install_button(aItem) { - isnot(aItem, null, "Item should not be null when checking state of install button"); - var installStatus = getAnonymousElementByAttribute(aItem, "anonid", "install-status"); - return getAnonymousElementByAttribute(installStatus, "anonid", "install-remote-btn"); -} - - -function getAnonymousElementByAttribute(aElement, aName, aValue) { - return gManagerWindow.document.getAnonymousElementByAttribute(aElement, - aName, - aValue); -} - - - -// Tests that a failed install for a remote add-on will ask to retry the install -add_test(function() { - var remoteItem; - - var listener = { - onDownloadFailed: function(aInstall) { - aInstall.removeListener(this); - ok(true, "Install failed as expected"); - - executeSoon(function() { - is(remoteItem.getAttribute("notification"), "warning", "Item should have notification attribute set to 'warning'"); - is_element_visible(remoteItem._warning, "Warning text should be visible"); - is(remoteItem._warning.textContent, "There was an error downloading NOTFOUND.", "Warning should show correct message"); - is_element_visible(remoteItem._warningLink, "Retry button should be visible"); - run_next_test(); - }); - }, - - onInstallEnded: function() { - ok(false, "Install should have failed"); - } - } - - search(QUERY, function() { - var list = gManagerWindow.document.getElementById("search-list"); - remoteItem = get_addon_item("notfound1"); - list.ensureElementIsVisible(remoteItem); - - remoteItem.mAddon.install.addListener(listener); - - var installBtn = get_install_button(remoteItem); - EventUtils.synthesizeMouseAtCenter(installBtn, { }, gManagerWindow); - }); -}); |