3. Main patch for Bug 1136358 - Preprocessing and file includes make it difficult to debug app update tests. r=spohl

This commit is contained in:
Robert Strong 2015-02-27 14:51:17 -08:00
Родитель 9e38fce400
Коммит a9e155bc53
90 изменённых файлов: 979 добавлений и 922 удалений

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

@ -76,8 +76,9 @@ static void
WriteMsg(const NS_tchar *path, const char *status)
{
FILE* outFP = NS_tfopen(path, NS_T("wb"));
if (!outFP)
if (!outFP) {
return;
}
fprintf(outFP, "%s\n", status);
fclose(outFP);
@ -145,7 +146,7 @@ VerifyCertificateTrustForFile(LPCWSTR filePath)
trustData.pPolicyCallbackData = nullptr;
trustData.pSIPClientData = nullptr;
trustData.dwUIChoice = WTD_UI_NONE;
trustData.fdwRevocationChecks = WTD_REVOKE_NONE;
trustData.fdwRevocationChecks = WTD_REVOKE_NONE;
trustData.dwUnionChoice = WTD_CHOICE_FILE;
trustData.dwStateAction = 0;
trustData.hWVTStateData = nullptr;
@ -235,7 +236,7 @@ int NS_main(int argc, NS_tchar **argv)
} else {
return 1;
}
#else
#else
// Not implemented on non-Windows platforms
return 1;
#endif
@ -313,7 +314,7 @@ int NS_main(int argc, NS_tchar **argv)
} else {
return serviceState;
}
#else
#else
// Not implemented on non-Windows platforms
return 1;
#endif
@ -331,7 +332,7 @@ int NS_main(int argc, NS_tchar **argv)
} else {
return 2;
}
#else
#else
// Not implemented on non-Windows platforms
return 1;
#endif
@ -400,4 +401,4 @@ int NS_main(int argc, NS_tchar **argv)
}
return 0;
}
}

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

@ -117,8 +117,7 @@ int NS_main(int argc, NS_tchar **argv)
rv = 22;
fail("%s | Info ini value incorrect (check 4)", TEST_NAME);
}
}
else {
} else {
fail("%s | ReadStrings returned %i (check 2)", TEST_NAME, retval);
rv = 23;
}
@ -157,8 +156,7 @@ int NS_main(int argc, NS_tchar **argv)
rv = 27;
fail("%s | Title ini value incorrect (check 9)", TEST_NAME);
}
}
else {
} else {
fail("%s | ReadStrings returned %i (check 8)", TEST_NAME, retval);
rv = 28;
}

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

@ -7,9 +7,6 @@ skip-if = buildapp == 'mulet'
support-files =
utils.js
update.sjs
generated-files =
utils.js
update.sjs
; mochitest-chrome tests must start with "test_" and are executed in sorted
; order and not in the order specified in the manifest.

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

@ -26,7 +26,7 @@ const TESTS = [ {
buttonClick: "finish"
} ];
Components.utils.import("resource://gre/modules/CertUtils.jsm");
Cu.import("resource://gre/modules/CertUtils.jsm");
const CERT_ATTRS = ["nickname", "emailAddress", "subjectName", "commonName",
"organization", "organizationalUnit", "sha1Fingerprint",
@ -39,8 +39,8 @@ var gRequest;
function runTest() {
debugDump("entering");
gRequest = AUS_Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
createInstance(AUS_Ci.nsIXMLHttpRequest);
gRequest = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
createInstance(Ci.nsIXMLHttpRequest);
gRequest.open("GET", "https://example.com/", true);
gRequest.channel.notificationCallbacks = new BadCertHandler(true);
gRequest.onload = function(event) { testXHRLoad(event); };
@ -53,16 +53,17 @@ function testXHRError(aEvent) {
ok(true, "Entering testXHRError - something went wrong");
var request = aEvent.target;
var status = 0;
let request = aEvent.target;
let status = 0;
try {
status = request.status;
}
catch (e) {
}
if (status == 0)
status = request.channel.QueryInterface(AUS_Ci.nsIRequest).status;
if (status == 0) {
status = request.channel.QueryInterface(Ci.nsIRequest).status;
}
ok(false, "XHR onerror called: " + status);
@ -73,9 +74,9 @@ function testXHRError(aEvent) {
function testXHRLoad(aEvent) {
debugDump("entering");
var channel = aEvent.target.channel;
var cert = channel.securityInfo.QueryInterface(AUS_Ci.nsISSLStatusProvider).
SSLStatus.QueryInterface(AUS_Ci.nsISSLStatus).serverCert;
let channel = aEvent.target.channel;
let cert = channel.securityInfo.QueryInterface(Ci.nsISSLStatusProvider).
SSLStatus.QueryInterface(Ci.nsISSLStatus).serverCert;
CERT_ATTRS.forEach(function(aCertAttrName) {
Services.prefs.setCharPref(PREF_APP_UPDATE_CERTS_BRANCH + "1." +
aCertAttrName, cert[aCertAttrName]);

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

@ -26,7 +26,7 @@ const TESTS = [ {
buttonClick: "extra1"
} ];
Components.utils.import("resource://gre/modules/CertUtils.jsm");
Cu.import("resource://gre/modules/CertUtils.jsm");
const CERT_ATTRS = ["nickname", "emailAddress", "subjectName", "commonName",
"organization", "organizationalUnit", "sha1Fingerprint",
@ -39,8 +39,8 @@ var gRequest;
function runTest() {
debugDump("entering");
gRequest = AUS_Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
createInstance(AUS_Ci.nsIXMLHttpRequest);
gRequest = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
createInstance(Ci.nsIXMLHttpRequest);
gRequest.open("GET", "https://example.com/", true);
gRequest.channel.notificationCallbacks = new BadCertHandler(true);
gRequest.onload = function(event) { testXHRLoad(event); };
@ -53,16 +53,17 @@ function testXHRError(aEvent) {
ok(true, "Entering testXHRError - something went wrong");
var request = aEvent.target;
var status = 0;
let request = aEvent.target;
let status = 0;
try {
status = request.status;
}
catch (e) {
}
if (status == 0)
status = request.channel.QueryInterface(AUS_Ci.nsIRequest).status;
if (status == 0) {
status = request.channel.QueryInterface(Ci.nsIRequest).status;
}
ok(false, "XHR onerror called: " + status);
@ -73,9 +74,9 @@ function testXHRError(aEvent) {
function testXHRLoad(aEvent) {
debugDump("entering");
var channel = aEvent.target.channel;
var cert = channel.securityInfo.QueryInterface(AUS_Ci.nsISSLStatusProvider).
SSLStatus.QueryInterface(AUS_Ci.nsISSLStatus).serverCert;
let channel = aEvent.target.channel;
let cert = channel.securityInfo.QueryInterface(Ci.nsISSLStatusProvider).
SSLStatus.QueryInterface(Ci.nsISSLStatus).serverCert;
CERT_ATTRS.forEach(function(aCertAttrName) {
Services.prefs.setCharPref(PREF_APP_UPDATE_CERTS_BRANCH + "1." +
aCertAttrName, cert[aCertAttrName]);

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

@ -26,7 +26,7 @@ const TESTS = [ {
buttonClick: "extra1"
} ];
Components.utils.import("resource://gre/modules/CertUtils.jsm");
Cu.import("resource://gre/modules/CertUtils.jsm");
function runTest() {
debugDump("entering");

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

@ -68,7 +68,7 @@ function runTest() {
ok(!file.exists(), file.path + " should not exist");
let addonPrepDir = Services.dirsvc.get(NS_APP_USER_PROFILE_50_DIR,
AUS_Ci.nsILocalFile);
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

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

@ -4,32 +4,51 @@
/**
* Server side http server script for application update tests.
*
* !IMPORTANT - Since xpcshell used by the http server is launched with -v 170
* this file must not use features greater than JavaScript 1.7.
*/
const AUS_Cc = Components.classes;
const AUS_Ci = Components.interfaces;
const { classes: Cc, interfaces: Ci } = Components;
#include ../sharedUpdateXML.js
const REL_PATH_DATA = "chrome/toolkit/mozapps/update/tests/data/";
function getTestDataFile(aFilename) {
let file = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).get("CurWorkD", Ci.nsILocalFile);
let pathParts = REL_PATH_DATA.split("/");
for (let i = 0; i < pathParts.length; ++i) {
file.append(pathParts[i]);
}
if (aFilename) {
file.append(aFilename);
}
return file;
}
function loadHelperScript() {
let scriptFile = getTestDataFile("sharedUpdateXML.js");
let io = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService2);
let scriptSpec = io.newFileURI(scriptFile).spec;
let scriptloader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
scriptloader.loadSubScript(scriptSpec, this);
}
loadHelperScript();
const URL_HOST = "http://example.com";
const URL_PATH_UPDATE_XML = "/chrome/toolkit/mozapps/update/tests/chrome/update.sjs";
const URL_HTTP_UPDATE_SJS = URL_HOST + URL_PATH_UPDATE_XML;
const REL_PATH_DATA = "chrome/toolkit/mozapps/update/tests/data/";
const SERVICE_URL = URL_HOST + "/" + REL_PATH_DATA + FILE_SIMPLE_MAR;
const SLOW_MAR_DOWNLOAD_INTERVAL = 100;
var gTimer;
function handleRequest(aRequest, aResponse) {
var params = { };
if (aRequest.queryString)
let params = { };
if (aRequest.queryString) {
params = parseQueryString(aRequest.queryString);
}
var statusCode = params.statusCode ? parseInt(params.statusCode) : 200;
var statusReason = params.statusReason ? params.statusReason : "OK";
let statusCode = params.statusCode ? parseInt(params.statusCode) : 200;
let statusReason = params.statusReason ? params.statusReason : "OK";
aResponse.setStatusLine(aRequest.httpVersion, statusCode, statusReason);
aResponse.setHeader("Cache-Control", "no-cache", false);
@ -44,42 +63,25 @@ function handleRequest(aRequest, aResponse) {
// mar will be downloaded asynchronously which will allow the ui to load
// before the download completes.
if (params.slowDownloadMar) {
var i;
aResponse.processAsync();
aResponse.setHeader("Content-Type", "binary/octet-stream");
aResponse.setHeader("Content-Length", SIZE_SIMPLE_MAR);
var continueFile = AUS_Cc["@mozilla.org/file/directory_service;1"].
getService(AUS_Ci.nsIProperties).
get("CurWorkD", AUS_Ci.nsILocalFile);
var continuePath = REL_PATH_DATA + "continue";
var continuePathParts = continuePath.split("/");
for (i = 0; i < continuePathParts.length; ++i) {
continueFile.append(continuePathParts[i]);
}
var marFile = AUS_Cc["@mozilla.org/file/directory_service;1"].
getService(AUS_Ci.nsIProperties).
get("CurWorkD", AUS_Ci.nsILocalFile);
var path = REL_PATH_DATA + FILE_SIMPLE_MAR;
var pathParts = path.split("/");
for (i = 0; i < pathParts.length; ++i) {
marFile.append(pathParts[i]);
}
var contents = readFileBytes(marFile);
gTimer = AUS_Cc["@mozilla.org/timer;1"].
createInstance(AUS_Ci.nsITimer);
var continueFile = getTestDataFile("continue");
var contents = readFileBytes(getTestDataFile(FILE_SIMPLE_MAR));
gTimer = Cc["@mozilla.org/timer;1"].
createInstance(Ci.nsITimer);
gTimer.initWithCallback(function(aTimer) {
if (continueFile.exists()) {
gTimer.cancel();
aResponse.write(contents);
aResponse.finish();
}
}, SLOW_MAR_DOWNLOAD_INTERVAL, AUS_Ci.nsITimer.TYPE_REPEATING_SLACK);
}, SLOW_MAR_DOWNLOAD_INTERVAL, Ci.nsITimer.TYPE_REPEATING_SLACK);
return;
}
if (params.uiURL) {
var remoteType = "";
let remoteType = "";
if (!params.remoteNoTypeAttr &&
(params.uiURL == "BILLBOARD" || params.uiURL == "LICENSE")) {
remoteType = " " + params.uiURL.toLowerCase() + "=\"1\"";
@ -110,8 +112,8 @@ function handleRequest(aRequest, aResponse) {
return;
}
var hash;
var patches = "";
let hash;
let patches = "";
if (!params.partialPatchOnly) {
hash = SHA512_HASH_SIMPLE_MAR + (params.invalidCompleteHash ? "e" : "");
patches += getRemotePatchString("complete", SERVICE_URL, "SHA512",
@ -124,31 +126,37 @@ function handleRequest(aRequest, aResponse) {
hash, SIZE_SIMPLE_MAR);
}
var type = params.type ? params.type : "major";
var name = params.name ? params.name : "App Update Test";
var appVersion = params.appVersion ? params.appVersion : "99.9";
var displayVersion = params.displayVersion ? params.displayVersion
let type = params.type ? params.type : "major";
let name = params.name ? params.name : "App Update Test";
let appVersion = params.appVersion ? params.appVersion : "99.9";
let displayVersion = params.displayVersion ? params.displayVersion
: "version " + appVersion;
var platformVersion = params.platformVersion ? params.platformVersion : "99.8";
var buildID = params.buildID ? params.buildID : "01234567890123";
let platformVersion = params.platformVersion ? params.platformVersion : "99.8";
let buildID = params.buildID ? params.buildID : "01234567890123";
// XXXrstrong - not specifying a detailsURL will cause a leak due to bug 470244
// var detailsURL = params.showDetails ? URL_HTTP_UPDATE_SJS + "?uiURL=DETAILS" : null;
var detailsURL = URL_HTTP_UPDATE_SJS + "?uiURL=DETAILS";
var billboardURL = params.showBillboard ? URL_HTTP_UPDATE_SJS + "?uiURL=BILLBOARD" : null;
if (billboardURL && params.remoteNoTypeAttr)
// let detailsURL = params.showDetails ? URL_HTTP_UPDATE_SJS + "?uiURL=DETAILS" : null;
let detailsURL = URL_HTTP_UPDATE_SJS + "?uiURL=DETAILS";
let billboardURL = params.showBillboard ? URL_HTTP_UPDATE_SJS + "?uiURL=BILLBOARD" : null;
if (billboardURL && params.remoteNoTypeAttr) {
billboardURL += "&amp;remoteNoTypeAttr=1";
if (params.billboard404)
}
if (params.billboard404) {
billboardURL = URL_HOST + "/missing.html";
var licenseURL = params.showLicense ? URL_HTTP_UPDATE_SJS + "?uiURL=LICENSE" : null;
if (licenseURL && params.remoteNoTypeAttr)
}
let licenseURL = params.showLicense ? URL_HTTP_UPDATE_SJS + "?uiURL=LICENSE" : null;
if (licenseURL && params.remoteNoTypeAttr) {
licenseURL += "&amp;remoteNoTypeAttr=1";
if (params.license404)
}
if (params.license404) {
licenseURL = URL_HOST + "/missing.html";
var showPrompt = params.showPrompt ? "true" : null;
var showNever = params.showNever ? "true" : null;
var promptWaitTime = params.promptWaitTime ? params.promptWaitTime : null;
var showSurvey = params.showSurvey ? "true" : null;
}
let showPrompt = params.showPrompt ? "true" : null;
let showNever = params.showNever ? "true" : null;
let promptWaitTime = params.promptWaitTime ? params.promptWaitTime : null;
let showSurvey = params.showSurvey ? "true" : null;
let extensionVersion;
let version;
// For testing the deprecated update xml format
if (params.oldFormat) {
appVersion = null;
@ -158,14 +166,15 @@ function handleRequest(aRequest, aResponse) {
showNever = null;
showSurvey = null;
detailsURL = URL_HTTP_UPDATE_SJS + "?uiURL=BILLBOARD";
if (params.remoteNoTypeAttr)
if (params.remoteNoTypeAttr) {
detailsURL += "&amp;remoteNoTypeAttr=1";
var extensionVersion = params.appVersion ? params.appVersion : "99.9";
var version = params.displayVersion ? params.displayVersion
: "version " + extensionVersion;
}
extensionVersion = params.appVersion ? params.appVersion : "99.9";
version = params.displayVersion ? params.displayVersion
: "version " + extensionVersion;
}
var updates = getRemoteUpdateString(patches, type, "App Update Test",
let updates = getRemoteUpdateString(patches, type, "App Update Test",
displayVersion, appVersion,
platformVersion, buildID, detailsURL,
billboardURL, licenseURL, showPrompt,
@ -185,13 +194,14 @@ function handleRequest(aRequest, aResponse) {
* queryString.
*/
function parseQueryString(aQueryString) {
var paramArray = aQueryString.split("&");
var regex = /^([^=]+)=(.*)$/;
var params = {};
for (var i = 0, sz = paramArray.length; i < sz; i++) {
var match = regex.exec(paramArray[i]);
if (!match)
let paramArray = aQueryString.split("&");
let regex = /^([^=]+)=(.*)$/;
let params = {};
for (let i = 0, sz = paramArray.length; i < sz; i++) {
let match = regex.exec(paramArray[i]);
if (!match) {
throw "Bad parameter in queryString! '" + paramArray[i] + "'";
}
params[decodeURIComponent(match[1])] = decodeURIComponent(match[2]);
}
@ -209,10 +219,10 @@ function parseQueryString(aQueryString) {
* manifest file.
*/
function getUpdateRDF(aParams) {
var addonVersion;
var addonID = aParams.addonID;
var addonUpdateType = addonID.split("_")[0];
var maxVersion = aParams.platformVersion;
let addonVersion;
let addonID = aParams.addonID;
let addonUpdateType = addonID.split("_")[0];
let maxVersion = aParams.platformVersion;
switch (addonUpdateType) {
case "updatecompatibility":
@ -265,20 +275,21 @@ function getUpdateRDF(aParams) {
* @return The contents of the file as a string.
*/
function readFileBytes(aFile) {
var fis = AUS_Cc["@mozilla.org/network/file-input-stream;1"].
createInstance(AUS_Ci.nsIFileInputStream);
let fis = Cc["@mozilla.org/network/file-input-stream;1"].
createInstance(Ci.nsIFileInputStream);
fis.init(aFile, -1, -1, false);
var bis = AUS_Cc["@mozilla.org/binaryinputstream;1"].
createInstance(AUS_Ci.nsIBinaryInputStream);
let bis = Cc["@mozilla.org/binaryinputstream;1"].
createInstance(Ci.nsIBinaryInputStream);
bis.setInputStream(fis);
var data = [];
var count = fis.available();
let data = [];
let count = fis.available();
while (count > 0) {
var bytes = bis.readByteArray(Math.min(65535, count));
let bytes = bis.readByteArray(Math.min(65535, count));
data.push(String.fromCharCode.apply(null, bytes));
count -= bytes.length;
if (bytes.length == 0)
if (bytes.length == 0) {
throw "Nothing read from input stream!";
}
}
data.join('');
fis.close();

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

@ -116,7 +116,13 @@
'use strict';
Components.utils.import("resource://gre/modules/AddonManager.jsm");
const { classes: Cc, interfaces: Ci, manager: Cm, results: Cr,
utils: Cu } = Components;
Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://gre/modules/Services.jsm");
const IS_MACOSX = ("nsILocalFileMac" in Ci);
// The tests have to use the pageid instead of the pageIndex due to the
// app update wizard's access method being random.
@ -202,7 +208,8 @@ var gDisableNoUpdateAddon = false;
// onload function.
var DEBUG_AUS_TEST = true;
#include ../shared.js
const DATA_URI_SPEC = "chrome://mochitests/content/chrome/toolkit/mozapps/update/tests/data/";
Services.scriptloader.loadSubScript(DATA_URI_SPEC + "shared.js", this);
/**
* The current test in TESTS array.
@ -269,7 +276,7 @@ this.__defineGetter__("gIncompatibleListbox", function() {
function runTestDefault() {
debugDump("entering");
if (!("@mozilla.org/zipwriter;1" in AUS_Cc)) {
if (!("@mozilla.org/zipwriter;1" in Cc)) {
ok(false, "nsIZipWriter is required to run these tests");
return;
}
@ -302,8 +309,7 @@ function runTestDefaultWaitForWindowClosed() {
// |closeUpdateWindow| will close it and cause the test to fail.
if (closeUpdateWindow()) {
SimpleTest.executeSoon(runTestDefaultWaitForWindowClosed);
}
else {
} else {
Services.ww.registerNotification(gWindowObserver);
gCloseWindowTimeoutCounter = 0;
@ -388,8 +394,7 @@ function finishTestDefaultWaitForWindowClosed() {
// |closeUpdateWindow| will close it and cause the test to fail.
if (closeUpdateWindow()) {
SimpleTest.executeSoon(finishTestDefaultWaitForWindowClosed);
}
else {
} else {
SimpleTest.finish();
}
}
@ -495,8 +500,7 @@ function delayedDefaultCallback() {
throw("Tests cannot have a buttonClick and an extraDelayedFinishFunction property");
}
gDocElem.getButton(gTest.buttonClick).click();
}
else if (gTest.extraDelayedFinishFunction) {
} else if (gTest.extraDelayedFinishFunction) {
debugDump("calling extraDelayedFinishFunction " +
gTest.extraDelayedFinishFunction.name);
gTest.extraDelayedFinishFunction();
@ -510,9 +514,9 @@ function delayedDefaultCallback() {
* @return nsILocalFile for the continue file.
*/
function getContinueFile() {
let continueFile = AUS_Cc["@mozilla.org/file/directory_service;1"].
getService(AUS_Ci.nsIProperties).
get("CurWorkD", AUS_Ci.nsILocalFile);
let continueFile = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).
get("CurWorkD", Ci.nsILocalFile);
let continuePath = REL_PATH_DATA + "/continue";
let continuePathParts = continuePath.split("/");
for (let i = 0; i < continuePathParts.length; ++i) {
@ -946,12 +950,13 @@ function resetFiles() {
// Not being able to remove the "updated" directory will not adversely affect
// subsequent tests so wrap it in a try block and don't test whether its
// removal was successful.
#ifdef XP_MACOSX
let updatedDir = getUpdatesDir();
updatedDir.append(DIR_PATCH);
#else
let updatedDir = getAppBaseDir();
#endif
let updatedDir;
if (IS_MACOSX) {
updatedDir = getUpdatesDir();
updatedDir.append(DIR_PATCH);
} else {
updatedDir = getAppBaseDir();
}
updatedDir.append(DIR_UPDATED);
if (updatedDir.exists()) {
try {
@ -970,8 +975,7 @@ function resetFiles() {
function resetPrefs() {
if (gAppUpdateURL !== undefined) {
Services.prefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, gAppUpdateURL);
}
else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_URL_OVERRIDE)) {
} else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_URL_OVERRIDE)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_URL_OVERRIDE);
}
@ -981,36 +985,31 @@ function resetPrefs() {
if (gAppUpdateEnabled !== undefined) {
Services.prefs.setBoolPref(PREF_APP_UPDATE_ENABLED, gAppUpdateEnabled);
}
else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_ENABLED)) {
} else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_ENABLED)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_ENABLED);
}
if (gAppUpdateMetroEnabled !== undefined) {
Services.prefs.setBoolPref(PREF_APP_UPDATE_METRO_ENABLED, gAppUpdateMetroEnabled);
}
else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_METRO_ENABLED)) {
} else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_METRO_ENABLED)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_METRO_ENABLED);
}
if (gAppUpdateServiceEnabled !== undefined) {
Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, gAppUpdateServiceEnabled);
}
else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_SERVICE_ENABLED)) {
} else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_SERVICE_ENABLED)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_SERVICE_ENABLED);
}
if (gAppUpdateStagingEnabled !== undefined) {
Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, gAppUpdateStagingEnabled);
}
else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_STAGING_ENABLED)) {
} else if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_STAGING_ENABLED)) {
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)) {
} else if (Services.prefs.prefHasUserValue(PREF_EXTENSIONS_UPDATE_URL)) {
Services.prefs.clearUserPref(PREF_EXTENSIONS_UPDATE_URL);
}
@ -1100,10 +1099,10 @@ function setupTimer(aTestTimeout) {
gTimeoutTimer.cancel();
gTimeoutTimer = null;
}
gTimeoutTimer = AUS_Cc["@mozilla.org/timer;1"].
createInstance(AUS_Ci.nsITimer);
gTimeoutTimer = Cc["@mozilla.org/timer;1"].
createInstance(Ci.nsITimer);
gTimeoutTimer.initWithCallback(finishTestTimeout, gTestTimeout,
AUS_Ci.nsITimer.TYPE_ONE_SHOT);
Ci.nsITimer.TYPE_ONE_SHOT);
}
/**
@ -1125,15 +1124,15 @@ function setupAddons(aCallback) {
function setNoUpdateAddonsDisabledState() {
AddonManager.getAllAddons(function(aAddons) {
aAddons.forEach(function(aAddon) {
if (aAddon.name.indexOf("noupdate") != 0)
if (aAddon.name.indexOf("noupdate") != 0) {
return;
}
if (gDisableNoUpdateAddon) {
if (!aAddon.userDisabled) {
aAddon.userDisabled = true;
}
}
else {
} else {
if (aAddon.userDisabled) {
aAddon.userDisabled = false;
}
@ -1292,7 +1291,7 @@ function getAddonTestType(aName) {
*/
function getTestAddonXPIFiles() {
let addonPrepDir = Services.dirsvc.get(NS_APP_USER_PROFILE_50_DIR,
AUS_Ci.nsILocalFile);
Ci.nsILocalFile);
addonPrepDir.append(ADDON_PREP_DIR);
let bootstrap = addonPrepDir.clone();
@ -1314,15 +1313,16 @@ function getTestAddonXPIFiles() {
let xpiFile = addonPrepDir.clone();
xpiFile.append(aName + ".xpi");
if (installRDF.exists())
if (installRDF.exists()) {
installRDF.remove(false);
}
writeFile(installRDF, getInstallRDFString(aName));
gZipW.open(xpiFile, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE);
gZipW.addEntryFile(installRDF.leafName,
AUS_Ci.nsIZipWriter.COMPRESSION_DEFAULT, installRDF,
Ci.nsIZipWriter.COMPRESSION_DEFAULT, installRDF,
false);
gZipW.addEntryFile(bootstrap.leafName,
AUS_Ci.nsIZipWriter.COMPRESSION_DEFAULT, bootstrap,
Ci.nsIZipWriter.COMPRESSION_DEFAULT, bootstrap,
false);
gZipW.close();
xpiFiles.push(xpiFile);
@ -1380,8 +1380,9 @@ function getInstallRDFString(aName) {
*/
function closeUpdateWindow() {
let updateWindow = getUpdateWindow();
if (!updateWindow)
if (!updateWindow) {
return false;
}
ok(false, "Found an existing Update Window from the current or a previous " +
"test... attempting to close it.");
@ -1402,7 +1403,7 @@ function getUpdateWindow() {
/**
* Helper for background check errors.
*/
var errorsPrefObserver = {
const errorsPrefObserver = {
observedPref: null,
maxErrorPref: null,
@ -1436,8 +1437,7 @@ var errorsPrefObserver = {
if (errCount >= errMax) {
debugDump("removing pref observer");
Services.prefs.removeObserver(this.observedPref, this);
}
else {
} else {
debugDump("notifying AUS");
SimpleTest.executeSoon(function() {
gAUS.notify(null);
@ -1450,9 +1450,9 @@ var errorsPrefObserver = {
/**
* nsIObserver for receiving window open and close notifications.
*/
var gWindowObserver = {
const gWindowObserver = {
observe: function WO_observe(aSubject, aTopic, aData) {
let win = aSubject.QueryInterface(AUS_Ci.nsIDOMEventTarget);
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
if (aTopic == "domwindowclosed") {
if (win.location != URI_UPDATE_PROMPT_DIALOG) {

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

@ -4,13 +4,8 @@
/* Shared code for xpcshell and mochitests-chrome */
// const Cc, Ci, and Cr are defined in netwerk/test/httpserver/httpd.js so we
// need to define unique ones.
const AUS_Cc = Components.classes;
const AUS_Ci = Components.interfaces;
const AUS_Cr = Components.results;
const AUS_Cu = Components.utils;
const AUS_Cm = Components.manager;
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const PREF_APP_UPDATE_AUTO = "app.update.auto";
const PREF_APP_UPDATE_BACKGROUNDERRORS = "app.update.backgroundErrors";
@ -62,11 +57,7 @@ const WRITE_ERROR = 7;
const DIR_PATCH = "0";
const DIR_TOBEDELETED = "tobedeleted";
const DIR_UPDATES = "updates";
#ifdef XP_MACOSX
const DIR_UPDATED = "Updated.app";
#else
const DIR_UPDATED = "updated";
#endif
const DIR_UPDATED = IS_MACOSX ? "Updated.app" : "updated";
const FILE_APPLICATION_INI = "application.ini";
const FILE_BACKUP_LOG = "backup-update.log";
@ -95,11 +86,7 @@ const DEFAULT_UPDATE_VERSION = "999999.0";
var gChannel;
#include sharedUpdateXML.js
AUS_Cu.import("resource://gre/modules/FileUtils.jsm");
AUS_Cu.import("resource://gre/modules/Services.jsm");
AUS_Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Services.scriptloader.loadSubScript(DATA_URI_SPEC + "sharedUpdateXML.js", this);
const PERMS_FILE = FileUtils.PERMS_FILE;
const PERMS_DIRECTORY = FileUtils.PERMS_DIRECTORY;
@ -115,11 +102,11 @@ const URI_UPDATES_PROPERTIES = "chrome://mozapps/locale/update/updates.propertie
const gUpdateBundle = Services.strings.createBundle(URI_UPDATES_PROPERTIES);
XPCOMUtils.defineLazyGetter(this, "gAUS", function test_gAUS() {
return AUS_Cc["@mozilla.org/updates/update-service;1"].
getService(AUS_Ci.nsIApplicationUpdateService).
QueryInterface(AUS_Ci.nsITimerCallback).
QueryInterface(AUS_Ci.nsIObserver).
QueryInterface(AUS_Ci.nsIUpdateCheckListener);
return Cc["@mozilla.org/updates/update-service;1"].
getService(Ci.nsIApplicationUpdateService).
QueryInterface(Ci.nsITimerCallback).
QueryInterface(Ci.nsIObserver).
QueryInterface(Ci.nsIUpdateCheckListener);
});
XPCOMUtils.defineLazyServiceGetter(this, "gUpdateManager",
@ -127,13 +114,13 @@ XPCOMUtils.defineLazyServiceGetter(this, "gUpdateManager",
"nsIUpdateManager");
XPCOMUtils.defineLazyGetter(this, "gUpdateChecker", function test_gUC() {
return AUS_Cc["@mozilla.org/updates/update-checker;1"].
createInstance(AUS_Ci.nsIUpdateChecker);
return Cc["@mozilla.org/updates/update-checker;1"].
createInstance(Ci.nsIUpdateChecker);
});
XPCOMUtils.defineLazyGetter(this, "gUP", function test_gUP() {
return AUS_Cc["@mozilla.org/updates/update-prompt;1"].
createInstance(AUS_Ci.nsIUpdatePrompt);
return Cc["@mozilla.org/updates/update-prompt;1"].
createInstance(Ci.nsIUpdatePrompt);
});
XPCOMUtils.defineLazyGetter(this, "gDefaultPrefBranch", function test_gDPB() {
@ -145,19 +132,19 @@ XPCOMUtils.defineLazyGetter(this, "gPrefRoot", function test_gPR() {
});
XPCOMUtils.defineLazyGetter(this, "gZipW", function test_gZipW() {
return AUS_Cc["@mozilla.org/zipwriter;1"].
createInstance(AUS_Ci.nsIZipWriter);
return Cc["@mozilla.org/zipwriter;1"].
createInstance(Ci.nsIZipWriter);
});
/* Initializes the update service stub */
function initUpdateServiceStub() {
AUS_Cc["@mozilla.org/updates/update-service-stub;1"].
createInstance(AUS_Ci.nsISupports);
Cc["@mozilla.org/updates/update-service-stub;1"].
createInstance(Ci.nsISupports);
}
/* Reloads the update metadata from disk */
function reloadUpdateManagerData() {
gUpdateManager.QueryInterface(AUS_Ci.nsIObserver).
gUpdateManager.QueryInterface(Ci.nsIObserver).
observe(null, "um-reload-update-data", "");
}
@ -174,17 +161,17 @@ function setUpdateChannel(aChannel) {
gPrefRoot.addObserver(PREF_APP_UPDATE_CHANNEL, observer, false);
}
var observer = {
const observer = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "nsPref:changed" && aData == PREF_APP_UPDATE_CHANNEL) {
var channel = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_CHANNEL);
let channel = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_CHANNEL);
if (channel != gChannel) {
debugDump("Changing channel from " + channel + " to " + gChannel);
gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_CHANNEL, gChannel);
}
}
},
QueryInterface: XPCOMUtils.generateQI([AUS_Ci.nsIObserver])
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
};
/**
@ -208,7 +195,7 @@ function setUpdateURLOverride(aURL) {
* return the updates.xml file.
*/
function getUpdatesXMLFile(aIsActiveUpdate) {
var file = getUpdatesRootDir();
let file = getUpdatesRootDir();
file.append(aIsActiveUpdate ? FILE_UPDATE_ACTIVE : FILE_UPDATES_DB);
return file;
}
@ -260,7 +247,7 @@ function writeVersionFile(aVersion) {
* @return nsIFile for the updates root directory.
*/
function getUpdatesRootDir() {
return Services.dirsvc.get(XRE_UPDATE_ROOT_DIR, AUS_Ci.nsIFile);
return Services.dirsvc.get(XRE_UPDATE_ROOT_DIR, Ci.nsIFile);
}
/**
@ -269,7 +256,7 @@ function getUpdatesRootDir() {
* @return nsIFile for the updates directory.
*/
function getUpdatesDir() {
var dir = getUpdatesRootDir();
let dir = getUpdatesRootDir();
dir.append(DIR_UPDATES);
return dir;
}
@ -296,10 +283,11 @@ function getUpdatesPatchDir() {
* replaced.
*/
function writeFile(aFile, aText) {
var fos = AUS_Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(AUS_Ci.nsIFileOutputStream);
if (!aFile.exists())
aFile.create(AUS_Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
let fos = Cc["@mozilla.org/network/file-output-stream;1"].
createInstance(Ci.nsIFileOutputStream);
if (!aFile.exists()) {
aFile.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
}
fos.init(aFile, MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE, PERMS_FILE, 0);
fos.write(aText, aText.length);
fos.close();
@ -351,15 +339,16 @@ function readStatusFailedCode() {
* @return The string of text read from the file.
*/
function readFile(aFile) {
var fis = AUS_Cc["@mozilla.org/network/file-input-stream;1"].
createInstance(AUS_Ci.nsIFileInputStream);
if (!aFile.exists())
let fis = Cc["@mozilla.org/network/file-input-stream;1"].
createInstance(Ci.nsIFileInputStream);
if (!aFile.exists()) {
return null;
}
fis.init(aFile, MODE_RDONLY, PERMS_FILE, 0);
var sis = AUS_Cc["@mozilla.org/scriptableinputstream;1"].
createInstance(AUS_Ci.nsIScriptableInputStream);
let sis = Cc["@mozilla.org/scriptableinputstream;1"].
createInstance(Ci.nsIScriptableInputStream);
sis.init(fis);
var text = sis.read(sis.available());
let text = sis.read(sis.available());
sis.close();
return text;
}
@ -372,20 +361,21 @@ function readFile(aFile) {
* @return The contents of the file as a string.
*/
function readFileBytes(aFile) {
var fis = AUS_Cc["@mozilla.org/network/file-input-stream;1"].
createInstance(AUS_Ci.nsIFileInputStream);
let fis = Cc["@mozilla.org/network/file-input-stream;1"].
createInstance(Ci.nsIFileInputStream);
fis.init(aFile, -1, -1, false);
var bis = AUS_Cc["@mozilla.org/binaryinputstream;1"].
createInstance(AUS_Ci.nsIBinaryInputStream);
let bis = Cc["@mozilla.org/binaryinputstream;1"].
createInstance(Ci.nsIBinaryInputStream);
bis.setInputStream(fis);
var data = [];
var count = fis.available();
let data = [];
let count = fis.available();
while (count > 0) {
var bytes = bis.readByteArray(Math.min(65535, count));
let bytes = bis.readByteArray(Math.min(65535, count));
data.push(String.fromCharCode.apply(null, bytes));
count -= bytes.length;
if (bytes.length == 0)
if (bytes.length == 0) {
throw "Nothing read from input stream!";
}
}
data.join('');
fis.close();
@ -414,7 +404,7 @@ function getString(aName) {
* @return The file extension.
*/
function getFileExtension(aFile) {
return Services.io.newFileURI(aFile).QueryInterface(AUS_Ci.nsIURL).
return Services.io.newFileURI(aFile).QueryInterface(Ci.nsIURL).
fileExtension;
}
@ -425,10 +415,11 @@ function getFileExtension(aFile) {
* tests are interrupted.
*/
function removeUpdateDirsAndFiles() {
var file = getUpdatesXMLFile(true);
let file = getUpdatesXMLFile(true);
try {
if (file.exists())
if (file.exists()) {
file.remove(false);
}
} catch (e) {
logTestInfo("Unable to remove file. Path: " + file.path +
", Exception: " + e);
@ -436,15 +427,16 @@ function removeUpdateDirsAndFiles() {
file = getUpdatesXMLFile(false);
try {
if (file.exists())
if (file.exists()) {
file.remove(false);
}
} catch (e) {
logTestInfo("Unable to remove file. Path: " + file.path +
", Exception: " + e);
}
// This fails sporadically on Mac OS X so wrap it in a try catch
var updatesDir = getUpdatesDir();
let updatesDir = getUpdatesDir();
try {
cleanUpdatesDir(updatesDir);
} catch (e) {
@ -461,12 +453,13 @@ function removeUpdateDirsAndFiles() {
* nsIFile for the directory to be deleted.
*/
function cleanUpdatesDir(aDir) {
if (!aDir.exists())
if (!aDir.exists()) {
return;
}
var dirEntries = aDir.directoryEntries;
let dirEntries = aDir.directoryEntries;
while (dirEntries.hasMoreElements()) {
var entry = dirEntries.getNext().QueryInterface(AUS_Ci.nsIFile);
let entry = dirEntries.getNext().QueryInterface(Ci.nsIFile);
if (entry.isDirectory()) {
if (entry.leafName == DIR_PATCH && entry.parent.leafName == DIR_UPDATES) {
@ -522,9 +515,9 @@ function removeDirRecursive(aDir) {
logTestInfo("non-fatal error removing directory. Exception: " + e);
}
var dirEntries = aDir.directoryEntries;
let dirEntries = aDir.directoryEntries;
while (dirEntries.hasMoreElements()) {
var entry = dirEntries.getNext().QueryInterface(AUS_Ci.nsIFile);
let entry = dirEntries.getNext().QueryInterface(Ci.nsIFile);
if (entry.isDirectory()) {
removeDirRecursive(entry);
@ -558,7 +551,7 @@ function removeDirRecursive(aDir) {
* @return nsIFile for the current process directory.
*/
function getCurrentProcessDir() {
return Services.dirsvc.get(NS_XPCOM_CURRENT_PROCESS_DIR, AUS_Ci.nsIFile);
return Services.dirsvc.get(NS_XPCOM_CURRENT_PROCESS_DIR, Ci.nsIFile);
}
/**
@ -567,7 +560,7 @@ function getCurrentProcessDir() {
* @return nsIFile object for the application base directory.
*/
function getAppBaseDir() {
return Services.dirsvc.get(XRE_EXECUTABLE_FILE, AUS_Ci.nsIFile).parent;
return Services.dirsvc.get(XRE_EXECUTABLE_FILE, Ci.nsIFile).parent;
}
/**
@ -578,7 +571,7 @@ function getAppBaseDir() {
* @return nsIFile for the Gecko Runtime Engine directory.
*/
function getGREDir() {
return Services.dirsvc.get(NS_GRE_DIR, AUS_Ci.nsIFile);
return Services.dirsvc.get(NS_GRE_DIR, Ci.nsIFile);
}
/**
@ -591,7 +584,7 @@ function getGREDir() {
* @return nsIFile for the Gecko Runtime Engine Binary directory.
*/
function getGREBinDir() {
return Services.dirsvc.get(NS_GRE_BIN_DIR, AUS_Ci.nsIFile);
return Services.dirsvc.get(NS_GRE_BIN_DIR, Ci.nsIFile);
}
/**

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

@ -97,8 +97,9 @@ function getRemotePatchString(aType, aURL, aHashFunction, aHashValue, aSize) {
* @return The string representing a local update xml file.
*/
function getLocalUpdatesXMLString(aUpdates) {
if (!aUpdates || aUpdates == "")
if (!aUpdates || aUpdates == "") {
return "<updates xmlns=\"http://www.mozilla.org/2005/app-update\"/>"
}
return ("<updates xmlns=\"http://www.mozilla.org/2005/app-update\">" +
aUpdates +
"</updates>").replace(/>\s+\n*</g,'><');

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

@ -0,0 +1,70 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
/* Preprocessed constants used by xpcshell tests */
const INSTALL_LOCALE = "@AB_CD@";
const MOZ_APP_NAME = "@MOZ_APP_NAME@";
const BIN_SUFFIX = "@BIN_SUFFIX@";
// MOZ_APP_VENDOR is optional.
#ifdef MOZ_APP_VENDOR
const MOZ_APP_VENDOR = "@MOZ_APP_VENDOR@";
#else
const MOZ_APP_VENDOR = "";
#endif
// MOZ_APP_BASENAME is not optional for tests.
const MOZ_APP_BASENAME = "@MOZ_APP_BASENAME@";
const APP_BIN_SUFFIX = "@BIN_SUFFIX@";
const APP_INFO_NAME = "XPCShell";
const APP_INFO_VENDOR = "Mozilla";
#ifdef XP_WIN
const IS_WIN = true;
#else
const IS_WIN = false;
#endif
#ifdef XP_MACOSX
const IS_MACOSX = true;
#ifdef MOZ_SHARK
const IS_SHARK = true;
#else
const IS_SHARK = false;
#endif
#else
const IS_MACOSX = false;
#endif
#ifdef XP_UNIX
const IS_UNIX = true;
#else
const IS_UNIX = false;
#endif
#ifdef ANDROID
const IS_ANDROID = true;
#else
const IS_ANDROID = false;
#endif
#ifdef MOZ_WIDGET_GONK
const IS_TOOLKIT_GONK = true;
#else
const IS_TOOLKIT_GONK = false;
#endif
#ifdef MOZ_VERIFY_MAR_SIGNATURE
const IS_MAR_CHECKS_ENABLED = true;
#else
const IS_MAR_CHECKS_ENABLED = false;
#endif
#ifdef DISABLE_UPDATER_AUTHENTICODE_CHECK
const IS_AUTHENTICODE_CHECK_ENABLED = false;
#else
const IS_AUTHENTICODE_CHECK_ENABLED = true;
#endif

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -10,7 +10,7 @@ function run_test() {
logTestInfo("testing write access to the application directory");
let testFile = getCurrentProcessDir();
testFile.append("update_write_access_test");
testFile.create(AUS_Ci.nsIFile.NORMAL_FILE_TYPE, PERMS_FILE);
testFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, PERMS_FILE);
do_check_true(testFile.exists());
testFile.remove(false);
do_check_false(testFile.exists());
@ -71,14 +71,14 @@ function getPerInstallationMutexName() {
do_throw("Windows only function called by a different platform!");
}
let hasher = AUS_Cc["@mozilla.org/security/hash;1"].
createInstance(AUS_Ci.nsICryptoHash);
let hasher = Cc["@mozilla.org/security/hash;1"].
createInstance(Ci.nsICryptoHash);
hasher.init(hasher.SHA1);
let exeFile = Services.dirsvc.get(XRE_EXECUTABLE_FILE, AUS_Ci.nsILocalFile);
let exeFile = Services.dirsvc.get(XRE_EXECUTABLE_FILE, Ci.nsILocalFile);
let converter = AUS_Cc["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(AUS_Ci.nsIScriptableUnicodeConverter);
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
let data = converter.convertToByteArray(exeFile.path.toLowerCase());

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

@ -11,10 +11,9 @@ function run_test() {
logTestInfo("testing removal of an active update for a channel that is not" +
"valid due to switching channels (Bug 486275).");
var patches, updates, update;
patches = getLocalPatchString(null, null, null, null, null, null,
STATE_DOWNLOADING);
updates = getLocalUpdateString(patches, null, null, "version 1.0", "1.0");
let patches = getLocalPatchString(null, null, null, null, null, null,
STATE_DOWNLOADING);
let updates = getLocalUpdateString(patches, null, null, "version 1.0", "1.0");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeStatusFile(STATE_DOWNLOADING);
@ -30,7 +29,7 @@ function run_test() {
standardInit();
do_check_eq(gUpdateManager.updateCount, 1);
update = gUpdateManager.getUpdateAt(0);
let update = gUpdateManager.getUpdateAt(0);
do_check_eq(update.name, "Existing");
do_check_eq(gUpdateManager.activeUpdate, null);

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

@ -10,11 +10,9 @@ function run_test() {
logTestInfo("testing cleanup of an update download in progress for an " +
"older version of the application on startup (Bug 485624)");
var patches, updates;
patches = getLocalPatchString(null, null, null, null, null, null,
STATE_DOWNLOADING);
updates = getLocalUpdateString(patches, null, null, "version 0.9", "0.9");
let patches = getLocalPatchString(null, null, null, null, null, null,
STATE_DOWNLOADING);
let updates = getLocalUpdateString(patches, null, null, "version 0.9", "0.9");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeStatusFile(STATE_DOWNLOADING);

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

@ -10,12 +10,10 @@ function run_test() {
"same version of the application with the same application " +
"build id on startup (Bug 536547)");
var patches, updates;
patches = getLocalPatchString(null, null, null, null, null, null,
STATE_DOWNLOADING);
updates = getLocalUpdateString(patches, null, null, "version 1.0", "1.0", null,
"2007010101");
let patches = getLocalPatchString(null, null, null, null, null, null,
STATE_DOWNLOADING);
let updates = getLocalUpdateString(patches, null, null, "version 1.0", "1.0",
null, "2007010101");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeStatusFile(STATE_DOWNLOADING);

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

@ -10,20 +10,20 @@ function run_test() {
"STATE_DOWNLOADING (Bug 539717).");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
var patches = getLocalPatchString(null, null, null, null, null, null,
let patches = getLocalPatchString(null, null, null, null, null, null,
STATE_DOWNLOADING);
var updates = getLocalUpdateString(patches);
let updates = getLocalUpdateString(patches);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeStatusFile(STATE_NONE);
standardInit();
var dir = getUpdatesDir();
let dir = getUpdatesDir();
dir.append("0");
logTestInfo("testing " + dir.path + " should exist");
do_check_true(dir.exists());
var statusFile = dir.clone();
let statusFile = dir.clone();
statusFile.append(FILE_UPDATE_STATUS);
logTestInfo("testing " + statusFile.path + " should not exist");
do_check_false(statusFile.exists());

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

@ -10,9 +10,9 @@ function run_test() {
"update xml has an update with STATE_PENDING (Bug 601701).");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
var patches = getLocalPatchString(null, null, null, null, null, null,
let patches = getLocalPatchString(null, null, null, null, null, null,
STATE_PENDING);
var updates = getLocalUpdateString(patches);
let updates = getLocalUpdateString(patches);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeVersionFile("99.9");
@ -25,12 +25,12 @@ function run_test() {
logTestInfo("testing updateCount == 0");
do_check_eq(gUpdateManager.updateCount, 0);
var dir = getUpdatesDir();
let dir = getUpdatesDir();
dir.append("0");
logTestInfo("testing " + dir.path + " should exist");
do_check_true(dir.exists());
var versionFile = dir.clone();
let versionFile = dir.clone();
versionFile.append(FILE_UPDATE_VERSION);
logTestInfo("testing " + versionFile.path + " should not exist");
do_check_false(versionFile.exists());

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

@ -9,14 +9,14 @@ function run_test() {
logTestInfo("testing that the update.log is moved after a successful update");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
var patches = getLocalPatchString(null, null, null, null, null, null,
let patches = getLocalPatchString(null, null, null, null, null, null,
STATE_PENDING);
var updates = getLocalUpdateString(patches);
let updates = getLocalUpdateString(patches);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeStatusFile(STATE_SUCCEEDED);
var dir = getUpdatesDir();
var log = dir.clone();
let dir = getUpdatesDir();
let log = dir.clone();
log.append("0");
log.append(FILE_UPDATE_LOG);
writeFile(log, "Last Update Log");

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

@ -9,14 +9,14 @@ function run_test() {
logTestInfo("testing update logs are first in first out deleted");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
var patches = getLocalPatchString(null, null, null, null, null, null,
let patches = getLocalPatchString(null, null, null, null, null, null,
STATE_PENDING);
var updates = getLocalUpdateString(patches);
let updates = getLocalUpdateString(patches);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeStatusFile(STATE_SUCCEEDED);
var dir = getUpdatesDir();
var log = dir.clone();
let dir = getUpdatesDir();
let log = dir.clone();
log.append(FILE_LAST_LOG);
writeFile(log, "Backup Update Log");

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

@ -32,12 +32,12 @@ function callHandleEvent() {
gXHR.status = 400;
gXHR.responseText = gResponseBody;
try {
var parser = AUS_Cc["@mozilla.org/xmlextras/domparser;1"].
createInstance(AUS_Ci.nsIDOMParser);
let parser = Cc["@mozilla.org/xmlextras/domparser;1"].
createInstance(Ci.nsIDOMParser);
gXHR.responseXML = parser.parseFromString(gResponseBody, "application/xml");
} catch(e) {
}
var e = { target: gXHR };
let e = { target: gXHR };
gXHR.onload(e);
}
@ -57,10 +57,11 @@ function run_test_helper_pt1(aMsg, aExpectedStatusResult, aNextRunFunc) {
function check_test_helper_pt1_1() {
do_check_eq(gUpdateCount, 1);
gCheckFunc = check_test_helper_pt1_2;
var bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
var state = gAUS.downloadUpdate(bestUpdate, false);
if (state == STATE_NONE || state == STATE_FAILED)
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
let state = gAUS.downloadUpdate(bestUpdate, false);
if (state == STATE_NONE || state == STATE_FAILED) {
do_throw("nsIApplicationUpdateService:downloadUpdate returned " + state);
}
gAUS.addDownloadListener(downloadListener);
}
@ -87,16 +88,17 @@ function run_test_helper_bug828858_pt1(aMsg, aExpectedStatusResult, aNextRunFunc
function check_test_helper_bug828858_pt1_1() {
do_check_eq(gUpdateCount, 1);
gCheckFunc = check_test_helper_bug828858_pt1_2;
var bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
var state = gAUS.downloadUpdate(bestUpdate, false);
if (state == STATE_NONE || state == STATE_FAILED)
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
let state = gAUS.downloadUpdate(bestUpdate, false);
if (state == STATE_NONE || state == STATE_FAILED) {
do_throw("nsIApplicationUpdateService:downloadUpdate returned " + state);
}
gAUS.addDownloadListener(downloadListener);
}
function check_test_helper_bug828858_pt1_2() {
if (gStatusResult == AUS_Cr.NS_ERROR_CONTENT_CORRUPTED) {
do_check_eq(gStatusResult, AUS_Cr.NS_ERROR_CONTENT_CORRUPTED);
if (gStatusResult == Cr.NS_ERROR_CONTENT_CORRUPTED) {
do_check_eq(gStatusResult, Cr.NS_ERROR_CONTENT_CORRUPTED);
} else {
do_check_eq(gStatusResult, gExpectedStatusResult);
}
@ -105,9 +107,9 @@ function check_test_helper_bug828858_pt1_2() {
}
function setResponseBody(aHashFunction, aHashValue, aSize) {
var patches = getRemotePatchString(null, null,
let patches = getRemotePatchString(null, null,
aHashFunction, aHashValue, aSize);
var updates = getRemoteUpdateString(patches);
let updates = getRemoteUpdateString(patches);
gResponseBody = getRemoteUpdatesXMLString(updates);
}
@ -115,79 +117,79 @@ function setResponseBody(aHashFunction, aHashValue, aSize) {
function run_test_pt1() {
setResponseBody("MD5", MD5_HASH_SIMPLE_MAR);
run_test_helper_pt1("mar download with a valid MD5 hash",
AUS_Cr.NS_OK, run_test_pt2);
Cr.NS_OK, run_test_pt2);
}
// mar download with an invalid MD5 hash
function run_test_pt2() {
setResponseBody("MD5", MD5_HASH_SIMPLE_MAR + "0");
run_test_helper_pt1("mar download with an invalid MD5 hash",
AUS_Cr.NS_ERROR_CORRUPTED_CONTENT, run_test_pt3);
Cr.NS_ERROR_CORRUPTED_CONTENT, run_test_pt3);
}
// mar download with a valid SHA1 hash
function run_test_pt3() {
setResponseBody("SHA1", SHA1_HASH_SIMPLE_MAR);
run_test_helper_pt1("mar download with a valid SHA1 hash",
AUS_Cr.NS_OK, run_test_pt4);
Cr.NS_OK, run_test_pt4);
}
// mar download with an invalid SHA1 hash
function run_test_pt4() {
setResponseBody("SHA1", SHA1_HASH_SIMPLE_MAR + "0");
run_test_helper_pt1("mar download with an invalid SHA1 hash",
AUS_Cr.NS_ERROR_CORRUPTED_CONTENT, run_test_pt5);
Cr.NS_ERROR_CORRUPTED_CONTENT, run_test_pt5);
}
// mar download with a valid SHA256 hash
function run_test_pt5() {
setResponseBody("SHA256", SHA256_HASH_SIMPLE_MAR);
run_test_helper_pt1("mar download with a valid SHA256 hash",
AUS_Cr.NS_OK, run_test_pt6);
Cr.NS_OK, run_test_pt6);
}
// mar download with an invalid SHA256 hash
function run_test_pt6() {
setResponseBody("SHA256", SHA256_HASH_SIMPLE_MAR + "0");
run_test_helper_pt1("mar download with an invalid SHA256 hash",
AUS_Cr.NS_ERROR_CORRUPTED_CONTENT, run_test_pt7);
Cr.NS_ERROR_CORRUPTED_CONTENT, run_test_pt7);
}
// mar download with a valid SHA384 hash
function run_test_pt7() {
setResponseBody("SHA384", SHA384_HASH_SIMPLE_MAR);
run_test_helper_pt1("mar download with a valid SHA384 hash",
AUS_Cr.NS_OK, run_test_pt8);
Cr.NS_OK, run_test_pt8);
}
// mar download with an invalid SHA384 hash
function run_test_pt8() {
setResponseBody("SHA384", SHA384_HASH_SIMPLE_MAR + "0");
run_test_helper_pt1("mar download with an invalid SHA384 hash",
AUS_Cr.NS_ERROR_CORRUPTED_CONTENT, run_test_pt9);
Cr.NS_ERROR_CORRUPTED_CONTENT, run_test_pt9);
}
// mar download with a valid SHA512 hash
function run_test_pt9() {
setResponseBody("SHA512", SHA512_HASH_SIMPLE_MAR);
run_test_helper_pt1("mar download with a valid SHA512 hash",
AUS_Cr.NS_OK, run_test_pt10);
Cr.NS_OK, run_test_pt10);
}
// mar download with an invalid SHA512 hash
function run_test_pt10() {
setResponseBody("SHA512", SHA512_HASH_SIMPLE_MAR + "0");
run_test_helper_pt1("mar download with an invalid SHA512 hash",
AUS_Cr.NS_ERROR_CORRUPTED_CONTENT, run_test_pt11);
Cr.NS_ERROR_CORRUPTED_CONTENT, run_test_pt11);
}
// mar download with the mar not found
function run_test_pt11() {
var patches = getRemotePatchString(null, gURLData + "missing.mar");
var updates = getRemoteUpdateString(patches);
let patches = getRemotePatchString(null, gURLData + "missing.mar");
let updates = getRemoteUpdateString(patches);
gResponseBody = getRemoteUpdatesXMLString(updates);
run_test_helper_pt1("mar download with the mar not found",
AUS_Cr.NS_ERROR_UNEXPECTED, run_test_pt12);
Cr.NS_ERROR_UNEXPECTED, run_test_pt12);
}
// mar download with a valid MD5 hash but invalid file size
@ -202,9 +204,9 @@ function run_test_pt12() {
// NS_ERROR_CONTENT_CORRUPTED.
// Bug 828858 was filed to follow up on this issue.
run_test_helper_bug828858_pt1("mar download with a valid MD5 hash but invalid file size",
AUS_Cr.NS_ERROR_UNEXPECTED, finish_test);
Cr.NS_ERROR_UNEXPECTED, finish_test);
} else {
run_test_helper_pt1("mar download with a valid MD5 hash but invalid file size",
AUS_Cr.NS_ERROR_UNEXPECTED, finish_test);
Cr.NS_ERROR_UNEXPECTED, finish_test);
}
}

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

@ -13,7 +13,7 @@ function run_test() {
Services.prefs.setBoolPref(PREF_APP_UPDATE_SILENT, false);
let registrar = Components.manager.QueryInterface(AUS_Ci.nsIComponentRegistrar);
let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.registerFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"),
"Fake Window Watcher",
"@mozilla.org/embedcomp/window-watcher;1",
@ -34,18 +34,18 @@ function run_test() {
let update = gUpdateManager.activeUpdate;
update.errorCode = WRITE_ERROR;
let prompter = AUS_Cc["@mozilla.org/updates/update-prompt;1"].
createInstance(AUS_Ci.nsIUpdatePrompt);
let prompter = Cc["@mozilla.org/updates/update-prompt;1"].
createInstance(Ci.nsIUpdatePrompt);
prompter.showUpdateError(update);
}
function end_test() {
let registrar = Components.manager.QueryInterface(AUS_Ci.nsIComponentRegistrar);
let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.unregisterFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"),
WindowWatcherFactory);
}
var WindowWatcher = {
const WindowWatcher = {
getNewPrompter: function(aParent) {
do_check_eq(aParent, null);
return {
@ -62,19 +62,20 @@ var WindowWatcher = {
};
},
QueryInterface: function(iid) {
if (iid.equals(AUS_Ci.nsIWindowWatcher) ||
iid.equals(AUS_Ci.nsISupports))
QueryInterface: function(aIID) {
if (aIID.equals(Ci.nsIWindowWatcher) ||
aIID.equals(Ci.nsISupports)) {
return this;
throw AUS_Cr.NS_ERROR_NO_INTERFACE;
}
}
var WindowWatcherFactory = {
createInstance: function createInstance(outer, iid) {
if (outer != null)
throw AUS_Cr.NS_ERROR_NO_AGGREGATION;
return WindowWatcher.QueryInterface(iid);
}
throw Cr.NS_ERROR_NO_INTERFACE;
}
};
const WindowWatcherFactory = {
createInstance: function createInstance(aOuter, aIID) {
if (aOuter != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
}
return WindowWatcher.QueryInterface(aIID);
}
};

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

@ -13,12 +13,12 @@ let gOldProviders;
function FakeDirProvider() {}
FakeDirProvider.prototype = {
classID: Components.ID("{f30b43a7-2bfa-4e5f-8c4f-abc7dd4ac486}"),
QueryInterface: XPCOMUtils.generateQI([AUS_Ci.nsIDirectoryServiceProvider]),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDirectoryServiceProvider]),
getFile: function(prop, persistent) {
if (prop == KEY_UPDATE_ARCHIVE_DIR) {
if (gActiveUpdate) {
gActiveUpdate.errorCode = AUS_Cr.NS_ERROR_FILE_TOO_BIG;
gActiveUpdate.errorCode = Cr.NS_ERROR_FILE_TOO_BIG;
}
}
return null;
@ -37,17 +37,17 @@ function run_test() {
gDirProvider = new FakeDirProvider();
let cm = AUS_Cc["@mozilla.org/categorymanager;1"].getService(AUS_Ci.nsICategoryManager);
let cm = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
gOldProviders = [];
let enumerator = cm.enumerateCategory("xpcom-directory-providers");
while (enumerator.hasMoreElements()) {
let entry = enumerator.getNext().QueryInterface(AUS_Ci.nsISupportsCString).data;
let entry = enumerator.getNext().QueryInterface(Ci.nsISupportsCString).data;
let contractID = cm.getCategoryEntry("xpcom-directory-providers", entry);
gOldProviders.push(AUS_Cc[contractID].createInstance(AUS_Ci.nsIDirectoryServiceProvider));
gOldProviders.push(Cc[contractID].createInstance(Ci.nsIDirectoryServiceProvider));
}
gDirService = AUS_Cc["@mozilla.org/file/directory_service;1"]
.getService(AUS_Ci.nsIProperties);
gDirService = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
gOldProviders.forEach(function (p) {
gDirService.unregisterProvider(p);
@ -62,13 +62,13 @@ function xhr_pt1() {
gXHR.status = 200;
gXHR.responseText = gResponseBody;
try {
var parser = AUS_Cc["@mozilla.org/xmlextras/domparser;1"].
createInstance(AUS_Ci.nsIDOMParser);
let parser = Cc["@mozilla.org/xmlextras/domparser;1"].
createInstance(Ci.nsIDOMParser);
gXHR.responseXML = parser.parseFromString(gResponseBody, "application/xml");
} catch (e) {
gXHR.responseXML = null;
}
var e = { target: gXHR };
let e = { target: gXHR };
gXHR.onload(e);
}
@ -92,7 +92,7 @@ function check_test_pt1() {
let state = gAUS.downloadUpdate(gActiveUpdate, true);
do_check_eq(state, "null");
do_check_eq(gActiveUpdate.errorCode >>> 0 , AUS_Cr.NS_ERROR_FILE_TOO_BIG);
do_check_eq(gActiveUpdate.errorCode >>> 0 , Cr.NS_ERROR_FILE_TOO_BIG);
doTestFinish();
}

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

@ -31,12 +31,12 @@ function run_test_pt1() {
}
function xhr_pt1() {
gXHR.status = AUS_Cr.NS_ERROR_OFFLINE;
gXHR.status = Cr.NS_ERROR_OFFLINE;
gXHR.onerror({ target: gXHR });
}
function check_test_pt1(request, update) {
do_check_eq(gStatusCode, AUS_Cr.NS_ERROR_OFFLINE);
do_check_eq(gStatusCode, Cr.NS_ERROR_OFFLINE);
do_check_eq(update.errorCode, NETWORK_ERROR_OFFLINE);
// Forward the error to AUS, which should register the online observer
@ -47,22 +47,22 @@ function check_test_pt1(request, update) {
Services.obs.notifyObservers(gAUS, "network:offline-status-changed", "online");
}
var updatePrompt = {
const updatePrompt = {
showUpdateAvailable: function(update) {
check_test_pt2(update);
}
};
function xhr_pt2() {
var patches = getLocalPatchString();
var updates = getLocalUpdateString(patches);
var responseBody = getLocalUpdatesXMLString(updates);
let patches = getLocalPatchString();
let updates = getLocalUpdateString(patches);
let responseBody = getLocalUpdatesXMLString(updates);
gXHR.status = 200;
gXHR.responseText = responseBody;
try {
var parser = AUS_Cc["@mozilla.org/xmlextras/domparser;1"].
createInstance(AUS_Ci.nsIDOMParser);
let parser = Cc["@mozilla.org/xmlextras/domparser;1"].
createInstance(Ci.nsIDOMParser);
gXHR.responseXML = parser.parseFromString(responseBody, "application/xml");
} catch (e) {
}

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

@ -46,12 +46,12 @@ function callHandleEvent() {
gXHR.status = 400;
gXHR.responseText = gResponseBody;
try {
var parser = AUS_Cc["@mozilla.org/xmlextras/domparser;1"].
createInstance(AUS_Ci.nsIDOMParser);
let parser = Cc["@mozilla.org/xmlextras/domparser;1"].
createInstance(Ci.nsIDOMParser);
gXHR.responseXML = parser.parseFromString(gResponseBody, "application/xml");
} catch (e) {
}
var e = { target: gXHR };
let e = { target: gXHR };
gXHR.onload(e);
}
@ -71,10 +71,11 @@ function run_test_helper_pt1(aMsg, aExpectedStatusResult, aNextRunFunc) {
function check_test_helper_pt1_1() {
do_check_eq(gUpdateCount, 1);
gCheckFunc = check_test_helper_pt1_2;
var bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
var state = gAUS.downloadUpdate(bestUpdate, false);
if (state == STATE_NONE || state == STATE_FAILED)
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
let state = gAUS.downloadUpdate(bestUpdate, false);
if (state == STATE_NONE || state == STATE_FAILED) {
do_throw("nsIApplicationUpdateService:downloadUpdate returned " + state);
}
gAUS.addDownloadListener(downloadListener);
}
@ -85,38 +86,38 @@ function check_test_helper_pt1_2() {
}
function setResponseBody(aHashFunction, aHashValue, aSize) {
var patches = getRemotePatchString(null, null,
let patches = getRemotePatchString(null, null,
aHashFunction, aHashValue, aSize);
var updates = getRemoteUpdateString(patches);
let updates = getRemoteUpdateString(patches);
gResponseBody = getRemoteUpdatesXMLString(updates);
}
var newFactory = {
const newFactory = {
createInstance: function(aOuter, aIID) {
if (aOuter)
throw Components.results.NS_ERROR_NO_AGGREGATION;
if (aOuter) {
throw Cr.NS_ERROR_NO_AGGREGATION;
}
return new IncrementalDownload().QueryInterface(aIID);
},
lockFactory: function(aLock) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
QueryInterface: XPCOMUtils.generateQI([AUS_Ci.nsIFactory])
QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory])
};
function initMockIncrementalDownload() {
var registrar = AUS_Cm.QueryInterface(AUS_Ci.nsIComponentRegistrar);
let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
gIncrementalDownloadClassID = registrar.contractIDToCID(INC_CONTRACT_ID);
gIncOldFactory = AUS_Cm.getClassObject(AUS_Cc[INC_CONTRACT_ID],
AUS_Ci.nsIFactory);
gIncOldFactory = Cm.getClassObject(Cc[INC_CONTRACT_ID], Ci.nsIFactory);
registrar.unregisterFactory(gIncrementalDownloadClassID, gIncOldFactory);
var components = [IncrementalDownload];
let components = [IncrementalDownload];
registrar.registerFactory(gIncrementalDownloadClassID, "",
INC_CONTRACT_ID, newFactory);
}
function cleanupMockIncrementalDownload() {
if (gIncOldFactory) {
var registrar = AUS_Cm.QueryInterface(AUS_Ci.nsIComponentRegistrar);
let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.unregisterFactory(gIncrementalDownloadClassID, newFactory);
registrar.registerFactory(gIncrementalDownloadClassID, "",
INC_CONTRACT_ID, gIncOldFactory);
@ -135,8 +136,6 @@ function IncrementalDownload() {
}
IncrementalDownload.prototype = {
QueryInterface: XPCOMUtils.generateQI([AUS_Ci.nsIIncrementalDownload]),
/* nsIIncrementalDownload */
init: function(uri, file, chunkSize, intervalInSeconds) {
this._destination = file;
@ -145,45 +144,45 @@ IncrementalDownload.prototype = {
},
start: function(observer, ctxt) {
var tm = Components.classes["@mozilla.org/thread-manager;1"].
getService(AUS_Ci.nsIThreadManager);
let tm = Cc["@mozilla.org/thread-manager;1"].
getService(Ci.nsIThreadManager);
// Do the actual operation async to give a chance for observers
// to add themselves.
tm.mainThread.dispatch(function() {
this._observer = observer.QueryInterface(AUS_Ci.nsIRequestObserver);
this._observer = observer.QueryInterface(Ci.nsIRequestObserver);
this._ctxt = ctxt;
this._observer.onStartRequest(this, this._ctxt);
let mar = getTestDirFile(FILE_SIMPLE_MAR);
mar.copyTo(this._destination.parent, this._destination.leafName);
var status = AUS_Cr.NS_OK
let status = Cr.NS_OK
switch (gIncrementalDownloadErrorType++) {
case 0:
status = AUS_Cr.NS_ERROR_NET_RESET;
break;
status = Cr.NS_ERROR_NET_RESET;
break;
case 1:
status = AUS_Cr.NS_ERROR_CONNECTION_REFUSED;
break;
status = Cr.NS_ERROR_CONNECTION_REFUSED;
break;
case 2:
status = AUS_Cr.NS_ERROR_NET_RESET;
break;
status = Cr.NS_ERROR_NET_RESET;
break;
case 3:
status = AUS_Cr.NS_OK;
status = Cr.NS_OK;
break;
case 4:
status = AUS_Cr.NS_ERROR_OFFLINE;
status = Cr.NS_ERROR_OFFLINE;
// After we report offline, we want to eventually show offline
// status being changed to online.
var tm = Components.classes["@mozilla.org/thread-manager;1"].
getService(AUS_Ci.nsIThreadManager);
let tm = Cc["@mozilla.org/thread-manager;1"].
getService(Ci.nsIThreadManager);
tm.mainThread.dispatch(function() {
Services.obs.notifyObservers(gAUS,
"network:offline-status-changed",
"online");
}, AUS_Ci.nsIThread.DISPATCH_NORMAL);
break;
}, Ci.nsIThread.DISPATCH_NORMAL);
break;
}
this._observer.onStopRequest(this, this._ctxt, status);
}.bind(this), AUS_Ci.nsIThread.DISPATCH_NORMAL);
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
},
get URI() {
@ -191,7 +190,7 @@ IncrementalDownload.prototype = {
},
get currentSize() {
throw AUS_Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
get destination() {
@ -203,18 +202,18 @@ IncrementalDownload.prototype = {
},
get totalSize() {
throw AUS_Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
/* nsIRequest */
cancel: function(aStatus) {
throw AUS_Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
suspend: function() {
throw AUS_Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
isPending: function() {
throw AUS_Cr.NS_ERROR_NOT_IMPLEMENTED;
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
_loadFlags: 0,
get loadFlags() {
@ -240,15 +239,16 @@ IncrementalDownload.prototype = {
_status: 0,
get status() {
return this._status;
}
}
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIIncrementalDownload]),
};
// Test disconnecting during an update
function run_test_pt1() {
initMockIncrementalDownload();
setResponseBody("MD5", MD5_HASH_SIMPLE_MAR);
run_test_helper_pt1("mar download with connection interruption",
AUS_Cr.NS_OK, run_test_pt2);
Cr.NS_OK, run_test_pt2);
}
// Test disconnecting during an update
@ -258,15 +258,15 @@ function run_test_pt2() {
Services.prefs.setIntPref(PREF_APP_UPDATE_RETRY_TIMEOUT, 0);
setResponseBody("MD5", MD5_HASH_SIMPLE_MAR);
var expectedResult;
let expectedResult;
if (IS_TOOLKIT_GONK) {
// Gonk treats interrupted downloads differently. For gonk, if the state
// is pending, this means that the download has completed and only the
// staging needs to occur. So gonk will skip the download portion which
// results in an NS_OK return.
expectedResult = AUS_Cr.NS_OK;
expectedResult = Cr.NS_OK;
} else {
expectedResult = AUS_Cr.NS_ERROR_NET_RESET;
expectedResult = Cr.NS_ERROR_NET_RESET;
}
run_test_helper_pt1("mar download with connection interruption without recovery",
expectedResult, run_test_pt3);
@ -277,5 +277,5 @@ function run_test_pt3() {
gIncrementalDownloadErrorType = 4;
setResponseBody("MD5", MD5_HASH_SIMPLE_MAR);
run_test_helper_pt1("mar download with offline mode",
AUS_Cr.NS_OK, finish_test);
Cr.NS_OK, finish_test);
}

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

@ -9,11 +9,9 @@ function run_test() {
logTestInfo("testing resuming an update download in progress for the same " +
"version of the application on startup (Bug 485624)");
var patches, updates;
patches = getLocalPatchString(null, null, null, null, null, null,
STATE_DOWNLOADING);
updates = getLocalUpdateString(patches, null, null, "1.0", "1.0");
let patches = getLocalPatchString(null, null, null, null, null, null,
STATE_DOWNLOADING);
let updates = getLocalUpdateString(patches, null, null, "1.0", "1.0");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeStatusFile(STATE_DOWNLOADING);
@ -38,5 +36,5 @@ function run_test() {
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
reloadUpdateManagerData();
do_timeout(TEST_CHECK_TIMEOUT, doTestFinish);
do_execute_soon(doTestFinish);
}

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

@ -0,0 +1,5 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
load("../data/xpcshellUtilsAUS.js");

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

@ -41,13 +41,13 @@ function callHandleEvent() {
gXHR.status = 400;
gXHR.responseText = gResponseBody;
try {
var parser = AUS_Cc["@mozilla.org/xmlextras/domparser;1"].
createInstance(AUS_Ci.nsIDOMParser);
let parser = Cc["@mozilla.org/xmlextras/domparser;1"].
createInstance(Ci.nsIDOMParser);
gXHR.responseXML = parser.parseFromString(gResponseBody, "application/xml");
} catch (e) {
gXHR.responseXML = null;
}
var e = { target: gXHR };
let e = { target: gXHR };
gXHR.onload(e);
}
@ -63,13 +63,13 @@ function run_test_pt02() {
gUpdates = null;
gUpdateCount = null;
gCheckFunc = check_test_pt02;
var patches = getRemotePatchString("complete", "http://complete/", "SHA1",
let patches = getRemotePatchString("complete", "http://complete/", "SHA1",
"98db9dad8e1d80eda7e1170d0187d6f53e477059",
"9856459");
patches += getRemotePatchString("partial", "http://partial/", "SHA1",
"e6678ca40ae7582316acdeddf3c133c9c8577de4",
"1316138");
var updates = getRemoteUpdateString(patches, "minor", "Minor Test",
let updates = getRemoteUpdateString(patches, "minor", "Minor Test",
"version 2.1a1pre", "2.1a1pre",
"3.1a1pre", "20080811053724",
"http://details/",
@ -87,19 +87,19 @@ function check_test_pt02() {
// XXXrstrong - not specifying a detailsURL will cause a leak due to bug 470244
// and until this is fixed this will not test the value for detailsURL when it
// isn't specified in the update xml.
// var defaultDetailsURL;
// let defaultDetailsURL;
// try {
// Try using a default details URL supplied by the distribution
// if the update XML does not supply one.
// var formatter = AUS_Cc["@mozilla.org/toolkit/URLFormatterService;1"].
// getService(AUS_Ci.nsIURLFormatter);
// let formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].
// getService(Ci.nsIURLFormatter);
// defaultDetailsURL = formatter.formatURLPref(PREF_APP_UPDATE_URL_DETAILS);
// } catch (e) {
// defaultDetailsURL = "";
// }
do_check_eq(gUpdateCount, 1);
var bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount).QueryInterface(AUS_Ci.nsIPropertyBag);
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount).QueryInterface(Ci.nsIPropertyBag);
do_check_eq(bestUpdate.type, "minor");
do_check_eq(bestUpdate.name, "Minor Test");
do_check_eq(bestUpdate.displayVersion, "version 2.1a1pre");
@ -129,7 +129,7 @@ function check_test_pt02() {
do_check_eq(bestUpdate.getProperty("custom1_attr"), "custom1 value");
do_check_eq(bestUpdate.getProperty("custom2_attr"), "custom2 value");
var patch = bestUpdate.getPatchAt(0);
let patch = bestUpdate.getPatchAt(0);
do_check_eq(patch.type, "complete");
do_check_eq(patch.URL, "http://complete/");
do_check_eq(patch.hashFunction, "SHA1");
@ -164,10 +164,10 @@ function run_test_pt03() {
gUpdates = null;
gUpdateCount = null;
gCheckFunc = check_test_pt03;
var patches = getRemotePatchString("complete", "http://complete/", "SHA1",
let patches = getRemotePatchString("complete", "http://complete/", "SHA1",
"98db9dad8e1d80eda7e1170d0187d6f53e477059",
"9856459");
var updates = getRemoteUpdateString(patches, "major", "Major Test",
let updates = getRemoteUpdateString(patches, "major", "Major Test",
null, null,
"5.1a1pre", "20080811053724",
"http://details/",
@ -179,7 +179,7 @@ function run_test_pt03() {
function check_test_pt03() {
do_check_eq(gUpdateCount, 1);
var bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
do_check_eq(bestUpdate.type, "major");
do_check_eq(bestUpdate.name, "Major Test");
do_check_eq(bestUpdate.displayVersion, "version 4.1a1pre");
@ -206,7 +206,7 @@ function check_test_pt03() {
do_check_eq(bestUpdate.patchCount, 1);
//XXX TODO - test nsIUpdate:serialize
var patch = bestUpdate.getPatchAt(0);
let patch = bestUpdate.getPatchAt(0);
do_check_eq(patch.type, "complete");
do_check_eq(patch.URL, "http://complete/");
do_check_eq(patch.hashFunction, "SHA1");
@ -240,9 +240,9 @@ function run_test_pt05() {
// one update available with two patches
function run_test_pt06() {
var patches = getRemotePatchString("complete");
let patches = getRemotePatchString("complete");
patches += getRemotePatchString("partial");
var updates = getRemoteUpdateString(patches);
let updates = getRemoteUpdateString(patches);
gResponseBody = getRemoteUpdatesXMLString(updates);
run_test_helper_pt1("testing one update available",
1, run_test_pt07);
@ -250,9 +250,9 @@ function run_test_pt06() {
// three updates available each with two patches
function run_test_pt07() {
var patches = getRemotePatchString("complete");
let patches = getRemotePatchString("complete");
patches += getRemotePatchString("partial");
var updates = getRemoteUpdateString(patches);
let updates = getRemoteUpdateString(patches);
updates += getRemoteUpdateString(patches);
updates += getRemoteUpdateString(patches);
gResponseBody = getRemoteUpdatesXMLString(updates);
@ -263,9 +263,9 @@ function run_test_pt07() {
// one update with complete and partial patches with size 0 specified in the
// update xml
function run_test_pt08() {
var patches = getRemotePatchString("complete", null, null, null, "0");
let patches = getRemotePatchString("complete", null, null, null, "0");
patches += getRemotePatchString("partial", null, null, null, "0");
var updates = getRemoteUpdateString(patches);
let updates = getRemoteUpdateString(patches);
gResponseBody = getRemoteUpdatesXMLString(updates);
run_test_helper_pt1("testing one update with complete and partial " +
"patches with size 0", 0, run_test_pt09);
@ -273,8 +273,8 @@ function run_test_pt08() {
// one update with complete patch with size 0 specified in the update xml
function run_test_pt09() {
var patches = getRemotePatchString("complete", null, null, null, "0");
var updates = getRemoteUpdateString(patches);
let patches = getRemotePatchString("complete", null, null, null, "0");
let updates = getRemoteUpdateString(patches);
gResponseBody = getRemoteUpdatesXMLString(updates);
run_test_helper_pt1("testing one update with complete patch with size 0",
0, run_test_pt10);
@ -282,8 +282,8 @@ function run_test_pt09() {
// one update with partial patch with size 0 specified in the update xml
function run_test_pt10() {
var patches = getRemotePatchString("partial", null, null, null, "0");
var updates = getRemoteUpdateString(patches);
let patches = getRemotePatchString("partial", null, null, null, "0");
let updates = getRemoteUpdateString(patches);
gResponseBody = getRemoteUpdatesXMLString(updates);
run_test_helper_pt1("testing one update with partial patch with size 0",
0, run_test_pt11);
@ -291,9 +291,9 @@ function run_test_pt10() {
// check that updates for older versions of the application aren't selected
function run_test_pt11() {
var patches = getRemotePatchString("complete");
let patches = getRemotePatchString("complete");
patches += getRemotePatchString("partial");
var updates = getRemoteUpdateString(patches, "minor", null, null, "1.0pre");
let updates = getRemoteUpdateString(patches, "minor", null, null, "1.0pre");
updates += getRemoteUpdateString(patches, "minor", null, null, "1.0a");
gResponseBody = getRemoteUpdatesXMLString(updates);
run_test_helper_pt1("testing two updates older than the current version",
@ -301,23 +301,23 @@ function run_test_pt11() {
}
function check_test_pt11() {
var bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
do_check_eq(bestUpdate, null);
run_test_pt12();
}
// check that updates for the current version of the application are selected
function run_test_pt12() {
var patches = getRemotePatchString("complete");
let patches = getRemotePatchString("complete");
patches += getRemotePatchString("partial");
var updates = getRemoteUpdateString(patches, "minor", null, "version 1.0");
let updates = getRemoteUpdateString(patches, "minor", null, "version 1.0");
gResponseBody = getRemoteUpdatesXMLString(updates);
run_test_helper_pt1("testing one update equal to the current version",
1, check_test_pt12);
}
function check_test_pt12() {
var bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
do_check_neq(bestUpdate, null);
do_check_eq(bestUpdate.displayVersion, "version 1.0");

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

@ -15,7 +15,7 @@ function run_test() {
Services.prefs.setBoolPref(PREF_APP_UPDATE_SILENT, false);
let registrar = Components.manager.QueryInterface(AUS_Ci.nsIComponentRegistrar);
let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.registerFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"),
"Fake Window Watcher",
"@mozilla.org/embedcomp/window-watcher;1",
@ -52,7 +52,7 @@ function run_test() {
// didn't throw and otherwise it would report no tests run.
do_check_true(true);
registrar = Components.manager.QueryInterface(AUS_Ci.nsIComponentRegistrar);
registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.unregisterFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"),
WindowWatcherFactory);
registrar.unregisterFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af56}"),
@ -69,46 +69,48 @@ function check_showUpdateAvailable() {
do_throw("showUpdateAvailable should not have called openWindow!");
}
var WindowWatcher = {
const WindowWatcher = {
openWindow: function(aParent, aUrl, aName, aFeatures, aArgs) {
gCheckFunc();
},
QueryInterface: function(aIID) {
if (aIID.equals(AUS_Ci.nsIWindowWatcher) ||
aIID.equals(AUS_Ci.nsISupports))
if (aIID.equals(Ci.nsIWindowWatcher) ||
aIID.equals(Ci.nsISupports)) {
return this;
throw AUS_Cr.NS_ERROR_NO_INTERFACE;
}
throw Cr.NS_ERROR_NO_INTERFACE;
}
}
};
var WindowWatcherFactory = {
const WindowWatcherFactory = {
createInstance: function createInstance(aOuter, aIID) {
if (aOuter != null)
throw AUS_Cr.NS_ERROR_NO_AGGREGATION;
if (aOuter != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
}
return WindowWatcher.QueryInterface(aIID);
}
};
var WindowMediator = {
const WindowMediator = {
getMostRecentWindow: function(aWindowType) {
return { getInterface: XPCOMUtils.generateQI([AUS_Ci.nsIDOMWindow]) };
return { getInterface: XPCOMUtils.generateQI([Ci.nsIDOMWindow]) };
},
QueryInterface: function(aIID) {
if (aIID.equals(AUS_Ci.nsIWindowMediator) ||
aIID.equals(AUS_Ci.nsISupports))
if (aIID.equals(Ci.nsIWindowMediator) ||
aIID.equals(Ci.nsISupports)) {
return this;
throw AUS_Cr.NS_ERROR_NO_INTERFACE;
}
throw Cr.NS_ERROR_NO_INTERFACE;
}
}
var WindowMediatorFactory = {
const WindowMediatorFactory = {
createInstance: function createInstance(aOuter, aIID) {
if (aOuter != null)
throw AUS_Cr.NS_ERROR_NO_AGGREGATION;
if (aOuter != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
}
return WindowMediator.QueryInterface(aIID);
}
};

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

@ -16,7 +16,7 @@ function run_test() {
Services.prefs.setBoolPref(PREF_APP_UPDATE_SILENT, true);
let registrar = Components.manager.QueryInterface(AUS_Ci.nsIComponentRegistrar);
let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.registerFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"),
"Fake Window Watcher",
"@mozilla.org/embedcomp/window-watcher;1",
@ -57,7 +57,7 @@ function run_test() {
// didn't throw and otherwise it would report no tests run.
do_check_true(true);
registrar = Components.manager.QueryInterface(AUS_Ci.nsIComponentRegistrar);
registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.unregisterFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"),
WindowWatcherFactory);
@ -76,7 +76,7 @@ function check_showUpdateError() {
do_throw("showUpdateError should not have seen getNewPrompter!");
}
var WindowWatcher = {
const WindowWatcher = {
openWindow: function(aParent, aUrl, aName, aFeatures, aArgs) {
gCheckFunc();
},
@ -86,18 +86,19 @@ var WindowWatcher = {
},
QueryInterface: function(aIID) {
if (aIID.equals(AUS_Ci.nsIWindowWatcher) ||
aIID.equals(AUS_Ci.nsISupports))
if (aIID.equals(Ci.nsIWindowWatcher) ||
aIID.equals(Ci.nsISupports)) {
return this;
throw AUS_Cr.NS_ERROR_NO_INTERFACE;
}
throw Cr.NS_ERROR_NO_INTERFACE;
}
}
};
var WindowWatcherFactory = {
const WindowWatcherFactory = {
createInstance: function createInstance(aOuter, aIID) {
if (aOuter != null)
throw AUS_Cr.NS_ERROR_NO_AGGREGATION;
if (aOuter != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
}
return WindowWatcher.QueryInterface(aIID);
}
};

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

@ -15,7 +15,7 @@ function run_test() {
overrideXHR(callHandleEvent);
standardInit();
let registrar = Components.manager.QueryInterface(AUS_Ci.nsIComponentRegistrar);
let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.registerFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"),
"Fake Window Watcher",
"@mozilla.org/embedcomp/window-watcher;1",
@ -51,7 +51,7 @@ function check_test() {
}
function end_test() {
let registrar = Components.manager.QueryInterface(AUS_Ci.nsIComponentRegistrar);
let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.unregisterFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"),
WindowWatcherFactory);
registrar.unregisterFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af56}"),
@ -64,12 +64,12 @@ function callHandleEvent() {
gXHR.status = 400;
gXHR.responseText = gResponseBody;
try {
var parser = AUS_Cc["@mozilla.org/xmlextras/domparser;1"].
createInstance(AUS_Ci.nsIDOMParser);
let parser = Cc["@mozilla.org/xmlextras/domparser;1"].
createInstance(Ci.nsIDOMParser);
gXHR.responseXML = parser.parseFromString(gResponseBody, "application/xml");
} catch (e) {
}
var e = { target: gXHR };
let e = { target: gXHR };
gXHR.onload(e);
}
@ -77,46 +77,48 @@ function check_showUpdateAvailable() {
do_throw("showUpdateAvailable should not have called openWindow!");
}
var WindowWatcher = {
const WindowWatcher = {
openWindow: function(aParent, aUrl, aName, aFeatures, aArgs) {
check_showUpdateAvailable();
},
QueryInterface: function(aIID) {
if (aIID.equals(AUS_Ci.nsIWindowWatcher) ||
aIID.equals(AUS_Ci.nsISupports))
if (aIID.equals(Ci.nsIWindowWatcher) ||
aIID.equals(Ci.nsISupports)) {
return this;
throw AUS_Cr.NS_ERROR_NO_INTERFACE;
}
throw Cr.NS_ERROR_NO_INTERFACE;
}
}
};
var WindowWatcherFactory = {
const WindowWatcherFactory = {
createInstance: function createInstance(aOuter, aIID) {
if (aOuter != null)
throw AUS_Cr.NS_ERROR_NO_AGGREGATION;
if (aOuter != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
}
return WindowWatcher.QueryInterface(aIID);
}
};
var WindowMediator = {
const WindowMediator = {
getMostRecentWindow: function(aWindowType) {
return null;
},
QueryInterface: function(aIID) {
if (aIID.equals(AUS_Ci.nsIWindowMediator) ||
aIID.equals(AUS_Ci.nsISupports))
if (aIID.equals(Ci.nsIWindowMediator) ||
aIID.equals(Ci.nsISupports)) {
return this;
throw AUS_Cr.NS_ERROR_NO_INTERFACE;
}
throw Cr.NS_ERROR_NO_INTERFACE;
}
}
};
var WindowMediatorFactory = {
const WindowMediatorFactory = {
createInstance: function createInstance(aOuter, aIID) {
if (aOuter != null)
throw AUS_Cr.NS_ERROR_NO_AGGREGATION;
if (aOuter != null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
}
return WindowMediator.QueryInterface(aIID);
}
};

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

@ -29,7 +29,7 @@ function run_test() {
// call the nsIDOMEventListener's handleEvent method for onload.
function callHandleEvent() {
gXHR.status = gExpectedStatusCode;
var e = { target: gXHR };
let e = { target: gXHR };
gXHR.onload(e);
}
@ -46,7 +46,7 @@ function run_test_helper(aNextRunFunc, aExpectedStatusCode, aMsg) {
function check_test_helper() {
do_check_eq(gStatusCode, gExpectedStatusCode);
var expectedStatusText = getStatusText(gExpectedStatusCode);
let expectedStatusText = getStatusText(gExpectedStatusCode);
do_check_eq(gStatusText, expectedStatusText);
gNextRunFunc();
}
@ -67,7 +67,7 @@ function run_test_pt1() {
function check_test_pt1() {
do_check_eq(gStatusCode, gExpectedStatusCode);
var expectedStatusText = getStatusText(404);
let expectedStatusText = getStatusText(404);
do_check_eq(gStatusText, expectedStatusText);
run_test_pt2();
}
@ -98,55 +98,55 @@ function run_test_pt5() {
// failed (unknown reason) - NS_BINDING_FAILED (2152398849)
function run_test_pt6() {
run_test_helper(run_test_pt7, AUS_Cr.NS_BINDING_FAILED,
run_test_helper(run_test_pt7, Cr.NS_BINDING_FAILED,
"testing failed (unknown reason)");
}
// connection timed out - NS_ERROR_NET_TIMEOUT (2152398862)
function run_test_pt7() {
run_test_helper(run_test_pt8, AUS_Cr.NS_ERROR_NET_TIMEOUT,
run_test_helper(run_test_pt8, Cr.NS_ERROR_NET_TIMEOUT,
"testing connection timed out");
}
// network offline - NS_ERROR_OFFLINE (2152398864)
function run_test_pt8() {
run_test_helper(run_test_pt9, AUS_Cr.NS_ERROR_OFFLINE,
run_test_helper(run_test_pt9, Cr.NS_ERROR_OFFLINE,
"testing network offline");
}
// port not allowed - NS_ERROR_PORT_ACCESS_NOT_ALLOWED (2152398867)
function run_test_pt9() {
run_test_helper(run_test_pt10, AUS_Cr.NS_ERROR_PORT_ACCESS_NOT_ALLOWED,
run_test_helper(run_test_pt10, Cr.NS_ERROR_PORT_ACCESS_NOT_ALLOWED,
"testing port not allowed");
}
// no data was received - NS_ERROR_NET_RESET (2152398868)
function run_test_pt10() {
run_test_helper(run_test_pt11, AUS_Cr.NS_ERROR_NET_RESET,
run_test_helper(run_test_pt11, Cr.NS_ERROR_NET_RESET,
"testing no data was received");
}
// update server not found - NS_ERROR_UNKNOWN_HOST (2152398878)
function run_test_pt11() {
run_test_helper(run_test_pt12, AUS_Cr.NS_ERROR_UNKNOWN_HOST,
run_test_helper(run_test_pt12, Cr.NS_ERROR_UNKNOWN_HOST,
"testing update server not found");
}
// proxy server not found - NS_ERROR_UNKNOWN_PROXY_HOST (2152398890)
function run_test_pt12() {
run_test_helper(run_test_pt13, AUS_Cr.NS_ERROR_UNKNOWN_PROXY_HOST,
run_test_helper(run_test_pt13, Cr.NS_ERROR_UNKNOWN_PROXY_HOST,
"testing proxy server not found");
}
// data transfer interrupted - NS_ERROR_NET_INTERRUPT (2152398919)
function run_test_pt13() {
run_test_helper(run_test_pt14, AUS_Cr.NS_ERROR_NET_INTERRUPT,
run_test_helper(run_test_pt14, Cr.NS_ERROR_NET_INTERRUPT,
"testing data transfer interrupted");
}
// proxy server connection refused - NS_ERROR_PROXY_CONNECTION_REFUSED (2152398920)
function run_test_pt14() {
run_test_helper(run_test_pt15, AUS_Cr.NS_ERROR_PROXY_CONNECTION_REFUSED,
run_test_helper(run_test_pt15, Cr.NS_ERROR_PROXY_CONNECTION_REFUSED,
"testing proxy server connection refused");
}
@ -158,12 +158,12 @@ function run_test_pt15() {
// network is offline - NS_ERROR_DOCUMENT_NOT_CACHED (2152398918)
function run_test_pt16() {
run_test_helper(run_test_pt17, AUS_Cr.NS_ERROR_DOCUMENT_NOT_CACHED,
run_test_helper(run_test_pt17, Cr.NS_ERROR_DOCUMENT_NOT_CACHED,
"testing network is offline");
}
// connection refused - NS_ERROR_CONNECTION_REFUSED (2152398861)
function run_test_pt17() {
run_test_helper(doTestFinish, AUS_Cr.NS_ERROR_CONNECTION_REFUSED,
run_test_helper(doTestFinish, Cr.NS_ERROR_CONNECTION_REFUSED,
"testing connection refused");
}

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

@ -3,9 +3,6 @@
"use strict";
const {utils: Cu, classes: Cc, interfaces: Ci} = Components;
Cu.import("resource://gre/modules/Metrics.jsm");
Cu.import("resource://gre/modules/UpdaterHealthProvider.jsm");

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

@ -12,21 +12,21 @@ function run_test() {
setUpdateChannel("test_channel");
var patch, patches, update, updates;
// XXXrstrong - not specifying a detailsURL will cause a leak due to bug 470244
// and until bug 470244 is fixed this will not test the value for detailsURL
// when it isn't specified in the update xml.
patches = getLocalPatchString("partial", "http://partial/", "SHA256", "cd43",
"86", "true", STATE_PENDING);
updates = getLocalUpdateString(patches, "major", "New", "version 4", "4.0",
"4.0", "20070811053724", "http://details1/",
"http://billboard1/", "http://license1/",
"http://service1/", "1238441300314",
"test status text", "false", "test_channel",
"true", "true", "true", "345600", "true",
"test version", "3.0", "3.0",
"custom1_attr=\"custom1 value\"",
"custom2_attr=\"custom2 value\"");
let patches = getLocalPatchString("partial", "http://partial/", "SHA256",
"cd43", "86", "true", STATE_PENDING);
let updates = getLocalUpdateString(patches, "major", "New", "version 4",
"4.0", "4.0", "20070811053724",
"http://details1/", "http://billboard1/",
"http://license1/", "http://service1/",
"1238441300314", "test status text",
"false", "test_channel", "true", "true",
"true", "345600", "true", "test version",
"3.0", "3.0",
"custom1_attr=\"custom1 value\"",
"custom2_attr=\"custom2 value\"");
writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
writeStatusFile(STATE_SUCCEEDED);
@ -48,7 +48,7 @@ function run_test() {
do_check_eq(gUpdateManager.activeUpdate, null);
do_check_eq(gUpdateManager.updateCount, 2);
update = gUpdateManager.getUpdateAt(0).QueryInterface(AUS_Ci.nsIPropertyBag);
let update = gUpdateManager.getUpdateAt(0).QueryInterface(Ci.nsIPropertyBag);
do_check_eq(update.state, STATE_SUCCEEDED);
do_check_eq(update.type, "major");
do_check_eq(update.name, "New");
@ -73,7 +73,7 @@ function run_test() {
do_check_eq(update.getProperty("custom1_attr"), "custom1 value");
do_check_eq(update.getProperty("custom2_attr"), "custom2 value");
patch = update.selectedPatch;
let patch = update.selectedPatch;
do_check_eq(patch.type, "partial");
do_check_eq(patch.URL, "http://partial/");
do_check_eq(patch.hashFunction, "SHA256");
@ -82,7 +82,7 @@ function run_test() {
do_check_true(patch.selected);
do_check_eq(patch.state, STATE_SUCCEEDED);
update = gUpdateManager.getUpdateAt(1).QueryInterface(AUS_Ci.nsIPropertyBag);
update = gUpdateManager.getUpdateAt(1).QueryInterface(Ci.nsIPropertyBag);
do_check_eq(update.state, STATE_FAILED);
do_check_eq(update.name, "Existing");
do_check_eq(update.type, "major");

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

@ -6,12 +6,12 @@
const PREF_APP_UPDATE_MIGRATE_APP_DIR = "app.update.migrated.updateDir";
function clearTaskbarIDHash(exePath, appInfoName) {
let registry = AUS_Cc["@mozilla.org/windows-registry-key;1"].
createInstance(AUS_Ci.nsIWindowsRegKey);
let registry = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
try {
registry.open(AUS_Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
registry.open(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
"Software\\Mozilla\\" + appInfoName + "\\TaskBarIDs",
AUS_Ci.nsIWindowsRegKey.ACCESS_ALL);
Ci.nsIWindowsRegKey.ACCESS_ALL);
registry.removeValue(exePath);
} catch (e) {
}
@ -21,12 +21,12 @@ function clearTaskbarIDHash(exePath, appInfoName) {
}
function setTaskbarIDHash(exePath, hash, appInfoName) {
let registry = AUS_Cc["@mozilla.org/windows-registry-key;1"].
createInstance(AUS_Ci.nsIWindowsRegKey);
let registry = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
try {
registry.create(AUS_Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
registry.create(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
"Software\\Mozilla\\" + appInfoName + "\\TaskBarIDs",
AUS_Ci.nsIWindowsRegKey.ACCESS_WRITE);
Ci.nsIWindowsRegKey.ACCESS_WRITE);
registry.writeStringValue(exePath, hash);
} catch (e) {
}
@ -36,7 +36,7 @@ function setTaskbarIDHash(exePath, hash, appInfoName) {
};
function getMigrated() {
var migrated = 0;
let migrated = 0;
try {
migrated = Services.prefs.getBoolPref(PREF_APP_UPDATE_MIGRATE_APP_DIR);
} catch (e) {
@ -51,14 +51,14 @@ function run_test() {
standardInit();
var appinfo = AUS_Cc["@mozilla.org/xre/app-info;1"].
getService(AUS_Ci.nsIXULAppInfo).
QueryInterface(AUS_Ci.nsIXULRuntime);
let appinfo = Cc["@mozilla.org/xre/app-info;1"].
getService(Ci.nsIXULAppInfo).
QueryInterface(Ci.nsIXULRuntime);
// Obtain the old update root leaf
var updateLeafName;
var exeFile = FileUtils.getFile(XRE_EXECUTABLE_FILE, []);
var programFiles = FileUtils.getFile("ProgF", []);
let updateLeafName;
let exeFile = FileUtils.getFile(XRE_EXECUTABLE_FILE, []);
let programFiles = FileUtils.getFile("ProgF", []);
if (exeFile.path.substring(0, programFiles.path.length).toLowerCase() ==
programFiles.path.toLowerCase()) {
updateLeafName = exeFile.parent.leafName;
@ -67,7 +67,7 @@ function run_test() {
}
// Obtain the old update root
var oldUpdateRoot;
let oldUpdateRoot;
if (appinfo.vendor) {
oldUpdateRoot = FileUtils.getDir("LocalAppData", [appinfo.vendor,
appinfo.name,
@ -77,7 +77,7 @@ function run_test() {
updateLeafName], false);
}
// Obtain the new update root
var newUpdateRoot = FileUtils.getDir("UpdRootD", [], false);
let newUpdateRoot = FileUtils.getDir("UpdRootD", [], false);
///////////////////////////////////////////////////////////
// Setting a taskbar ID without the old update dir existing should set the
@ -112,14 +112,14 @@ function run_test() {
Services.prefs.setBoolPref(PREF_APP_UPDATE_MIGRATE_APP_DIR, false);
setTaskbarIDHash(exeFile.parent.path, "AAAAAAAA", appinfo.name);
var oldUpdateDirs = oldUpdateRoot.clone();
let oldUpdateDirs = oldUpdateRoot.clone();
oldUpdateDirs.append("updates");
oldUpdateDirs.append("0");
oldUpdateDirs.create(AUS_Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
oldUpdateDirs.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
// Get an array of all of the files we want to migrate.
// We do this to create them in the old update directory.
var filesToMigrate = [FILE_UPDATES_DB, FILE_UPDATE_ACTIVE,
let filesToMigrate = [FILE_UPDATES_DB, FILE_UPDATE_ACTIVE,
["updates", FILE_LAST_LOG], ["updates", FILE_BACKUP_LOG],
["updates", "0", FILE_UPDATE_STATUS]];
// Move each of those files to the new directory
@ -132,7 +132,7 @@ function run_test() {
} else {
oldFile.append(relPath);
}
oldFile.create(AUS_Ci.nsIFile.NORMAL_FILE_TYPE, PERMS_FILE);
oldFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, PERMS_FILE);
});
// Do the migration
initUpdateServiceStub();
@ -163,9 +163,9 @@ function run_test() {
}
function end_test() {
var appinfo = AUS_Cc["@mozilla.org/xre/app-info;1"].
getService(AUS_Ci.nsIXULAppInfo).
QueryInterface(AUS_Ci.nsIXULRuntime);
var exeFile = FileUtils.getFile(XRE_EXECUTABLE_FILE, []);
let appinfo = Cc["@mozilla.org/xre/app-info;1"].
getService(Ci.nsIXULAppInfo).
QueryInterface(Ci.nsIXULRuntime);
let exeFile = FileUtils.getFile(XRE_EXECUTABLE_FILE, []);
clearTaskbarIDHash(exeFile.parent.path, appinfo.name);
}

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

@ -5,7 +5,7 @@
/* General URL Construction Tests */
Components.utils.import("resource://gre/modules/ctypes.jsm")
Cu.import("resource://gre/modules/ctypes.jsm")
const URL_PREFIX = URL_HOST + "/";
@ -20,16 +20,16 @@ function run_test() {
// The mock XMLHttpRequest is MUCH faster
overrideXHR(callHandleEvent);
standardInit();
gAppInfo = AUS_Cc["@mozilla.org/xre/app-info;1"].
getService(AUS_Ci.nsIXULAppInfo).
QueryInterface(AUS_Ci.nsIXULRuntime);
gAppInfo = Cc["@mozilla.org/xre/app-info;1"].
getService(Ci.nsIXULAppInfo).
QueryInterface(Ci.nsIXULRuntime);
do_execute_soon(run_test_pt1);
}
// Callback function used by the custom XMLHttpRequest implementation to
// call the nsIDOMEventListener's handleEvent method for onload.
function callHandleEvent() {
var e = { target: gXHR };
let e = { target: gXHR };
gXHR.onload(e);
}
@ -41,7 +41,7 @@ function getResult(url) {
// url constructed with %PRODUCT%
function run_test_pt1() {
gCheckFunc = check_test_pt1;
var url = URL_PREFIX + "%PRODUCT%/";
let url = URL_PREFIX + "%PRODUCT%/";
logTestInfo("testing url constructed with %PRODUCT% - " + url);
setUpdateURLOverride(url);
gUpdateChecker.checkForUpdates(updateCheckListener, true);
@ -55,7 +55,7 @@ function check_test_pt1() {
// url constructed with %VERSION%
function run_test_pt2() {
gCheckFunc = check_test_pt2;
var url = URL_PREFIX + "%VERSION%/";
let url = URL_PREFIX + "%VERSION%/";
logTestInfo("testing url constructed with %VERSION% - " + url);
setUpdateURLOverride(url);
gUpdateChecker.checkForUpdates(updateCheckListener, true);
@ -69,7 +69,7 @@ function check_test_pt2() {
// url constructed with %BUILD_ID%
function run_test_pt3() {
gCheckFunc = check_test_pt3;
var url = URL_PREFIX + "%BUILD_ID%/";
let url = URL_PREFIX + "%BUILD_ID%/";
logTestInfo("testing url constructed with %BUILD_ID% - " + url);
setUpdateURLOverride(url);
gUpdateChecker.checkForUpdates(updateCheckListener, true);
@ -84,14 +84,14 @@ function check_test_pt3() {
// XXX TODO - it might be nice if we tested the actual ABI
function run_test_pt4() {
gCheckFunc = check_test_pt4;
var url = URL_PREFIX + "%BUILD_TARGET%/";
let url = URL_PREFIX + "%BUILD_TARGET%/";
logTestInfo("testing url constructed with %BUILD_TARGET% - " + url);
setUpdateURLOverride(url);
gUpdateChecker.checkForUpdates(updateCheckListener, true);
}
function check_test_pt4() {
var abi;
let abi;
try {
abi = gAppInfo.XPCOMABI;
} catch (e) {
@ -102,11 +102,12 @@ function check_test_pt4() {
// Mac universal build should report a different ABI than either macppc
// or mactel. This is necessary since nsUpdateService.js will set the ABI to
// Universal-gcc3 for Mac universal builds.
var macutils = AUS_Cc["@mozilla.org/xpcom/mac-utils;1"].
getService(AUS_Ci.nsIMacUtils);
let macutils = Cc["@mozilla.org/xpcom/mac-utils;1"].
getService(Ci.nsIMacUtils);
if (macutils.isUniversalBinary)
if (macutils.isUniversalBinary) {
abi += "-u-" + macutils.architecturesInBinary;
}
if (IS_SHARK) {
// Disambiguate optimised and shark nightlies
abi += "-shark"
@ -122,7 +123,7 @@ function check_test_pt4() {
// Bug 488936 added the update.locale file that stores the update locale
function run_test_pt5() {
gCheckFunc = check_test_pt5;
var url = URL_PREFIX + "%LOCALE%/";
let url = URL_PREFIX + "%LOCALE%/";
logTestInfo("testing url constructed with %LOCALE% - " + url);
setUpdateURLOverride(url);
try {
@ -142,7 +143,7 @@ function check_test_pt5() {
// url constructed with %CHANNEL%
function run_test_pt6() {
gCheckFunc = check_test_pt6;
var url = URL_PREFIX + "%CHANNEL%/";
let url = URL_PREFIX + "%CHANNEL%/";
logTestInfo("testing url constructed with %CHANNEL% - " + url);
setUpdateURLOverride(url);
setUpdateChannel("test_channel");
@ -157,7 +158,7 @@ function check_test_pt6() {
// url constructed with %CHANNEL% with distribution partners
function run_test_pt7() {
gCheckFunc = check_test_pt7;
var url = URL_PREFIX + "%CHANNEL%/";
let url = URL_PREFIX + "%CHANNEL%/";
logTestInfo("testing url constructed with %CHANNEL% - " + url);
setUpdateURLOverride(url);
gDefaultPrefBranch.setCharPref(PREF_APP_PARTNER_BRANCH + "test_partner1", "test_partner1");
@ -173,7 +174,7 @@ function check_test_pt7() {
// url constructed with %PLATFORM_VERSION%
function run_test_pt8() {
gCheckFunc = check_test_pt8;
var url = URL_PREFIX + "%PLATFORM_VERSION%/";
let url = URL_PREFIX + "%PLATFORM_VERSION%/";
logTestInfo("testing url constructed with %PLATFORM_VERSION% - " + url);
setUpdateURLOverride(url);
gUpdateChecker.checkForUpdates(updateCheckListener, true);
@ -187,7 +188,7 @@ function check_test_pt8() {
// url constructed with %OS_VERSION%
function run_test_pt9() {
gCheckFunc = check_test_pt9;
var url = URL_PREFIX + "%OS_VERSION%/";
let url = URL_PREFIX + "%OS_VERSION%/";
logTestInfo("testing url constructed with %OS_VERSION% - " + url);
setUpdateURLOverride(url);
gUpdateChecker.checkForUpdates(updateCheckListener, true);
@ -231,7 +232,7 @@ function getServicePack() {
let winVer = OSVERSIONINFOEXW();
winVer.dwOSVersionInfoSize = OSVERSIONINFOEXW.size;
if(0 === GetVersionEx(winVer.address())) {
if (0 === GetVersionEx(winVer.address())) {
// Using "throw" instead of "do_throw" (see NOTE above)
throw("Failure in GetVersionEx (returned 0)");
}
@ -295,12 +296,11 @@ function getProcArchitecture() {
}
function check_test_pt9() {
var osVersion;
var sysInfo = AUS_Cc["@mozilla.org/system-info;1"].
getService(AUS_Ci.nsIPropertyBag2);
let osVersion;
let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
osVersion = sysInfo.getProperty("name") + " " + sysInfo.getProperty("version");
if(IS_WIN) {
if (IS_WIN) {
try {
let servicePack = getServicePack();
osVersion += "." + servicePack;
@ -308,7 +308,7 @@ function check_test_pt9() {
do_throw("Failure obtaining service pack: " + e);
}
if("5.0" === sysInfo.getProperty("version")) { // Win2K
if ("5.0" === sysInfo.getProperty("version")) { // Win2K
osVersion += " (unknown)";
} else {
try {
@ -336,7 +336,7 @@ function check_test_pt9() {
// url constructed with %DISTRIBUTION%
function run_test_pt10() {
gCheckFunc = check_test_pt10;
var url = URL_PREFIX + "%DISTRIBUTION%/";
let url = URL_PREFIX + "%DISTRIBUTION%/";
logTestInfo("testing url constructed with %DISTRIBUTION% - " + url);
setUpdateURLOverride(url);
gDefaultPrefBranch.setCharPref(PREF_DISTRIBUTION_ID, "test_distro");
@ -351,7 +351,7 @@ function check_test_pt10() {
// url constructed with %DISTRIBUTION_VERSION%
function run_test_pt11() {
gCheckFunc = check_test_pt11;
var url = URL_PREFIX + "%DISTRIBUTION_VERSION%/";
let url = URL_PREFIX + "%DISTRIBUTION_VERSION%/";
logTestInfo("testing url constructed with %DISTRIBUTION_VERSION% - " + url);
setUpdateURLOverride(url);
gDefaultPrefBranch.setCharPref(PREF_DISTRIBUTION_VERSION, "test_distro_version");
@ -366,7 +366,7 @@ function check_test_pt11() {
// url with force param that doesn't already have a param - bug 454357
function run_test_pt12() {
gCheckFunc = check_test_pt12;
var url = URL_PREFIX;
let url = URL_PREFIX;
logTestInfo("testing url with force param that doesn't already have a " +
"param - " + url);
setUpdateURLOverride(url);
@ -381,7 +381,7 @@ function check_test_pt12() {
// url with force param that already has a param - bug 454357
function run_test_pt13() {
gCheckFunc = check_test_pt13;
var url = URL_PREFIX + "?extra=param";
let url = URL_PREFIX + "?extra=param";
logTestInfo("testing url with force param that already has a param - " + url);
logTestInfo("testing url constructed that has a parameter - " + url);
setUpdateURLOverride(url);
@ -396,7 +396,7 @@ function check_test_pt13() {
function run_test_pt14() {
Services.prefs.setCharPref("app.update.custom", "custom");
gCheckFunc = check_test_pt14;
var url = URL_PREFIX + "?custom=%CUSTOM%";
let url = URL_PREFIX + "?custom=%CUSTOM%";
logTestInfo("testing url constructed with %CUSTOM% - " + url);
setUpdateURLOverride(url);
gUpdateChecker.checkForUpdates(updateCheckListener, true);

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

@ -6,7 +6,6 @@
head = head_update.js
tail =
skip-if = toolkit == 'android'
generated-files = head_update.js
[canCheckForAndCanApplyUpdates.js]
[urlConstruction.js]

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

@ -0,0 +1,5 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
load("../data/xpcshellUtilsAUS.js");

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

@ -7,7 +7,7 @@
* apply it.
*/
Components.utils.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://gre/modules/ctypes.jsm");
function run_test() {
if (MOZ_APP_NAME == "xulrunner") {

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

@ -16,8 +16,8 @@ function run_test() {
let callbackApp = getApplyDirFile(DIR_RESOURCES + gCallbackBinFile);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let callbackAppProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
callbackAppProcess.init(callbackApp);
callbackAppProcess.run(false, args, args.length);

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

@ -16,8 +16,8 @@ function run_test() {
let callbackApp = getApplyDirFile(DIR_RESOURCES + gCallbackBinFile);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let callbackAppProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
callbackAppProcess.init(callbackApp);
callbackAppProcess.run(false, args, args.length);

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

@ -49,8 +49,8 @@ function run_test() {
callbackApp.permissions = PERMS_DIRECTORY;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let callbackAppProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
callbackAppProcess.init(callbackApp);
callbackAppProcess.run(false, args, args.length);
@ -118,8 +118,8 @@ function checkUpdate() {
function runHelperProcess(args) {
let helperBin = getTestDirFile(FILE_HELPER_BIN);
let process = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let process = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
process.init(helperBin);
logTestInfo("Running " + helperBin.path + " " + args.join(" "));
process.run(true, args, args.length);

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

@ -15,8 +15,8 @@ function run_test() {
callbackApp.permissions = PERMS_DIRECTORY;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let callbackAppProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
callbackAppProcess.init(callbackApp);
callbackAppProcess.run(false, args, args.length);

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

@ -17,8 +17,8 @@ function run_test() {
gTestFiles[13].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -17,8 +17,8 @@ function run_test() {
gTestFiles[11].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -17,8 +17,8 @@ function run_test() {
gTestFiles[13].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -17,8 +17,8 @@ function run_test() {
gTestFiles[11].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -15,8 +15,8 @@ function run_test() {
gTestFiles[13].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -15,8 +15,8 @@ function run_test() {
gTestFiles[11].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -25,8 +25,8 @@ function run_test() {
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[3].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);

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

@ -25,8 +25,8 @@ function run_test() {
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[2].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);

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

@ -26,8 +26,8 @@ function run_test() {
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[3].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);

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

@ -26,8 +26,8 @@ function run_test() {
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[2].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);

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

@ -26,8 +26,8 @@ function run_test() {
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[3].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);

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

@ -26,8 +26,8 @@ function run_test() {
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[2].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);

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

@ -28,8 +28,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -26,8 +26,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -28,8 +28,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -26,8 +26,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -25,8 +25,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -23,8 +23,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -123,8 +123,8 @@ function finishCheckUpdateApplied() {
function runHelperProcess(args) {
let helperBin = getTestDirFile(FILE_HELPER_BIN);
let process = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let process = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
process.init(helperBin);
logTestInfo("Running " + helperBin.path + " " + args.join(" "));
process.run(true, args, args.length);

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

@ -10,7 +10,6 @@
head = head_update.js
tail =
skip-if = toolkit == 'android'
generated-files = head_update.js
[marSuccessComplete.js]
[marSuccessPartial.js]

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

@ -0,0 +1,5 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
load("../data/xpcshellUtilsAUS.js");

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

@ -7,7 +7,7 @@
* apply it.
*/
Components.utils.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://gre/modules/ctypes.jsm");
function run_test() {
if (MOZ_APP_NAME == "xulrunner") {

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

@ -20,8 +20,8 @@ function run_test() {
let callbackApp = getApplyDirFile(DIR_RESOURCES + gCallbackBinFile);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let callbackAppProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
callbackAppProcess.init(callbackApp);
callbackAppProcess.run(false, args, args.length);

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

@ -20,8 +20,8 @@ function run_test() {
let callbackApp = getApplyDirFile(DIR_RESOURCES + gCallbackBinFile);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let callbackAppProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
callbackAppProcess.init(callbackApp);
callbackAppProcess.run(false, args, args.length);

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

@ -19,8 +19,8 @@ function run_test() {
callbackApp.permissions = PERMS_DIRECTORY;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let callbackAppProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
callbackAppProcess.init(callbackApp);
callbackAppProcess.run(false, args, args.length);

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

@ -21,8 +21,8 @@ function run_test() {
gTestFiles[13].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -21,8 +21,8 @@ function run_test() {
gTestFiles[11].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -21,8 +21,8 @@ function run_test() {
gTestFiles[13].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -21,8 +21,8 @@ function run_test() {
gTestFiles[11].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -19,8 +19,8 @@ function run_test() {
gTestFiles[13].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -19,8 +19,8 @@ function run_test() {
gTestFiles[11].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -29,8 +29,8 @@ function run_test() {
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[3].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);

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

@ -29,8 +29,8 @@ function run_test() {
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[2].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);

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

@ -30,8 +30,8 @@ function run_test() {
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[3].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);

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

@ -30,8 +30,8 @@ function run_test() {
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[2].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);

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

@ -30,8 +30,8 @@ function run_test() {
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[3].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);

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

@ -30,8 +30,8 @@ function run_test() {
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[2].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);

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

@ -32,8 +32,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -30,8 +30,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -32,8 +32,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -30,8 +30,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -29,8 +29,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -27,8 +27,8 @@ function run_test() {
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);

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

@ -121,8 +121,8 @@ function finishCheckUpdateApplied() {
function runHelperProcess(args) {
let helperBin = getTestDirFile(FILE_HELPER_BIN);
let process = AUS_Cc["@mozilla.org/process/util;1"].
createInstance(AUS_Ci.nsIProcess);
let process = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
process.init(helperBin);
logTestInfo("Running " + helperBin.path + " " + args.join(" "));
process.run(true, args, args.length);

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

@ -7,7 +7,6 @@
[DEFAULT]
head = head_update.js
tail =
generated-files = head_update.js
[bootstrapSvc.js]
run-sequentially = Uses the Mozilla Maintenance Service.

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

@ -7,12 +7,10 @@
'use strict';
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cm = Components.manager;
const Cr = Components.results;
const { classes: Cc, interfaces: Ci, manager: Cm, results: Cr,
utils: Cu } = Components;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const CATEGORY_UPDATE_TIMER = "update-timer";
@ -215,7 +213,7 @@ function run_test1thru7() {
function finished_test1thru7() {
if (TESTS[4].notified && TESTS[5].notified && TESTS[6].notified) {
do_timeout(0, gNextFunc);
do_execute_soon(gNextFunc);
}
}
@ -270,7 +268,7 @@ function check_test1thru7() {
"registered");
do_check_eq(count, 0);
do_timeout(0, run_test8);
do_execute_soon(run_test8);
}
function run_test8() {
@ -427,7 +425,7 @@ const gTest8TimerCallback = {
notify: function T8CB_notify(aTimer) {
TESTS[7].notified = true;
TESTS[7].notifyTime = Date.now();
do_timeout(0, function() {
do_execute_soon(function() {
check_test8(gTest8TimerCallback);
});
},
@ -447,7 +445,7 @@ const gTest9TimerCallback = {
notify: function T9CB_notify(aTimer) {
TESTS[8].notified = true;
TESTS[8].notifyTime = Date.now();
do_timeout(0, function() {
do_execute_soon(function() {
check_test8(gTest9TimerCallback);
});
},