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:
parent
fd313a6a75
commit
dd1a93c1ff
@ -49,6 +49,8 @@ static const nsXREAppData kAppData = {
|
||||
APP_VERSION,
|
||||
BUILD_ID,
|
||||
"Copyright (c) 2004 mozilla.org",
|
||||
PR_TRUE,
|
||||
PR_TRUE,
|
||||
PR_FALSE
|
||||
};
|
||||
|
||||
|
||||
@ -51,6 +51,8 @@ static const nsXREAppData kAppData = {
|
||||
APP_VERSION,
|
||||
BUILD_ID,
|
||||
"Copyright (c) 2004 mozilla.org",
|
||||
PR_FALSE, // no profile migration
|
||||
PR_TRUE,
|
||||
PR_FALSE
|
||||
};
|
||||
|
||||
|
||||
@ -50,6 +50,8 @@ static const nsXREAppData kAppData = {
|
||||
APP_VERSION,
|
||||
BUILD_ID,
|
||||
"Copyright (c) 2004 mozilla.org",
|
||||
PR_TRUE,
|
||||
PR_TRUE,
|
||||
PR_FALSE
|
||||
};
|
||||
|
||||
|
||||
@ -386,8 +386,8 @@ CheckArg(const char* aArg, const char **aParam = nsnull)
|
||||
static const nsXREAppData* LoadAppData(const char* appDataFile)
|
||||
{
|
||||
static char vendor[256], name[256], version[32], buildID[32], copyright[512];
|
||||
static const nsXREAppData data = {
|
||||
vendor, name, version, buildID, copyright, PR_FALSE
|
||||
static nsXREAppData data = {
|
||||
vendor, name, version, buildID, copyright, PR_FALSE, PR_FALSE, PR_FALSE
|
||||
};
|
||||
|
||||
nsCOMPtr<nsILocalFile> lf;
|
||||
@ -412,7 +412,7 @@ static const nsXREAppData* LoadAppData(const char* appDataFile)
|
||||
char* buf;
|
||||
size_t bufLen;
|
||||
PRBool required;
|
||||
} fields[] = {
|
||||
} string_fields[] = {
|
||||
{ "Vendor", vendor, sizeof(vendor), PR_FALSE },
|
||||
{ "Name", name, sizeof(name), PR_TRUE },
|
||||
{ "Version", version, sizeof(version), PR_FALSE },
|
||||
@ -421,17 +421,35 @@ static const nsXREAppData* LoadAppData(const char* appDataFile)
|
||||
};
|
||||
|
||||
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 (fields[i].required) {
|
||||
fprintf(stderr, "Error: %x: No \"%s\" field.\n", rv, fields[i].key);
|
||||
if (string_fields[i].required) {
|
||||
fprintf(stderr, "Error: %x: No \"%s\" field.\n", rv,
|
||||
string_fields[i].key);
|
||||
return nsnull;
|
||||
} 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
|
||||
printf("---------------------------------------------------------\n");
|
||||
printf(" Vendor %s\n", data.appVendor);
|
||||
@ -439,6 +457,8 @@ static const nsXREAppData* LoadAppData(const char* appDataFile)
|
||||
printf(" Version %s\n", data.appVersion);
|
||||
printf(" BuildID %s\n", data.appBuildID);
|
||||
printf(" Copyright %s\n", data.copyright);
|
||||
printf(" EnablePM %u\n", data.enableProfileMigrator);
|
||||
printf(" EnableEM %u\n", data.enableExtensionManager);
|
||||
printf("---------------------------------------------------------\n");
|
||||
#endif
|
||||
|
||||
@ -1839,12 +1859,14 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
|
||||
chromeReg->CheckForNewChrome();
|
||||
|
||||
if (gAppData->enableExtensionManager) {
|
||||
nsCOMPtr<nsIExtensionManager> em
|
||||
(do_GetService("@mozilla.org/extensions/manager;1"));
|
||||
NS_ENSURE_TRUE(em, 1);
|
||||
|
||||
em->Register();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1937,12 +1959,14 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
|
||||
//////////////////////// 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
|
||||
// profile was started with.
|
||||
char 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+"
|
||||
// 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 current app version.
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
appShellService->EnterLastWindowClosingSurvivalArea();
|
||||
|
||||
if (gDoMigration) {
|
||||
// Profile Migration
|
||||
if (gAppData->enableProfileMigrator && gDoMigration) {
|
||||
gDoMigration = PR_FALSE;
|
||||
nsCOMPtr<nsIProfileMigrator> pm
|
||||
(do_CreateInstance(NS_PROFILEMIGRATOR_CONTRACTID));
|
||||
@ -2045,6 +2071,7 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
NS_ENSURE_SUCCESS(rv, 1);
|
||||
|
||||
// Extension Compatibility Checking and Startup
|
||||
if (gAppData->enableExtensionManager) {
|
||||
nsCOMPtr<nsIExtensionManager> em(do_GetService("@mozilla.org/extensions/manager;1"));
|
||||
NS_ENSURE_TRUE(em, 1);
|
||||
|
||||
@ -2069,6 +2096,7 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
|
||||
if (noRestart || (!upgraded || !needsRestart))
|
||||
em->Start(componentsListChanged, &needsRestart);
|
||||
}
|
||||
|
||||
if (noRestart || (!upgraded && !needsRestart)) {
|
||||
|
||||
|
||||
@ -77,6 +77,18 @@ struct nsXREAppData
|
||||
*/
|
||||
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
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user