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

--HG--
extra : rebase_source : 2dc0fca457ab125dcc50c3b311df74886c4f78c1
This commit is contained in:
Kris Maglione 2018-03-27 12:51:45 -07:00
Родитель 0c88734cd9
Коммит 562ba91248
3 изменённых файлов: 0 добавлений и 119 удалений

Просмотреть файл

@ -38,7 +38,6 @@ 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";
@ -1277,24 +1276,6 @@ var AddonManagerInternal = {
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");
},

Просмотреть файл

@ -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);
});
}

Просмотреть файл

@ -43,9 +43,6 @@ skip-if = true # Bug 1358846 Bug 1365021 Bug 676992
[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"