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,
|
APP_VERSION,
|
||||||
BUILD_ID,
|
BUILD_ID,
|
||||||
"Copyright (c) 2004 mozilla.org",
|
"Copyright (c) 2004 mozilla.org",
|
||||||
|
PR_TRUE,
|
||||||
|
PR_TRUE,
|
||||||
PR_FALSE
|
PR_FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -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,11 +1859,13 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||||||
|
|
||||||
chromeReg->CheckForNewChrome();
|
chromeReg->CheckForNewChrome();
|
||||||
|
|
||||||
nsCOMPtr<nsIExtensionManager> em
|
if (gAppData->enableExtensionManager) {
|
||||||
(do_GetService("@mozilla.org/extensions/manager;1"));
|
nsCOMPtr<nsIExtensionManager> em
|
||||||
NS_ENSURE_TRUE(em, 1);
|
(do_GetService("@mozilla.org/extensions/manager;1"));
|
||||||
|
NS_ENSURE_TRUE(em, 1);
|
||||||
|
|
||||||
em->Register();
|
em->Register();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1937,55 +1959,58 @@ int xre_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||||||
|
|
||||||
//////////////////////// NOW WE HAVE A PROFILE ////////////////////////
|
//////////////////////// NOW WE HAVE A PROFILE ////////////////////////
|
||||||
|
|
||||||
// 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 upgraded = PR_FALSE;
|
||||||
PRBool componentsListChanged = PR_FALSE;
|
PRBool componentsListChanged = PR_FALSE;
|
||||||
|
|
||||||
// Extensions are deemed compatible for all builds in the "x.x.x+"
|
if (gAppData->enableExtensionManager) {
|
||||||
// period in between milestones for developer convenience (even though
|
// Check for version compatibility with the last version of the app this
|
||||||
// ongoing code changes might actually make that a poor assumption.
|
// profile was started with.
|
||||||
// The size and expertise of the nightly build testing community is
|
char version[MAXPATHLEN];
|
||||||
// expected to be sufficient to deal with this issue.
|
GetVersion(lf, version, MAXPATHLEN);
|
||||||
//
|
|
||||||
// Every time a profile is loaded by a build with a different build id,
|
// Extensions are deemed compatible for all builds in the "x.x.x+"
|
||||||
// it updates the compatibility.ini file saying what build last wrote
|
// period in between milestones for developer convenience (even though
|
||||||
// the compreg.dat. On subsequent launches if the build id matches,
|
// ongoing code changes might actually make that a poor assumption.
|
||||||
// there is no need for re-registration. If the user loads the same
|
// The size and expertise of the nightly build testing community is
|
||||||
// profile in different builds the component registry must be
|
// expected to be sufficient to deal with this issue.
|
||||||
// re-generated to prevent mysterious component loading failures.
|
//
|
||||||
//
|
// Every time a profile is loaded by a build with a different build id,
|
||||||
if (!strcmp(version, aAppData->appBuildID)) {
|
// it updates the compatibility.ini file saying what build last wrote
|
||||||
componentsListChanged = ComponentsListChanged(lf);
|
// the compreg.dat. On subsequent launches if the build id matches,
|
||||||
if (componentsListChanged) {
|
// there is no need for re-registration. If the user loads the same
|
||||||
// Remove compreg.dat and xpti.dat, forcing component re-registration,
|
// profile in different builds the component registry must be
|
||||||
// with the new list of additional components directories specified
|
// re-generated to prevent mysterious component loading failures.
|
||||||
// in "components.ini" which we have just discovered changed since the
|
//
|
||||||
// last time the application was run.
|
if (!strcmp(version, aAppData->appBuildID)) {
|
||||||
|
componentsListChanged = ComponentsListChanged(lf);
|
||||||
|
if (componentsListChanged) {
|
||||||
|
// Remove compreg.dat and xpti.dat, forcing component re-registration,
|
||||||
|
// with the new list of additional components directories specified
|
||||||
|
// in "components.ini" which we have just discovered changed since the
|
||||||
|
// last time the application was run.
|
||||||
|
RemoveComponentRegistries(lf);
|
||||||
|
|
||||||
|
// Tell the dir provider to supply the list of components locations
|
||||||
|
// specified in "components.ini" when it is asked for the "ComsDL"
|
||||||
|
// enumeration.
|
||||||
|
dirProvider.RegisterExtraComponents();
|
||||||
|
}
|
||||||
|
// Nothing need be done for the normal startup case.
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Remove compreg.dat and xpti.dat, forcing component re-registration
|
||||||
|
// with the default set of components (this disables any potentially
|
||||||
|
// troublesome incompatible XPCOM components).
|
||||||
RemoveComponentRegistries(lf);
|
RemoveComponentRegistries(lf);
|
||||||
|
|
||||||
// Tell the dir provider to supply the list of components locations
|
// Tell the Extension Manager it should check for incompatible
|
||||||
// specified in "components.ini" when it is asked for the "ComsDL"
|
// Extensions and re-write the Components manifest ("components.ini")
|
||||||
// enumeration.
|
// with a list of XPCOM components for compatible extensions
|
||||||
dirProvider.RegisterExtraComponents();
|
upgraded = PR_TRUE;
|
||||||
|
|
||||||
|
// The Extension Manager will write the Compatibility manifest with
|
||||||
|
// the current app version.
|
||||||
}
|
}
|
||||||
// Nothing need be done for the normal startup case.
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Remove compreg.dat and xpti.dat, forcing component re-registration
|
|
||||||
// with the default set of components (this disables any potentially
|
|
||||||
// troublesome incompatible XPCOM components).
|
|
||||||
RemoveComponentRegistries(lf);
|
|
||||||
|
|
||||||
// Tell the Extension Manager it should check for incompatible
|
|
||||||
// Extensions and re-write the Components manifest ("components.ini")
|
|
||||||
// with a list of XPCOM components for compatible extensions
|
|
||||||
upgraded = PR_TRUE;
|
|
||||||
|
|
||||||
// The Extension Manager will write the Compatibility manifest with
|
|
||||||
// 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,30 +2071,32 @@ 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
|
||||||
nsCOMPtr<nsIExtensionManager> em(do_GetService("@mozilla.org/extensions/manager;1"));
|
if (gAppData->enableExtensionManager) {
|
||||||
NS_ENSURE_TRUE(em, 1);
|
nsCOMPtr<nsIExtensionManager> em(do_GetService("@mozilla.org/extensions/manager;1"));
|
||||||
|
NS_ENSURE_TRUE(em, 1);
|
||||||
|
|
||||||
if (CheckArg("install-global-extension") ||
|
if (CheckArg("install-global-extension") ||
|
||||||
CheckArg("install-global-theme") || CheckArg("list-global-items") ||
|
CheckArg("install-global-theme") || CheckArg("list-global-items") ||
|
||||||
CheckArg("lock-item") || CheckArg("unlock-item")) {
|
CheckArg("lock-item") || CheckArg("unlock-item")) {
|
||||||
// Do the required processing and then shut down.
|
// Do the required processing and then shut down.
|
||||||
em->HandleCommandLineArgs();
|
em->HandleCommandLineArgs();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
char* noEMRestart = PR_GetEnv("NO_EM_RESTART");
|
|
||||||
noRestart = noEMRestart && !strcmp("1", noEMRestart);
|
|
||||||
if (!noRestart && 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))
|
char* noEMRestart = PR_GetEnv("NO_EM_RESTART");
|
||||||
em->Start(componentsListChanged, &needsRestart);
|
noRestart = noEMRestart && !strcmp("1", noEMRestart);
|
||||||
|
if (!noRestart && 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))
|
||||||
|
em->Start(componentsListChanged, &needsRestart);
|
||||||
|
}
|
||||||
|
|
||||||
if (noRestart || (!upgraded && !needsRestart)) {
|
if (noRestart || (!upgraded && !needsRestart)) {
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user