author | Benjamin Smedberg <benjamin@smedbergs.us> |
Tue, 13 Dec 2016 09:15:31 -0500 | |
changeset 325687 | 620f6fd4477004d81ee133fcd8dfb24ab1009512 |
parent 325686 | a0e38abdcdd86d611d979dd7b64654da1f455494 |
child 325688 | f49e998f4b6a7cc63e305dbfecb727cad2409f00 |
push id | 84769 |
push user | bsmedberg@mozilla.com |
push date | Tue, 13 Dec 2016 14:18:28 +0000 |
treeherder | mozilla-inbound@620f6fd44770 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | glandium |
bugs | 1321593 |
milestone | 53.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- 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) @@ -436,31 +432,32 @@ int main(int argc, char* argv[], char* e // InitXPCOMGlue calls NS_LogInit, so we need to balance it here. NS_LogTerm(); return result; } #endif - nsIFile *xreDirectory; + nsCOMPtr<nsIFile> xreDirectory; - nsresult rv = InitXPCOMGlue(argv[0], &xreDirectory); + nsresult rv = InitXPCOMGlue(argv[0], getter_AddRefs(xreDirectory)); if (NS_FAILED(rv)) { return 255; } XRE_StartupTimelineRecord(mozilla::StartupTimeline::START, start); #ifdef MOZ_BROWSER_CAN_BE_CONTENTPROC XRE_EnableSameExecutableForContentProc(); #endif int result = do_main(argc, argv, envp, xreDirectory); + xreDirectory = nullptr; NS_LogTerm(); #ifdef XP_MACOSX // Allow writes again. While we would like to catch writes from static // destructors to allow early exits to use _exit, we know that there is // at least one such write that we don't control (see bug 826029). For // now we enable writes again and early exits will have to use exit instead // of _exit.