Bug 1321593 part B - Unify the startup path between `firefox --app` and normal Firefox startup, r?glandium
MozReview-Commit-ID: E6m3eWrX3aB
--- a/browser/app/nsBrowserApp.cpp
+++ b/browser/app/nsBrowserApp.cpp
@@ -254,57 +254,53 @@ static int do_main(int argc, char* argv[
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
shellData.sandboxBrokerServices =
sandboxing::GetInitializedBrokerServices();
#endif
return XRE_XPCShellMain(--argc, argv, envp, &shellData);
}
+ XREAppData appData;
+ appData.xreDirectory = xreDirectory;
+
if (appini) {
- XREAppData appData;
rv = XRE_ParseAppData(appini, appData);
if (NS_FAILED(rv)) {
Output("Couldn't read application.ini");
return 255;
}
-#if defined(HAS_DLL_BLOCKLIST)
- // The dll blocklist operates in the exe vs. xullib. Pass a flag to
- // xullib so automated tests can check the result once the browser
- // is up and running.
- appData->flags |=
- DllBlocklist_CheckStatus() ? NS_XRE_DLL_BLOCKLIST_ENABLED : 0;
+
+ appini->GetParent(getter_AddRefs(appData.directory));
+ } else {
+ // no -app flag so we use the compiled-in app data
+ appData = sAppData;
+
+ nsCOMPtr<nsIFile> exeFile;
+ rv = mozilla::BinaryPath::GetFile(argv[0], getter_AddRefs(exeFile));
+ if (NS_FAILED(rv)) {
+ Output("Couldn't find the application directory.\n");
+ return 255;
+ }
+
+ nsCOMPtr<nsIFile> greDir;
+ exeFile->GetParent(getter_AddRefs(greDir));
+#ifdef XP_MACOSX
+ greDir->SetNativeLeafName(NS_LITERAL_CSTRING(kOSXResourcesFolder));
#endif
- appData.xreDirectory = xreDirectory;
- appini->GetParent(getter_AddRefs(appData.directory));
- return XRE_main(argc, argv, appData, mainFlags);
+ nsCOMPtr<nsIFile> appSubdir;
+ greDir->Clone(getter_AddRefs(appSubdir));
+ appSubdir->Append(NS_LITERAL_STRING(kDesktopFolder));
+ appData.directory = appSubdir;
}
- XREAppData appData;
- appData = sAppData;
- nsCOMPtr<nsIFile> exeFile;
- rv = mozilla::BinaryPath::GetFile(argv[0], getter_AddRefs(exeFile));
- if (NS_FAILED(rv)) {
- Output("Couldn't find the application directory.\n");
- return 255;
- }
-
- nsCOMPtr<nsIFile> greDir;
- exeFile->GetParent(getter_AddRefs(greDir));
-#ifdef XP_MACOSX
- greDir->SetNativeLeafName(NS_LITERAL_CSTRING(kOSXResourcesFolder));
-#endif
- nsCOMPtr<nsIFile> appSubdir;
- greDir->Clone(getter_AddRefs(appSubdir));
- appSubdir->Append(NS_LITERAL_STRING(kDesktopFolder));
-
- appData.directory = appSubdir;
- appData.xreDirectory = xreDirectory;
-
#if defined(HAS_DLL_BLOCKLIST)
+ // The dll blocklist operates in the exe vs. xullib. Pass a flag to
+ // xullib so automated tests can check the result once the browser
+ // is up and running.
appData.flags |=
DllBlocklist_CheckStatus() ? NS_XRE_DLL_BLOCKLIST_ENABLED : 0;
#endif
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
sandbox::BrokerServices* brokerServices =
sandboxing::GetInitializedBrokerServices();
#if defined(MOZ_CONTENT_SANDBOX)