Bug 1449255: Part 3a - Delete test_bug384052 and the functionality it tests. r?aswan
This is all dead code now that legacy extensions are gone. WebExtensions have
no way to implement this.
MozReview-Commit-ID: IDoH6HATKcc
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -33,17 +33,16 @@ const PREF_APP_UPDATE_ENABLED =
const PREF_APP_UPDATE_AUTO = "app.update.auto";
const UNKNOWN_XPCOM_ABI = "unknownABI";
const PREF_MIN_WEBEXT_PLATFORM_VERSION = "extensions.webExtensionsMinPlatformVersion";
const PREF_WEBAPI_TESTING = "extensions.webapi.testing";
const PREF_WEBEXT_PERM_PROMPTS = "extensions.webextPermissionPrompts";
const UPDATE_REQUEST_VERSION = 2;
-const CATEGORY_UPDATE_PARAMS = "extension-update-params";
const XMLURI_BLOCKLIST = "http://www.mozilla.org/2006/addons-blocklist";
const KEY_PROFILEDIR = "ProfD";
const KEY_APPDIR = "XCurProcD";
const FILE_BLOCKLIST = "blocklist.xml";
const BRANCH_REGEXP = /^([^\.]+\.[0-9]+[a-z]*).*/gi;
@@ -1272,34 +1271,16 @@ var AddonManagerInternal = {
uri = uri.replace(/%APP_VERSION%/g, aAppVersion ? aAppVersion :
Services.appinfo.version);
uri = uri.replace(/%REQ_VERSION%/g, UPDATE_REQUEST_VERSION);
uri = uri.replace(/%APP_OS%/g, Services.appinfo.OS);
uri = uri.replace(/%APP_ABI%/g, xpcomABI);
uri = uri.replace(/%APP_LOCALE%/g, getLocale());
uri = uri.replace(/%CURRENT_APP_VERSION%/g, Services.appinfo.version);
- // Replace custom parameters (names of custom parameters must have at
- // least 3 characters to prevent lookups for something like %D0%C8)
- var catMan = null;
- uri = uri.replace(/%(\w{3,})%/g, function(aMatch, aParam) {
- if (!catMan) {
- catMan = Cc["@mozilla.org/categorymanager;1"].
- getService(Ci.nsICategoryManager);
- }
-
- try {
- var contractID = catMan.getCategoryEntry(CATEGORY_UPDATE_PARAMS, aParam);
- var paramHandler = Cc[contractID].getService(Ci.nsIPropertyBag2);
- return paramHandler.getPropertyAsAString(aParam);
- } catch (e) {
- return aMatch;
- }
- });
-
// escape() does not properly encode + symbols in any embedded FVF strings.
return uri.replace(/\+/g, "%2B");
},
_updatePromptHandler(info) {
let oldPerms = info.existingAddon.userPermissions;
if (!oldPerms) {
// Updating from a legacy add-on, just let it proceed
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug384052.js
+++ /dev/null
@@ -1,97 +0,0 @@
-const CLASS_ID = Components.ID("{12345678-1234-1234-1234-123456789abc}");
-const CONTRACT_ID = "@mozilla.org/test-parameter-source;1";
-
-var testserver = AddonTestUtils.createHttpServer({hosts: ["example.com"]});
-
-var gTestURL = "http://example.com/update.json?itemID=%ITEM_ID%&custom1=%CUSTOM1%&custom2=%CUSTOM2%";
-var gExpectedQuery = "itemID=test@mozilla.org&custom1=custom_parameter_1&custom2=custom_parameter_2";
-var gSeenExpectedURL = false;
-
-var gComponentRegistrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
-var gCategoryManager = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
-
-// Factory for our parameter handler
-var paramHandlerFactory = {
- QueryInterface(iid) {
- if (iid.equals(Ci.nsIFactory) || iid.equals(Ci.nsISupports))
- return this;
-
- throw Cr.NS_ERROR_NO_INTERFACE;
- },
-
- createInstance(outer, iid) {
- var bag = Cc["@mozilla.org/hash-property-bag;1"].
- createInstance(Ci.nsIWritablePropertyBag);
- bag.setProperty("CUSTOM1", "custom_parameter_1");
- bag.setProperty("CUSTOM2", "custom_parameter_2");
- return bag.QueryInterface(iid);
- }
-};
-
-function initTest() {
- do_test_pending();
- // Setup extension manager
- createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
-
- // Configure the HTTP server.
- testserver.registerPathHandler("/update.json", function(aRequest, aResponse) {
- gSeenExpectedURL = aRequest.queryString == gExpectedQuery;
- aResponse.setStatusLine(null, 404, "Not Found");
- });
-
- // Register our parameter handlers
- gComponentRegistrar.registerFactory(CLASS_ID, "Test component", CONTRACT_ID, paramHandlerFactory);
- gCategoryManager.addCategoryEntry("extension-update-params", "CUSTOM1", CONTRACT_ID, false, false);
- gCategoryManager.addCategoryEntry("extension-update-params", "CUSTOM2", CONTRACT_ID, false, false);
-
- // Install a test extension into the profile
- let dir = gProfD.clone();
- dir.append("extensions");
- writeInstallRDFForExtension({
- id: "test@mozilla.org",
- version: "1.0",
- name: "Test extension",
- bootstrap: true,
- updateURL: gTestURL,
- targetApplications: [{
- id: "xpcshell@tests.mozilla.org",
- minVersion: "1",
- maxVersion: "1"
- }],
- }, dir);
-
- startupManager();
-}
-
-function shutdownTest() {
- shutdownManager();
-
- gComponentRegistrar.unregisterFactory(CLASS_ID, paramHandlerFactory);
- gCategoryManager.deleteCategoryEntry("extension-update-params", "CUSTOM1", false);
- gCategoryManager.deleteCategoryEntry("extension-update-params", "CUSTOM2", false);
-
- do_test_finished();
-}
-
-function run_test() {
- initTest();
-
- AddonManager.getAddonByID("test@mozilla.org", function(item) {
- // Initiate update
- item.findUpdates({
- onCompatibilityUpdateAvailable(addon) {
- do_throw("Should not have seen a compatibility update");
- },
-
- onUpdateAvailable(addon, install) {
- do_throw("Should not have seen an available update");
- },
-
- onUpdateFinished(addon, error) {
- Assert.equal(error, AddonManager.UPDATE_STATUS_DOWNLOAD_ERROR);
- Assert.ok(gSeenExpectedURL);
- executeSoon(shutdownTest);
- }
- }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
- });
-}
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
@@ -38,19 +38,16 @@ tags = blocklist
requesttimeoutfactor = 2
tags = blocklist
[test_bootstrap.js]
skip-if = true # Bug 1358846 Bug 1365021 Bug 676992
[test_bootstrap_const.js]
[test_bootstrap_globals.js]
[test_bug1180901_2.js]
skip-if = os != "win"
-[test_bug384052.js]
-# Bug 676992: test consistently hangs on Android
-skip-if = os == "android"
[test_bug393285.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
tags = blocklist
[test_bug397778.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
[test_bug406118.js]