Part 8 - Bug 951662 - fix file removal race condition and only launch the callback app from the updater when the MOZ_PROCESS_UPDATES env var is not defined. r=bbondy

This commit is contained in:
Robert Strong 2014-01-12 13:46:43 -08:00
parent 9be1d0d81c
commit cfb3cff639
6 changed files with 62 additions and 14 deletions

View File

@ -369,6 +369,8 @@ if (MOZ_APP_NAME == "xulrunner") {
* Helper function for setting up the test environment.
*/
function setupTestCommon() {
logTestInfo("start - general test setup");
do_test_pending();
if (gTestID) {
@ -421,6 +423,8 @@ function setupTestCommon() {
updatesDir.path + ", Exception: " + e);
}
}
logTestInfo("finish - general test setup");
}
/**

View File

@ -228,6 +228,22 @@ function checkUpdateFinished() {
return;
}
let updater = getUpdatesPatchDir();
updater.append(FILE_UPDATER_BIN);
if (updater.exists()) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded while waiting for updater binary to no longer be in " +
"use");
} else {
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
}
}
let updateTestDir = getUpdateTestDir();
let file = updateTestDir.clone();

View File

@ -100,11 +100,16 @@ function checkUpdateFinished() {
let updater = getUpdatesPatchDir();
updater.append(FILE_UPDATER_BIN);
if (updater.exists()) {
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded while waiting for updater binary to no longer be in " +
"use");
} else {
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
}
}

View File

@ -232,6 +232,22 @@ function checkUpdateFinished() {
return;
}
let updater = getUpdatesPatchDir();
updater.append(FILE_UPDATER_BIN);
if (updater.exists()) {
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded while waiting for updater binary to no longer be in " +
"use");
} else {
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
}
}
let updateTestDir = getUpdateTestDir();
let file = updateTestDir.clone();

View File

@ -104,11 +104,16 @@ function checkUpdateFinished() {
let updater = getUpdatesPatchDir();
updater.append(FILE_UPDATER_BIN);
if (updater.exists()) {
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
do_throw("Exceeded while waiting for updater binary to no longer be in " +
"use");
} else {
try {
updater.remove(false);
} catch (e) {
do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
return;
}
}
}

View File

@ -3139,10 +3139,12 @@ int NS_main(int argc, NS_tchar **argv)
}
#endif /* XP_MACOSX */
LaunchCallbackApp(argv[4],
argc - callbackIndex,
argv + callbackIndex,
sUsingService);
if (getenv("MOZ_PROCESS_UPDATES") == nullptr) {
LaunchCallbackApp(argv[4],
argc - callbackIndex,
argv + callbackIndex,
sUsingService);
}
}
return gSucceeded ? 0 : 1;