Bug 772272 - Remove do_load_httpd_js from xpcshell tests, r=ted, f=gps

This commit is contained in:
Mark Capella 2012-08-08 00:51:28 -04:00
parent 4d0ef903c3
commit 286e999e99
57 changed files with 177 additions and 146 deletions

View File

@ -12,7 +12,7 @@ const INSTALLERROR_SOFTBLOCKED = -10;
gPrefs.setBoolPref("extensions.checkUpdateSecurity", false);
// Get the HTTP server.
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
// This allows the EM to attempt to display errors to the user without failing
@ -130,7 +130,7 @@ function run_test() {
blocklist.copyTo(gProfD, "blocklist.xml");
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/", do_get_file("data"));
testserver.start(4444);

View File

@ -6,7 +6,7 @@
Components.utils.import("resource://gre/modules/AddonRepository.jsm");
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var gServer;
const PREF_GETADDONS_BROWSEADDONS = "extensions.getAddons.browseAddons";
@ -364,7 +364,7 @@ function run_test() {
installAllFiles([do_get_addon("test_AddonRepository_1")], function() {
restartManager();
gServer = new nsHttpServer();
gServer = new HttpServer();
// Register other add-on XPI files
gServer.registerFile(INSTALL_URL2,

View File

@ -6,7 +6,7 @@
Components.utils.import("resource://gre/modules/AddonRepository.jsm");
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
let gServer;
const PORT = 4444;
@ -533,7 +533,7 @@ function run_test() {
installAllFiles(ADDON_FILES, function() {
restartManager();
gServer = new nsHttpServer();
gServer = new HttpServer();
gServer.registerDirectory("/data/", do_get_file("data"));
gServer.start(PORT);

View File

@ -7,7 +7,7 @@
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var gServer;
var COMPATIBILITY_PREF;
@ -29,7 +29,7 @@ function run_test() {
COMPATIBILITY_PREF = "extensions.checkCompatibility." + version;
// Create and configure the HTTP server.
gServer = new nsHttpServer();
gServer = new HttpServer();
gServer.registerDirectory("/data/", do_get_file("data"));
gServer.start(4444);

View File

@ -7,7 +7,7 @@
// The test extension uses an insecure update url.
Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
const profileDir = gProfD.clone();
profileDir.append("extensions");
@ -16,7 +16,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.start(4444);

View File

@ -5,7 +5,7 @@
// Checks that we rebuild something sensible from a database with a bad schema
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
// The test extension uses an insecure update url.
@ -143,7 +143,7 @@ function run_test() {
writeInstallRDFForExtension(theme2, profileDir);
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.start(4444);

View File

@ -27,14 +27,18 @@
// softblocked and have to be manually re-enabled if they become completely
// unblocked (bug 657520)
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul";
Components.utils.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
// Allow insecure updates
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false)
do_load_httpd_js();
Cu.import("resource://testing-common/httpd.js");
var testserver;
var default_theme = {
@ -512,7 +516,7 @@ function check_addon(aAddon, aExpectedVersion, aExpectedUserDisabled,
function run_test() {
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data/blocklistchange"));
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.start(4444);

View File

@ -27,7 +27,7 @@ userExtDir.append("extensions2");
userExtDir.append(gAppInfo.ID);
registerDirectory("XREUSysExt", userExtDir.parent);
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
function resetPrefs() {
@ -87,7 +87,7 @@ function run_test() {
resetPrefs();
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.start(4444);

View File

@ -26,7 +26,7 @@ const checkListener = {
}
// Get the HTTP server.
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
var ADDONS = [
@ -128,7 +128,7 @@ function run_test() {
do_check_true(xpiFile.exists());
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/addons/", addonsDir);
testserver.registerDirectory("/data/", dataDir);
testserver.start(4444);

View File

@ -7,7 +7,7 @@
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
// Get the HTTP server.
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
var ADDON = {
@ -24,7 +24,7 @@ function run_test() {
const addonsDir = do_get_addon(ADDON.addon).parent;
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/addons/", addonsDir);
testserver.registerDirectory("/data/", dataDir);
testserver.start(4444);

View File

@ -7,7 +7,7 @@
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
// Get the HTTP server.
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
var next_test = null;
@ -130,7 +130,7 @@ function run_test() {
const dataDir = do_get_file("data");
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/data/", dataDir);
testserver.start(4444);

View File

@ -9,7 +9,10 @@ const PREF_SELECTED_LOCALE = "general.useragent.locale";
// Disables security checking our updates which haven't been signed
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
do_load_httpd_js();
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://testing-common/httpd.js");
// This is the data we expect to see sent as part of the update url.
var EXPECTED = [
@ -94,8 +97,8 @@ var BlocklistService = {
},
QueryInterface: function(iid) {
if (iid.equals(Components.interfaces.nsIBlocklistService)
|| iid.equals(Components.interfaces.nsISupports))
if (iid.equals(Ci.nsIBlocklistService)
|| iid.equals(Ci.nsISupports))
return this;
throw Components.results.NS_ERROR_NO_INTERFACE;
@ -148,7 +151,7 @@ function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
server = new nsHttpServer();
server = new HttpServer();
server.registerPathHandler("/0", requestHandler);
server.registerPathHandler("/1", requestHandler);
server.registerPathHandler("/2", requestHandler);

View File

@ -9,7 +9,7 @@ var gComponentRegistrar = Components.manager.QueryInterface(AM_Ci.nsIComponentRe
var gCategoryManager = AM_Cc["@mozilla.org/categorymanager;1"].getService(AM_Ci.nsICategoryManager);
// Get the HTTP server.
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
// Factory for our parameter handler
@ -37,7 +37,7 @@ function initTest()
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerPathHandler("/update.rdf", function(aRequest, aResponse) {
gSeenExpectedURL = aRequest.queryString == gExpectedQuery;
aResponse.setStatusLine(null, 404, "Not Found");

View File

@ -6,7 +6,7 @@
// Disables security checking our updates which haven't been signed
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var server;
// nsIAddonUpdateCheckListener implementation
@ -45,7 +45,7 @@ function run_test()
do_check_neq(updates[0], null);
do_check_neq(updates[1], null);
server = new nsHttpServer();
server = new HttpServer();
server.registerDirectory("/", do_get_file("data"));
server.start(4444);

View File

@ -6,7 +6,7 @@ Components.utils.import("resource://gre/modules/AddonRepository.jsm");
const PREF_GETADDONS_GETRECOMMENDED = "extensions.getAddons.recommended.url";
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var server;
var RESULTS = [
null,
@ -44,7 +44,7 @@ function run_test()
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
startupManager();
server = new nsHttpServer();
server = new HttpServer();
server.registerDirectory("/", do_get_file("data"));
server.start(4444);

View File

@ -13,7 +13,7 @@ const PREF_GENERAL_USERAGENT_LOCALE = "general.useragent.locale";
const CATEGORY_UPDATE_TIMER = "update-timer";
// Get the HTTP server.
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
var gOSVersion;
var gBlocklist;
@ -103,7 +103,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerPathHandler("/1", failHandler);
testserver.registerPathHandler("/2", pathHandler);
testserver.start(4444);

View File

@ -4,7 +4,10 @@
*/
const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul";
do_load_httpd_js();
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://testing-common/httpd.js");
var ADDONS = [{
id: "test_bug449027_1@tests.mozilla.org",
@ -372,8 +375,8 @@ var PluginHost = {
},
QueryInterface: function(iid) {
if (iid.equals(Components.interfaces.nsIPluginHost)
|| iid.equals(Components.interfaces.nsISupports))
if (iid.equals(Ci.nsIPluginHost)
|| iid.equals(Ci.nsISupports))
return this;
throw Components.results.NS_ERROR_NO_INTERFACE;
@ -408,8 +411,8 @@ var WindowWatcher = {
},
QueryInterface: function(iid) {
if (iid.equals(Components.interfaces.nsIWindowWatcher)
|| iid.equals(Components.interfaces.nsISupports))
if (iid.equals(Ci.nsIWindowWatcher)
|| iid.equals(Ci.nsISupports))
return this;
throw Components.results.NS_ERROR_NO_INTERFACE;
@ -423,7 +426,7 @@ var WindowWatcherFactory = {
return WindowWatcher.QueryInterface(iid);
}
};
var registrar = Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
registrar.registerFactory(Components.ID("{721c3e73-969e-474b-a6dc-059fd288c428}"),
"Fake Plugin Host",
"@mozilla.org/plugin/host;1", PluginHostFactory);
@ -455,7 +458,7 @@ function create_addon(addon) {
target.append("install.rdf");
target.create(target.NORMAL_FILE_TYPE, 0644);
var stream = Components.classes["@mozilla.org/network/file-output-stream;1"]
.createInstance(Components.interfaces.nsIFileOutputStream);
.createInstance(Ci.nsIFileOutputStream);
stream.init(target, 0x04 | 0x08 | 0x20, 0664, 0); // write, create, truncate
stream.write(installrdf, installrdf.length);
stream.close();
@ -506,7 +509,7 @@ function check_state(test, lastTest, callback) {
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Components.classes["@mozilla.org/extensions/blocklist;1"]
.getService(Components.interfaces.nsITimerCallback);
.getService(Ci.nsITimerCallback);
blocklist.notify(null);
}
@ -521,7 +524,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -8,7 +8,11 @@ const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/bloc
const PREF_BLOCKLIST_ITEM_URL = "extensions.blocklist.itemURL";
Services.prefs.setCharPref(PREF_BLOCKLIST_ITEM_URL, "http://localhost:4444/blocklist/%blockID%");
do_load_httpd_js();
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://testing-common/httpd.js");
var ADDONS = [{
// Tests how the blocklist affects a disabled add-on
@ -247,7 +251,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -15,14 +15,14 @@ var ADDONS = [
"test_bug470377_5",
];
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var server;
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
server = new nsHttpServer();
server = new HttpServer();
server.registerDirectory("/", do_get_file("data/test_bug470377"));
server.start(4444);

View File

@ -15,14 +15,14 @@ var ADDONS = [
"test_bug470377_5",
];
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var server;
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
server = new nsHttpServer();
server = new HttpServer();
server.registerDirectory("/", do_get_file("data/test_bug470377"));
server.start(4444);

View File

@ -29,14 +29,14 @@ var ADDONS = [
"test_bug470377_5",
];
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var server;
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
server = new nsHttpServer();
server = new HttpServer();
server.registerDirectory("/", do_get_file("data/test_bug470377"));
server.start(4444);

View File

@ -2,8 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
do_load_httpd_js();
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://testing-common/httpd.js");
const nsIBLS = Ci.nsIBlocklistService;
const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul";
@ -113,7 +116,7 @@ function do_update_blocklist(aDatafile, aNextPart) {
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -9,7 +9,11 @@ const PREF_EM_SHOW_MISMATCH_UI = "extensions.showMismatchUI";
// The test extension uses an insecure update url.
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
do_load_httpd_js();
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://testing-common/httpd.js");
var testserver;
const profileDir = gProfD.clone();
@ -302,7 +306,7 @@ function run_test() {
}, profileDir);
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.start(4444);

View File

@ -9,7 +9,7 @@ Components.utils.import("resource://gre/modules/AddonRepository.jsm");
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var server;
var TESTS = [
@ -69,7 +69,7 @@ function run_test()
startupManager();
server = new nsHttpServer();
server = new HttpServer();
server.registerDirectory("/", do_get_file("data"));
server.start(4444);

View File

@ -7,7 +7,7 @@
// The test extension uses an insecure update url.
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
const profileDir = gProfD.clone();
profileDir.append("extensions");
@ -16,7 +16,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.start(4444);

View File

@ -3,7 +3,11 @@
*/
// Tests whether
do_load_httpd_js();
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://testing-common/httpd.js");
var gTestserver = null;
@ -22,7 +26,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -2,7 +2,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
const PREF_BLOCKLIST_LASTUPDATETIME = "app.update.lastUpdateTime.blocklist-background-update-timer";
const PREF_BLOCKLIST_PINGCOUNTTOTAL = "extensions.blocklist.pingCountTotal";
@ -28,7 +28,7 @@ function pathHandler(metadata, response) {
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerPathHandler("/", pathHandler);
gTestserver.start(4444);

View File

@ -13,7 +13,7 @@ Services.prefs.setIntPref("extensions.enabledScopes",
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "1.9.2");
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
var userDir = gProfD.clone();
@ -50,7 +50,7 @@ function run_test() {
do_test_pending();
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.start(4444);

View File

@ -18,7 +18,7 @@ Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS,
BASE_URL + REQ_URL);
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var gServer;
@ -179,7 +179,7 @@ function run_test() {
writeInstallRDFForExtension(addon9, profileDir);
writeInstallRDFForExtension(addon10, profileDir);
gServer = new nsHttpServer();
gServer = new HttpServer();
gServer.registerFile(REQ_URL, do_get_file("data/test_compatoverrides.xml"));
gServer.start(PORT);

View File

@ -5,7 +5,7 @@
// Checks that we rebuild something sensible from a corrupt database
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
// The test extension uses an insecure update url.
@ -144,7 +144,7 @@ function run_test() {
writeInstallRDFForExtension(theme2, profileDir);
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.start(4444);

View File

@ -5,7 +5,7 @@
// Checks that we rebuild something sensible from a corrupt database
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
// The test extension uses an insecure update url.
@ -144,7 +144,7 @@ function run_test() {
writeInstallRDFForExtension(theme2, profileDir);
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.start(4444);

View File

@ -18,7 +18,7 @@ userExtDir.append("extensions2");
userExtDir.append(gAppInfo.ID);
registerDirectory("XREUSysExt", userExtDir.parent);
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
/**
@ -99,7 +99,7 @@ function run_test() {
do_test_pending();
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.start(4444);

View File

@ -45,7 +45,7 @@ profileDir.create(AM_Ci.nsILocalFile.DIRECTORY_TYPE, 0755);
const sourceDir = gProfD.clone();
sourceDir.append("source");
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
function writePointer(aId, aName) {
@ -71,7 +71,7 @@ function writeRelativePointer(aId, aName) {
let absTarget = sourceDir.clone();
absTarget.append(do_get_expected_addon_name(aId));
var relTarget = absTarget.QueryInterface(Ci.nsILocalFile)
var relTarget = absTarget.QueryInterface(AM_Ci.nsILocalFile)
.getRelativeDescriptor(profileDir);
var fos = AM_Cc["@mozilla.org/network/file-output-stream;1"].
@ -92,7 +92,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.start(4444);

View File

@ -6,7 +6,7 @@
// exactly matches the blacklist entry, is not blocked.
// Uses test_gfxBlacklist.xml
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var gTestserver = null;
@ -68,7 +68,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -6,7 +6,7 @@
// the attributes match the blacklist entry.
// Uses test_gfxBlacklist.xml
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var gTestserver = null;
@ -67,7 +67,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -6,7 +6,7 @@
// blacklist entry is allowed.
// Uses test_gfxBlacklist.xml
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var gTestserver = null;
@ -67,7 +67,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -6,7 +6,7 @@
// blacklist entry is correctly allowed.
// Uses test_gfxBlacklist.xml
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var gTestserver = null;
@ -67,7 +67,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -6,7 +6,7 @@
// blacklist entry is successfully blocked.
// Uses test_gfxBlacklist.xml
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var gTestserver = null;
@ -67,7 +67,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -6,7 +6,7 @@
// blacklist entry is allowed.
// Uses test_gfxBlacklist.xml
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var gTestserver = null;
@ -67,7 +67,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -6,7 +6,7 @@
// blacklist entry is successfully blocked.
// Uses test_gfxBlacklist.xml
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var gTestserver = null;
@ -67,7 +67,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -6,7 +6,7 @@
// successfully blocked.
// Uses test_gfxBlacklist.xml
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var gTestserver = null;
@ -61,7 +61,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -6,7 +6,7 @@
// successfully blocked.
// Uses test_gfxBlacklist.xml
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var gTestserver = null;
@ -68,7 +68,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -6,7 +6,7 @@
// exactly matches the blacklist entry, is not blocked.
// Uses test_gfxBlacklist.xml
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var gTestserver = null;
@ -69,7 +69,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -6,7 +6,7 @@
// exactly matches the blacklist entry, is not blocked.
// Uses test_gfxBlacklist.xml
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var gTestserver = null;
@ -68,7 +68,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -6,7 +6,7 @@
// its decisions when the remote blacklist is changed.
// Uses test_gfxBlacklist.xml and test_gfxBlacklist2.xml
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var gTestserver = null;
@ -68,7 +68,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver = new HttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);

View File

@ -9,7 +9,7 @@ Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
// Ignore any certificate requirements the app has set
Services.prefs.setBoolPref("extensions.hotfix.cert.checkAttributes", false);
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
const profileDir = gProfD.clone();
profileDir.append("extensions");
@ -18,7 +18,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.start(4444);

View File

@ -3,19 +3,22 @@
*/
// This verifies that add-ons can be installed from XPI files
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
// Maximum error in file modification times. Some file systems don't store
// modification times exactly. As long as we are closer than this then it
// still passes.
const MAX_TIME_DIFFERENCE = 3000;
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
// install.rdf size, icon.png, icon64.png size
const ADDON1_SIZE = 705 + 16 + 16;
do_load_httpd_js();
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://testing-common/httpd.js");
var testserver;
var gInstallDate;
var gInstall = null;
@ -38,7 +41,7 @@ function run_test() {
AddonManager.addAddonListener(AddonListener);
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.registerPathHandler("/redirect", function(aRequest, aResponse) {

View File

@ -3,19 +3,22 @@
*/
// This verifies that add-ons can be installed from XPI files
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
// Maximum error in file modification times. Some file systems don't store
// modification times exactly. As long as we are closer than this then it
// still passes.
const MAX_TIME_DIFFERENCE = 3000;
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
// install.rdf size, icon.png, icon64.png size
const ADDON1_SIZE = 705 + 16 + 16;
do_load_httpd_js();
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://testing-common/httpd.js");
var testserver;
var gInstallDate;
var gInstall = null;
@ -39,7 +42,7 @@ function run_test() {
AddonManager.addAddonListener(AddonListener);
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.registerPathHandler("/redirect", function(aRequest, aResponse) {

View File

@ -5,7 +5,7 @@
// Checks that we rebuild something sensible from a corrupt database
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
// The test extension uses an insecure update url.
@ -144,7 +144,7 @@ function run_test() {
writeInstallRDFForExtension(theme2, profileDir);
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.start(4444);

View File

@ -5,7 +5,7 @@
// Checks that we rebuild something sensible from a corrupt database
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
// The test extension uses an insecure update url.
@ -144,7 +144,7 @@ function run_test() {
writeInstallRDFForExtension(theme2, profileDir);
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.start(4444);

View File

@ -91,7 +91,7 @@ var defaultTheme = {
const profileDir = gProfD.clone();
profileDir.append("extensions");
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
let oldSyncGUIDs = {};
@ -100,7 +100,7 @@ function prepare_profile() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.start(4444);

View File

@ -24,7 +24,7 @@ const PARAMS = "?%REQ_VERSION%/%ITEM_ID%/%ITEM_VERSION%/%ITEM_MAXAPPVERSION%/" +
var gInstallDate;
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
const profileDir = gProfD.clone();
profileDir.append("extensions");
@ -37,7 +37,7 @@ function run_test() {
Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "fr-FR");
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.start(4444);

View File

@ -9,7 +9,7 @@
// The test extension uses an insecure update url.
Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
const profileDir = gProfD.clone();
profileDir.append("extensions");
@ -34,7 +34,7 @@ function run_test() {
COMPATIBILITY_PREF = "extensions.checkCompatibility." + version;
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.start(4444);

View File

@ -11,7 +11,7 @@ const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
// The test extension uses an insecure update url.
Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
const profileDir = gProfD.clone();
profileDir.append("extensions");
@ -21,7 +21,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.start(4444);

View File

@ -23,7 +23,7 @@ const PARAMS = "?%REQ_VERSION%/%ITEM_ID%/%ITEM_VERSION%/%ITEM_MAXAPPVERSION%/" +
var gInstallDate;
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
const profileDir = gProfD.clone();
profileDir.append("extensions");
@ -35,7 +35,7 @@ function run_test() {
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, true);
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.start(4444);

View File

@ -8,7 +8,7 @@ Components.utils.import("resource://gre/modules/AddonUpdateChecker.jsm");
var COMPATIBILITY_PREF;
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
function run_test() {
@ -25,7 +25,7 @@ function run_test() {
COMPATIBILITY_PREF = "extensions.checkCompatibility." + version;
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.start(4444);

View File

@ -7,7 +7,7 @@
// The test extension uses an insecure update url.
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
do_load_httpd_js();
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
const profileDir = gProfD.clone();
profileDir.append("extensions");
@ -33,7 +33,7 @@ function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data"));
testserver.registerDirectory("/addons/", do_get_file("addons"));
testserver.start(4444);