landing patch for bug 258470 "XULRunner shouldn't use firefox migration service" r=bsmedberg

git-svn-id: svn://10.0.0.236/trunk@161995 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
darin%meer.net 2004-09-09 18:10:25 +00:00
parent fd313a6a75
commit dd1a93c1ff
5 changed files with 122 additions and 76 deletions

View File

@ -49,6 +49,8 @@ static const nsXREAppData kAppData = {
APP_VERSION, APP_VERSION,
BUILD_ID, BUILD_ID,
"Copyright (c) 2004 mozilla.org", "Copyright (c) 2004 mozilla.org",
PR_TRUE,
PR_TRUE,
PR_FALSE PR_FALSE
}; };

View File

@ -51,6 +51,8 @@ static const nsXREAppData kAppData = {
APP_VERSION, APP_VERSION,
BUILD_ID, BUILD_ID,
"Copyright (c) 2004 mozilla.org", "Copyright (c) 2004 mozilla.org",
PR_FALSE, // no profile migration
PR_TRUE,
PR_FALSE PR_FALSE
}; };

View File

@ -50,6 +50,8 @@ static const nsXREAppData kAppData = {
APP_VERSION, APP_VERSION,
BUILD_ID, BUILD_ID,
"Copyright (c) 2004 mozilla.org", "Copyright (c) 2004 mozilla.org",
PR_TRUE,
PR_TRUE,
PR_FALSE PR_FALSE
}; };

View File

@ -386,8 +386,8 @@ CheckArg(const char* aArg, const char **aParam = nsnull)
static const nsXREAppData* LoadAppData(const char* appDataFile) static const nsXREAppData* LoadAppData(const char* appDataFile)
{ {
static char vendor[256], name[256], version[32], buildID[32], copyright[512]; static char vendor[256], name[256], version[32], buildID[32], copyright[512];
static const nsXREAppData data = { static nsXREAppData data = {
vendor, name, version, buildID, copyright, PR_FALSE vendor, name, version, buildID, copyright, PR_FALSE, PR_FALSE, PR_FALSE
}; };
nsCOMPtr<nsILocalFile> lf; nsCOMPtr<nsILocalFile> lf;
@ -412,7 +412,7 @@ static const nsXREAppData* LoadAppData(const char* appDataFile)
char* buf; char* buf;
size_t bufLen; size_t bufLen;
PRBool required; PRBool required;
} fields[] = { } string_fields[] = {
{ "Vendor", vendor, sizeof(vendor), PR_FALSE }, { "Vendor", vendor, sizeof(vendor), PR_FALSE },
{ "Name", name, sizeof(name), PR_TRUE }, { "Name", name, sizeof(name), PR_TRUE },
{ "Version", version, sizeof(version), PR_FALSE }, { "Version", version, sizeof(version), PR_FALSE },
@ -421,17 +421,35 @@ static const nsXREAppData* LoadAppData(const char* appDataFile)
}; };
for (int i=0; i<5; ++i) { for (int i=0; i<5; ++i) {
rv = parser.GetString("App", fields[i].key, fields[i].buf, fields[i].bufLen); rv = parser.GetString("App", string_fields[i].key, string_fields[i].buf,
string_fields[i].bufLen);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
if (fields[i].required) { if (string_fields[i].required) {
fprintf(stderr, "Error: %x: No \"%s\" field.\n", rv, fields[i].key); fprintf(stderr, "Error: %x: No \"%s\" field.\n", rv,
string_fields[i].key);
return nsnull; return nsnull;
} else { } else {
fields[i].buf[0] = '\0'; string_fields[i].buf[0] = '\0';
} }
} }
} }
const struct {
const char* key;
PRBool* value;
} boolean_fields[] = {
{ "EnableProfileMigrator", &data.enableProfileMigrator },
{ "EnableExtensionManager", &data.enableExtensionManager }
};
char buf[2];
for (int i=0; i<2; ++i) {
rv = parser.GetString("App", boolean_fields[i].key, buf, sizeof(buf));
if (NS_SUCCEEDED(rv))
*(boolean_fields[i].value) =
buf[0] == '1' || buf[0] == 't' || buf[0] == 'T';
}
#ifdef DEBUG #ifdef DEBUG
printf("---------------------------------------------------------\n"); printf("---------------------------------------------------------\n");
printf(" Vendor %s\n", data.appVendor); printf(" Vendor %s\n", data.appVendor);
@ -439,6 +457,8 @@ static const nsXREAppData* LoadAppData(const char* appDataFile)
printf(" Version %s\n", data.appVersion); printf(" Version %s\n", data.appVersion);
printf(" BuildID %s\n", data.appBuildID); printf(" BuildID %s\n", data.appBuildID);
printf(" Copyright %s\n", data.copyright); printf(" Copyright %s\n", data.copyright);
printf(" EnablePM %u\n", data.enableProfileMigrator);
printf(" EnableEM %u\n", data.enableExtensionManager);
printf("---------------------------------------------------------\n"); printf("---------------------------------------------------------\n");
#endif #endif
@ -1839,12 +1859,14 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
chromeReg->CheckForNewChrome(); chromeReg->CheckForNewChrome();
if (gAppData->enableExtensionManager) {
nsCOMPtr<nsIExtensionManager> em nsCOMPtr<nsIExtensionManager> em
(do_GetService("@mozilla.org/extensions/manager;1")); (do_GetService("@mozilla.org/extensions/manager;1"));
NS_ENSURE_TRUE(em, 1); NS_ENSURE_TRUE(em, 1);
em->Register(); em->Register();
} }
}
return 0; return 0;
} }
@ -1937,12 +1959,14 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
//////////////////////// NOW WE HAVE A PROFILE //////////////////////// //////////////////////// NOW WE HAVE A PROFILE ////////////////////////
PRBool upgraded = PR_FALSE;
PRBool componentsListChanged = PR_FALSE;
if (gAppData->enableExtensionManager) {
// Check for version compatibility with the last version of the app this // Check for version compatibility with the last version of the app this
// profile was started with. // profile was started with.
char version[MAXPATHLEN]; char version[MAXPATHLEN];
GetVersion(lf, version, MAXPATHLEN); GetVersion(lf, version, MAXPATHLEN);
PRBool upgraded = PR_FALSE;
PRBool componentsListChanged = PR_FALSE;
// Extensions are deemed compatible for all builds in the "x.x.x+" // Extensions are deemed compatible for all builds in the "x.x.x+"
// period in between milestones for developer convenience (even though // period in between milestones for developer convenience (even though
@ -1987,6 +2011,7 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
// The Extension Manager will write the Compatibility manifest with // The Extension Manager will write the Compatibility manifest with
// the current app version. // the current app version.
} }
}
PRBool needsRestart = PR_FALSE; PRBool needsRestart = PR_FALSE;
@ -2030,7 +2055,8 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
// So we can open and close windows during startup // So we can open and close windows during startup
appShellService->EnterLastWindowClosingSurvivalArea(); appShellService->EnterLastWindowClosingSurvivalArea();
if (gDoMigration) { // Profile Migration
if (gAppData->enableProfileMigrator && gDoMigration) {
gDoMigration = PR_FALSE; gDoMigration = PR_FALSE;
nsCOMPtr<nsIProfileMigrator> pm nsCOMPtr<nsIProfileMigrator> pm
(do_CreateInstance(NS_PROFILEMIGRATOR_CONTRACTID)); (do_CreateInstance(NS_PROFILEMIGRATOR_CONTRACTID));
@ -2045,6 +2071,7 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
NS_ENSURE_SUCCESS(rv, 1); NS_ENSURE_SUCCESS(rv, 1);
// Extension Compatibility Checking and Startup // Extension Compatibility Checking and Startup
if (gAppData->enableExtensionManager) {
nsCOMPtr<nsIExtensionManager> em(do_GetService("@mozilla.org/extensions/manager;1")); nsCOMPtr<nsIExtensionManager> em(do_GetService("@mozilla.org/extensions/manager;1"));
NS_ENSURE_TRUE(em, 1); NS_ENSURE_TRUE(em, 1);
@ -2069,6 +2096,7 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
if (noRestart || (!upgraded || !needsRestart)) if (noRestart || (!upgraded || !needsRestart))
em->Start(componentsListChanged, &needsRestart); em->Start(componentsListChanged, &needsRestart);
}
if (noRestart || (!upgraded && !needsRestart)) { if (noRestart || (!upgraded && !needsRestart)) {

View File

@ -77,6 +77,18 @@ struct nsXREAppData
*/ */
const char *copyright; const char *copyright;
/**
* Indicates whether or not the profile migrator service may be
* invoked at startup when creating a profile.
*/
PRBool enableProfileMigrator;
/**
* Indicates whether or not the extension manager service should be
* initialized at startup.
*/
PRBool enableExtensionManager;
PRBool useStartupPrefs; // XXXbsmedberg this is going away PRBool useStartupPrefs; // XXXbsmedberg this is going away
}; };