Bug 284188 - Forcefully prevent infinite-restart bugs by setting an environment var. r=darin

This commit is contained in:
bsmedberg%covad.net 2005-03-07 19:00:19 +00:00
Родитель f3c97aa814
Коммит 8f52fd9b15
1 изменённых файлов: 16 добавлений и 9 удалений

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

@ -1725,7 +1725,6 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
// Allows the user to forcefully bypass the restart process at their
// own risk. Useful for debugging or for tinderboxes where child
// processes can be problematic.
PRBool noRestart = PR_FALSE;
{
// Start the real application
ScopedXPCOMStartup xpcom;
@ -1808,29 +1807,34 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
return 0;
}
char* noEMRestart = PR_GetEnv("NO_EM_RESTART");
noRestart = noEMRestart && !strcmp("1", noEMRestart);
if (!noRestart && upgraded) {
if (upgraded) {
rv = em->CheckForMismatches(&needsRestart);
NS_ASSERTION(NS_SUCCEEDED(rv), "Oops, looks like you have a extensions.rdf file generated by a buggy nightly build. Please remove it!");
if (NS_FAILED(rv)) {
needsRestart = PR_FALSE;
upgraded = PR_FALSE;
}
}
if (noRestart || (!upgraded || !needsRestart))
if (!upgraded || !needsRestart)
em->Start(cmdLine, componentsListChanged, &needsRestart);
}
if (noRestart || (!upgraded && !needsRestart)) {
char* noEMRestart = PR_GetEnv("NO_EM_RESTART");
if (noEMRestart && *noEMRestart) {
if (upgraded || needsRestart) {
NS_WARNING("EM tried to force us to restart twice! Forcefully preventing that.");
}
needsRestart = upgraded = PR_FALSE;
}
if (!upgraded && !needsRestart) {
// clear out any environment variables which may have been set
// during the relaunch process now that we know we won't be relaunching.
PR_SetEnv("XRE_PROFILE_PATH=");
PR_SetEnv("XRE_START_OFFLINE=");
PR_SetEnv("XRE_IMPORT_PROFILES=");
PR_SetEnv("NO_EM_RESTART=");
#ifdef XP_MACOSX
// we re-initialize the command-line service and do appleevents munging
@ -1914,7 +1918,10 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
}
// Restart the app after XPCOM has been shut down cleanly.
if (!noRestart && needsRestart) {
if (needsRestart) {
// After this restart, we don't want to restart any more!
PR_SetEnv("NO_EM_RESTART=1");
nsCAutoString path;
lf->GetNativePath(path);