diff --git a/toolkit/mozapps/update/tests/chrome/chrome.ini b/toolkit/mozapps/update/tests/chrome/chrome.ini index 48945ce97dac..61f9a71e40e0 100644 --- a/toolkit/mozapps/update/tests/chrome/chrome.ini +++ b/toolkit/mozapps/update/tests/chrome/chrome.ini @@ -13,31 +13,15 @@ support-files = ; order and not in the order specified in the manifest. [test_0011_check_basic.xul] [test_0012_check_basic_license.xul] -[test_0013_check_incompat_basic.xul] -[test_0014_check_incompat_basic_license.xul] -[test_0015_check_incompat_basic_addons.xul] -[test_0016_check_incompat_basic_license_addons.xul] [test_0017_check_staging_basic.xul] skip-if = asan reason = Bug 1168003 [test_0021_check_billboard.xul] [test_0022_check_billboard_license.xul] -[test_0023_check_incompat_billboard.xul] -[test_0024_check_incompat_billboard_license.xul] -[test_0025_check_incompat_billboard_addons.xul] -[test_0026_check_incompat_billboard_license_addons.xul] [test_0031_available_basic.xul] [test_0032_available_basic_license.xul] -[test_0033_available_incompat_basic.xul] -[test_0034_available_incompat_basic_license.xul] -[test_0035_available_incompat_basic_addons.xul] -[test_0036_available_incompat_basic_license_addons.xul] [test_0041_available_billboard.xul] [test_0042_available_billboard_license.xul] -[test_0043_available_incompat_billboard.xul] -[test_0044_available_incompat_billboard_license.xul] -[test_0045_available_incompat_billboard_addons.xul] -[test_0046_available_incompat_billboard_license_addons.xul] [test_0051_check_error_xml_malformed.xul] [test_0052_check_no_updates.xul] [test_0053_check_billboard_license_noAttr.xul] @@ -72,8 +56,6 @@ reason = Bug 1168003 [test_0103_background_restartNotification_stagingService.xul] skip-if = os != 'win' reason = only Windows has the maintenance service. -[test_0104_background_restartNotification_NoIncompatAddons.xul] -[test_0105_background_restartNotification_VersionCompatAddons.xul] [test_0111_neverButton_basic.xul] [test_0112_neverButton_billboard.xul] [test_0113_showNeverForVersionRemovedWithPref.xul] diff --git a/toolkit/mozapps/update/tests/chrome/test_0013_check_incompat_basic.xul b/toolkit/mozapps/update/tests/chrome/test_0013_check_incompat_basic.xul deleted file mode 100644 index 92164a787a43..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0013_check_incompat_basic.xul +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0014_check_incompat_basic_license.xul b/toolkit/mozapps/update/tests/chrome/test_0014_check_incompat_basic_license.xul deleted file mode 100644 index a0c92e60e09b..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0014_check_incompat_basic_license.xul +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0015_check_incompat_basic_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0015_check_incompat_basic_addons.xul deleted file mode 100644 index c60a0238ce5d..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0015_check_incompat_basic_addons.xul +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0016_check_incompat_basic_license_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0016_check_incompat_basic_license_addons.xul deleted file mode 100644 index e78323870f19..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0016_check_incompat_basic_license_addons.xul +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0023_check_incompat_billboard.xul b/toolkit/mozapps/update/tests/chrome/test_0023_check_incompat_billboard.xul deleted file mode 100644 index 024231aab914..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0023_check_incompat_billboard.xul +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0024_check_incompat_billboard_license.xul b/toolkit/mozapps/update/tests/chrome/test_0024_check_incompat_billboard_license.xul deleted file mode 100644 index 45297a4b90f5..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0024_check_incompat_billboard_license.xul +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0025_check_incompat_billboard_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0025_check_incompat_billboard_addons.xul deleted file mode 100644 index 6e05c0a60e44..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0025_check_incompat_billboard_addons.xul +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0026_check_incompat_billboard_license_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0026_check_incompat_billboard_license_addons.xul deleted file mode 100644 index b3d011901125..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0026_check_incompat_billboard_license_addons.xul +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0033_available_incompat_basic.xul b/toolkit/mozapps/update/tests/chrome/test_0033_available_incompat_basic.xul deleted file mode 100644 index 1e938e0a7b5d..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0033_available_incompat_basic.xul +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0034_available_incompat_basic_license.xul b/toolkit/mozapps/update/tests/chrome/test_0034_available_incompat_basic_license.xul deleted file mode 100644 index 5b80697bcc69..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0034_available_incompat_basic_license.xul +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0035_available_incompat_basic_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0035_available_incompat_basic_addons.xul deleted file mode 100644 index 3a7b89b87e4f..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0035_available_incompat_basic_addons.xul +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0036_available_incompat_basic_license_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0036_available_incompat_basic_license_addons.xul deleted file mode 100644 index c1cf4b3137c2..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0036_available_incompat_basic_license_addons.xul +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0043_available_incompat_billboard.xul b/toolkit/mozapps/update/tests/chrome/test_0043_available_incompat_billboard.xul deleted file mode 100644 index 236f860c9142..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0043_available_incompat_billboard.xul +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0044_available_incompat_billboard_license.xul b/toolkit/mozapps/update/tests/chrome/test_0044_available_incompat_billboard_license.xul deleted file mode 100644 index 10722a15d9a8..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0044_available_incompat_billboard_license.xul +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0045_available_incompat_billboard_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0045_available_incompat_billboard_addons.xul deleted file mode 100644 index c82e91e95ba9..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0045_available_incompat_billboard_addons.xul +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0046_available_incompat_billboard_license_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0046_available_incompat_billboard_license_addons.xul deleted file mode 100644 index 90e280a9f027..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0046_available_incompat_billboard_license_addons.xul +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0104_background_restartNotification_NoIncompatAddons.xul b/toolkit/mozapps/update/tests/chrome/test_0104_background_restartNotification_NoIncompatAddons.xul deleted file mode 100644 index 979df6db1059..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0104_background_restartNotification_NoIncompatAddons.xul +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_0105_background_restartNotification_VersionCompatAddons.xul b/toolkit/mozapps/update/tests/chrome/test_0105_background_restartNotification_VersionCompatAddons.xul deleted file mode 100644 index 6ee7acce2f81..000000000000 --- a/toolkit/mozapps/update/tests/chrome/test_0105_background_restartNotification_VersionCompatAddons.xul +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - -

- -

-
-
diff --git a/toolkit/mozapps/update/tests/chrome/test_9999_cleanup.xul b/toolkit/mozapps/update/tests/chrome/test_9999_cleanup.xul index edf9967dbec6..3af56b2bc117 100644 --- a/toolkit/mozapps/update/tests/chrome/test_9999_cleanup.xul +++ b/toolkit/mozapps/update/tests/chrome/test_9999_cleanup.xul @@ -67,22 +67,7 @@ function runTest() { file.append(FILE_UPDATE_ARCHIVE); ok(!file.exists(), file.path + " should not exist"); - resetAddons(() => { - let addonPrepDir = Services.dirsvc.get(NS_APP_USER_PROFILE_50_DIR, - Ci.nsILocalFile); - addonPrepDir.append(ADDON_PREP_DIR); - // Not being able to remove the directory used to create the test add-ons - // will not adversely affect subsequent tests so wrap it in a try block and - // don't test whether its removal was successful. - try { - removeDirRecursive(addonPrepDir); - } - catch (e) { - logTestInfo("Unable to remove directory. Path: " + addonPrepDir.path + - ", Exception: " + e); - } - cleanupRestoreUpdaterBackup(); - }); + cleanupRestoreUpdaterBackup(); } /** diff --git a/toolkit/mozapps/update/tests/chrome/update.sjs b/toolkit/mozapps/update/tests/chrome/update.sjs index e054384d94f3..01f04bb2389d 100644 --- a/toolkit/mozapps/update/tests/chrome/update.sjs +++ b/toolkit/mozapps/update/tests/chrome/update.sjs @@ -52,11 +52,6 @@ function handleRequest(aRequest, aResponse) { aResponse.setStatusLine(aRequest.httpVersion, statusCode, statusReason); aResponse.setHeader("Cache-Control", "no-cache", false); - if (params.addonID) { - aResponse.write(getUpdateRDF(params)); - return; - } - // When a mar download is started by the update service it can finish // downloading before the ui has loaded. By specifying a serviceURL for the // update patch that points to this file and has a slowDownloadMar param the @@ -208,65 +203,6 @@ function parseQueryString(aQueryString) { return params; } -/** - * Helper function to gets the string representation of the contents of the - * add-on's update manifest file. - * - * @param aParams - * A JS object representing the url parameters from the request's - * queryString. - * @return A string representation of the contents of the add-on's update - * manifest file. - */ -function getUpdateRDF(aParams) { - let addonVersion; - let maxVersion; - let addonID = aParams.addonID; - let addonUpdateType = addonID.split("_")[0]; - - switch (addonUpdateType) { - case "updatecompatibility": - // Use "1.0" for the add-on version for the compatibility update case since - // the tests create all add-ons with "1.0" for the version. - addonVersion = "1.0"; - maxVersion = aParams.newerPlatformVersion; - break; - case "updateversion": - // Use "2.0" for the add-on version for the version update case since the - // tests create all add-ons with "1.0" for the version. - addonVersion = "2.0"; - maxVersion = aParams.newerPlatformVersion; - break; - default: - addonVersion = "1.0"; - maxVersion = aParams.platformVersion; - } - - return "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " " + addonVersion + "\n" + - " \n" + - " \n" + - " toolkit@mozilla.org\n" + - " 0\n" + - " " + maxVersion + "\n" + - " " + URL_HTTP_UPDATE_SJS + "\n" + - " sha256:0\n" + - " \n" + - " \n" + - " \n" + - "\n"; -} - /** * Reads the binary contents of a file and returns it as a string. * diff --git a/toolkit/mozapps/update/tests/chrome/utils.js b/toolkit/mozapps/update/tests/chrome/utils.js index cb726c80fae7..9f8b793d3a85 100644 --- a/toolkit/mozapps/update/tests/chrome/utils.js +++ b/toolkit/mozapps/update/tests/chrome/utils.js @@ -75,49 +75,6 @@ * For comparing the expected remotecontent state attribute value of the * wizard's billboard and license pages in the checkRemoteContentState and * waitForRemoteContentLoaded functions. - * - * - * Test Add-ons - * - * All tests include the test add-ons specified in the TEST_ADDONS array and - * the only thing that can be configured is whether the noupdate test add-on is - * disabled (see below). The add-on names are in the format of typename_X where - * X is a number to make the add-on ID unique and typename is one of the values - * specified below: - * - * appdisabled - * disabled by the application due to being incompatible with the current - * toolkit version. - * - * compatible - * compatible with the current toolkit version and the update's toolkit - * version. - * - * noupdate - * the add-on is compatible with the current toolkit version and does not have - * an update to make it compatible with the update's toolkit version. Tests - * that need to have all add-ons compatible for the application update can - * disable this add-on by setting the gDisableNoUpdateAddon variable to true. - * - * updatecompatibility - * the add-on is compatible with the current toolkit version and has a - * compatibility update to make it compatible with the update's toolkit - * version. Tests that need to have add-ons compatible for the application - * update without updating the add-on's compatibility information can disable - * this add-on by setting the gDisableUpdateCompatibilityAddon variable to - * true. - * - * updateversion - * the add-on is compatible with the current toolkit version and has a version - * update to make it compatible with the update's toolkit version. Tests that - * need to have add-ons compatible for the application update without updating - * the add-on's to a new version that is compatible can disable this add-on by - * setting the gDisableUpdateVersionAddon variable to true. - * - * userdisabled - * disabled by the user and compatible with the current toolkit version but - * not the update's toolkit version. This add-on will be disabled after its - * install completes. */ 'use strict'; @@ -125,7 +82,6 @@ const { classes: Cc, interfaces: Ci, manager: Cm, results: Cr, utils: Cu } = Components; -Cu.import("resource://gre/modules/AddonManager.jsm", this); Cu.import("resource://gre/modules/Services.jsm", this); const IS_MACOSX = ("nsILocalFileMac" in Ci); @@ -139,11 +95,9 @@ const PAGEID_PLUGIN_UPDATES = "pluginupdatesfound"; const PAGEID_NO_UPDATES_FOUND = "noupdatesfound"; // Done const PAGEID_MANUAL_UPDATE = "manualUpdate"; // Done const PAGEID_UNSUPPORTED = "unsupported"; // Done -const PAGEID_INCOMPAT_CHECK = "incompatibleCheck"; // Done const PAGEID_FOUND_BASIC = "updatesfoundbasic"; // Done const PAGEID_FOUND_BILLBOARD = "updatesfoundbillboard"; // Done const PAGEID_LICENSE = "license"; // Done -const PAGEID_INCOMPAT_LIST = "incompatibleList"; // Done const PAGEID_DOWNLOADING = "downloading"; // Done const PAGEID_ERRORS = "errors"; // Done const PAGEID_ERROR_EXTRA = "errorextra"; // Done @@ -165,23 +119,9 @@ const URL_HTTPS_UPDATE_XML = "https://example.com" + URL_PATH_UPDATE_XML; const URI_UPDATE_PROMPT_DIALOG = "chrome://mozapps/content/update/updates.xul"; -const ADDON_ID_SUFFIX = "@appupdatetest.mozilla.org"; -const ADDON_PREP_DIR = "appupdateprep"; - const PREF_APP_UPDATE_INTERVAL = "app.update.interval"; const PREF_APP_UPDATE_LASTUPDATETIME = "app.update.lastUpdateTime.background-update-timer"; -// Preference for storing add-ons that are disabled by the tests to prevent them -// from interefering with the tests. -const PREF_DISABLEDADDONS = "app.update.test.disabledAddons"; -const PREF_EM_HOTFIX_ID = "extensions.hotfix.id"; -const TEST_ADDONS = [ "appdisabled_1", "appdisabled_2", - "compatible_1", "compatible_2", - "noupdate_1", "noupdate_2", - "updatecompatibility_1", "updatecompatibility_2", - "updateversion_1", "updateversion_2", - "userdisabled_1", "userdisabled_2", "hotfix" ]; - const LOG_FUNCTION = info; const BIN_SUFFIX = (IS_WIN ? ".exe" : ""); @@ -207,15 +147,11 @@ var gAppUpdateServiceEnabled; // app.update.service.enabled var gAppUpdateStagingEnabled; // app.update.staging.enabled var gAppUpdateURLDefault; // app.update.url (default prefbranch) var gAppUpdateURL; // app.update.url.override -var gExtUpdateURL; // extensions.update.url var gTestCounter = -1; var gWin; var gDocElem; var gPrefToCheck; -var gDisableNoUpdateAddon = false; -var gDisableUpdateCompatibilityAddon = false; -var gDisableUpdateVersionAddon = false; var gUseTestUpdater = false; // Set to true to log additional information for debugging. To log additional @@ -275,13 +211,6 @@ this.__defineGetter__("gAcceptDeclineLicense", function() { return gWin.document.getElementById("acceptDeclineLicense"); }); -/** - * The listbox for the incompatibleList page. - */ -this.__defineGetter__("gIncompatibleListbox", function() { - return gWin.document.getElementById("incompatibleListbox"); -}); - /** * Default test run function that can be used by most tests. This function uses * protective measures to prevent the test from failing provided by @@ -334,7 +263,8 @@ function runTestDefaultWaitForWindowClosed() { gEnv.set("MOZ_TEST_SKIP_UPDATE_STAGE", "1"); removeUpdateDirsAndFiles(); reloadUpdateManagerData(); - setupAddons(setupTestUpdater); + setupTimer(gTestTimeout); + SimpleTest.executeSoon(setupTestUpdater); } } @@ -623,7 +553,6 @@ function getExpectedButtonStates() { switch (gTest.pageid) { case PAGEID_CHECKING: - case PAGEID_INCOMPAT_CHECK: return { cancel: { disabled: false, hidden: false } }; case PAGEID_FOUND_BASIC: case PAGEID_FOUND_BILLBOARD: @@ -642,9 +571,6 @@ function getExpectedButtonStates() { } return { extra1: { disabled: false, hidden: false }, next : { disabled: false, hidden: false } }; - case PAGEID_INCOMPAT_LIST: - return { extra1: { disabled: false, hidden: false }, - next : { disabled: false, hidden: false } }; case PAGEID_DOWNLOADING: return { extra1: { disabled: false, hidden: false } }; case PAGEID_NO_UPDATES_FOUND: @@ -770,19 +696,6 @@ function checkRadioGroupSelectedIndex() { gTest.expectedRadioGroupSelectedIndex); } -/** - * Checks that only incompatible add-ons (e.g. noupdate_X add-ons) that don't - * have an update are listed in the add-ons incompatible list. - */ -function checkIncompatbleList() { - for (let i = 0; i < gIncompatibleListbox.itemCount; i++) { - let label = gIncompatibleListbox.getItemAtIndex(i).label; - // Use indexOf since locales can change the text displayed - ok(label.indexOf("noupdate") != -1, "Checking that only incompatible " + - "add-ons that don't have an update are listed in the incompatible list"); - } -} - /** * Compares the return value of prefHasUserValue for the preference specified in * gPrefToCheck with the value passed in the aPrefHasValue parameter or the @@ -1052,19 +965,9 @@ function setupPrefs() { } Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, false); - if (Services.prefs.prefHasUserValue(PREF_EXTENSIONS_UPDATE_URL)) { - gExtUpdateURL = Services.prefs.getCharPref(PREF_EXTENSIONS_UPDATE_URL); - } - let extUpdateUrl = URL_HTTP_UPDATE_XML + "?addonID=%ITEM_ID%" + - "&platformVersion=" + Services.appinfo.platformVersion + - "&newerPlatformVersion=" + getNewerPlatformVersion(); - Services.prefs.setCharPref(PREF_EXTENSIONS_UPDATE_URL, extUpdateUrl); - Services.prefs.setIntPref(PREF_APP_UPDATE_IDLETIME, 0); Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 0); Services.prefs.setBoolPref(PREF_APP_UPDATE_SILENT, false); - Services.prefs.setBoolPref(PREF_EXTENSIONS_STRICT_COMPAT, true); - Services.prefs.setCharPref(PREF_EM_HOTFIX_ID, "hotfix" + ADDON_ID_SUFFIX); } /** @@ -1133,12 +1036,6 @@ function resetPrefs() { Services.prefs.clearUserPref(PREF_APP_UPDATE_STAGING_ENABLED); } - if (gExtUpdateURL !== undefined) { - Services.prefs.setCharPref(PREF_EXTENSIONS_UPDATE_URL, gExtUpdateURL); - } else if (Services.prefs.prefHasUserValue(PREF_EXTENSIONS_UPDATE_URL)) { - Services.prefs.clearUserPref(PREF_EXTENSIONS_UPDATE_URL); - } - if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_IDLETIME)) { Services.prefs.clearUserPref(PREF_APP_UPDATE_IDLETIME); } @@ -1209,14 +1106,6 @@ function resetPrefs() { if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_SILENT)) { Services.prefs.clearUserPref(PREF_APP_UPDATE_SILENT); } - - if (Services.prefs.prefHasUserValue(PREF_EXTENSIONS_STRICT_COMPAT)) { - Services.prefs.clearUserPref(PREF_EXTENSIONS_STRICT_COMPAT); - } - - if (Services.prefs.prefHasUserValue(PREF_EM_HOTFIX_ID)) { - Services.prefs.clearUserPref(PREF_EM_HOTFIX_ID); - } } function setupTimer(aTestTimeout) { @@ -1231,256 +1120,6 @@ function setupTimer(aTestTimeout) { Ci.nsITimer.TYPE_ONE_SHOT); } -/** - * Disables pre-existing add-ons so they don't interfere with the tests, - * installs the test add-ons, sets the noupdate test add-ons' userDisabled value - * for the test, and calls the callback specified in the aCallback parameter. If - * the app.update.test.disabledAddons has a user value then setting the noupdate - * test add-ons' userDisabled value for the test is the only thing that is done. - * - * @param aCallback - * A callback to call after all operations have completed. - */ -function setupAddons(aCallback) { - debugDump("entering"); - - // Sets the appropriate userDisabled value for the noupdate test add-ons based - // on the value of gDisableNoUpdateAddon and calls the callback specified in - // setupAddons aCallback parameter. - function setNoUpdateAddonsDisabledState() { - AddonManager.getAllAddons(function(aAddons) { - aAddons.forEach(function(aAddon) { - if (aAddon.name.startsWith("appdisabled")) { - if (!aAddon.userDisabled) { - aAddon.userDisabled = true; - } - } - - if (aAddon.name.startsWith("noupdate")) { - if (aAddon.userDisabled != gDisableNoUpdateAddon) { - aAddon.userDisabled = gDisableNoUpdateAddon; - } - } - - if (aAddon.name.startsWith("updatecompatibility")) { - if (aAddon.userDisabled != gDisableUpdateCompatibilityAddon) { - aAddon.userDisabled = gDisableUpdateCompatibilityAddon; - } - } - - if (aAddon.name.startsWith("updateversion")) { - if (aAddon.userDisabled != gDisableUpdateVersionAddon) { - aAddon.userDisabled = gDisableUpdateVersionAddon; - } - } - }); - // Start the timout timer before the update window is displayed so it can - // clean up tests that don't successfully display the update window. - setupTimer(gTestTimeout); - SimpleTest.executeSoon(aCallback); - }); - } - - // If the app.update.test.disabledAddons preference exists the pre-existing - // add-ons have already been disabled so they don't interfere with the tests, - // the test add-ons have already been installed, and the only thing that needs - // to be done is setting the appropriate userDisabled value for the noupdate - // test add-ons. - if (Services.prefs.prefHasUserValue(PREF_DISABLEDADDONS)) { - setNoUpdateAddonsDisabledState(); - return; - } - - // Disable all pre-existing enabled addons so they don't interfere with the - // tests. - AddonManager.getAllAddons(function(aAddons) { - let disabledAddons = []; - let harnessAddons = ["special-powers@mozilla.org", "mochikit@mozilla.org"]; - aAddons.forEach(function(aAddon) { - // If an addon's type equals plugin it is skipped since - // checking plugins compatibility information isn't supported at this - // time (also see bug 566787). Also, SCOPE_APPLICATION add-ons are - // excluded by app update so there is no reason to disable them. - // Specialpowers and mochikit are excluded as the test harness requires - // them to run the tests. - if (aAddon.type != "plugin" && !aAddon.appDisabled && - !aAddon.userDisabled && - aAddon.scope != AddonManager.SCOPE_APPLICATION && - harnessAddons.indexOf(aAddon.id) == -1) { - disabledAddons.push(aAddon); - aAddon.userDisabled = true; - } - }); - // If there are no pre-existing add-ons the preference value will be an - // empty string. - Services.prefs.setCharPref(PREF_DISABLEDADDONS, disabledAddons.join(" ")); - - // Install the test add-ons. - let promises = getTestAddonXPIFiles().map(function(aFile) { - return AddonManager.installTemporaryAddon(aFile).then(addon => { - if (getAddonTestType(addon.name) == "userdisabled") { - addon.userDisabled = true; - } - }); - }); - return Promise.all(promises).then(setNoUpdateAddonsDisabledState); - }); -} - -/** - * Uninstalls the test add-ons, enables add-ons that were disabled when the - * test started, and calls the callback specified in the aCallback parameter. - * - * @param aCallback - * A callback to call after all operations have completed. - */ -function resetAddons(aCallback) { - debugDump("entering"); - // If test_9999_cleanup.xul is ran by itself then the test add-ons will not - // have been installed and any pre-existing add-ons will not have been - // disabled so return early. - if (!Services.prefs.prefHasUserValue(PREF_DISABLEDADDONS)) { - debugDump("preference " + PREF_DISABLEDADDONS + " doesn't exist... " + - "returning early"); - aCallback(); - return; - } - - // Uninstall the test add-ons. - let count = TEST_ADDONS.length; - function uninstallCompleted(aAddon) { - if (--count == 0) { - AddonManager.removeAddonListener(listener); - - // Enable the pre-existing add-ons that were disabled so they wouldn't - // interfere with the tests. - let disabledAddons = Services.prefs.getCharPref(PREF_DISABLEDADDONS).split(" "); - Services.prefs.clearUserPref(PREF_DISABLEDADDONS); - AddonManager.getAllAddons(function(aAddons) { - aAddons.forEach(function(aAddon) { - if (disabledAddons.indexOf(aAddon.id)) { - aAddon.userDisabled = false; - } - }); - SimpleTest.executeSoon(aCallback); - }); - } - } - - let listener = { - onUninstalled: uninstallCompleted - }; - - AddonManager.addAddonListener(listener); - TEST_ADDONS.forEach(function(aName) { - AddonManager.getAddonByID(aName + ADDON_ID_SUFFIX, function(aAddon) { - aAddon.uninstall(); - }); - }); -} - -/** - * Helper function to get the string before the '_' character in an add-on's - * name or id which is used to determine the add-on test type used by the tests. - * - * @param aName - * The test add-on's name or id. - * @return The string before the '_' character in the string passed in the aName - * parameter. - */ -function getAddonTestType(aName) { - return aName.split("_")[0]; -} - -/** - * Helper function to create add-on xpi files for the default test add-ons. - * - * @return An array with each member being an nsILocalFile for an add-on XPI - * file. - */ -function getTestAddonXPIFiles() { - let addonPrepDir = Services.dirsvc.get(NS_APP_USER_PROFILE_50_DIR, - Ci.nsILocalFile); - addonPrepDir.append(ADDON_PREP_DIR); - - let bootstrap = addonPrepDir.clone(); - bootstrap.append("bootstrap.js"); - // If a previous test has already created bootstrap.js don't create it again. - if (!bootstrap.exists()) { - let bootstrapContents = "function install(data, reason){ }\n" + - "function startup(data, reason){ }\n" + - "function shutdown(data, reason){ }\n" + - "function uninstall(data, reason){ }\n"; - writeFile(bootstrap, bootstrapContents); - } - - let installRDF = addonPrepDir.clone(); - installRDF.append("install.rdf"); - - let xpiFiles = []; - TEST_ADDONS.forEach(function(aName) { - let xpiFile = addonPrepDir.clone(); - xpiFile.append(aName + ".xpi"); - - if (installRDF.exists()) { - installRDF.remove(false); - } - writeFile(installRDF, getInstallRDFString(aName)); - gZipW.open(xpiFile, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE); - gZipW.addEntryFile(installRDF.leafName, - Ci.nsIZipWriter.COMPRESSION_DEFAULT, installRDF, - false); - gZipW.addEntryFile(bootstrap.leafName, - Ci.nsIZipWriter.COMPRESSION_DEFAULT, bootstrap, - false); - gZipW.close(); - xpiFiles.push(xpiFile); - }); - - return xpiFiles; -} - -/** - * Helper function to gets the string representation of the contents of the - * add-on's install.rdf file. - * - * @param aName - * The string to use for the add-on's name which is also used to - * construct the local-part in RFC 5322 format of the add-on's ID. - * @return A string representation of the contents of the add-on's install.rdf - * file. - */ -function getInstallRDFString(aName) { - let maxVersion = Services.appinfo.platformVersion; - switch (getAddonTestType(aName)) { - case "compatible": - maxVersion = getNewerPlatformVersion(); - break; - case "appdisabled": - maxVersion = "0.1"; - break; - } - - return "\n" + - "\n" + - " \n" + - " " + aName + ADDON_ID_SUFFIX + "\n" + - " 1.0\n" + - " true\n" + - " " + aName + "\n" + - " Test Description\n" + - " \n" + - " \n" + - " toolkit@mozilla.org\n" + - " undefined\n" + - " " + maxVersion + "\n" + - " \n" + - " \n" + - " \n" + - ""; -} - /** * Closes the update window if it is open and causes the test to fail if an * update window is found. diff --git a/toolkit/mozapps/update/tests/data/shared.js b/toolkit/mozapps/update/tests/data/shared.js index b016f8a29dee..0efc8ac58996 100644 --- a/toolkit/mozapps/update/tests/data/shared.js +++ b/toolkit/mozapps/update/tests/data/shared.js @@ -39,9 +39,6 @@ const PREF_APP_PARTNER_BRANCH = "app.partner."; const PREF_DISTRIBUTION_ID = "distribution.id"; const PREF_DISTRIBUTION_VERSION = "distribution.version"; -const PREF_EXTENSIONS_UPDATE_URL = "extensions.update.url"; -const PREF_EXTENSIONS_STRICT_COMPAT = "extensions.strictCompatibility"; - const NS_APP_PROFILE_DIR_STARTUP = "ProfDS"; const NS_APP_USER_PROFILE_50_DIR = "ProfD"; const NS_GRE_DIR = "GreD";