author | Nickolay Ponomarev <asqueella@gmail.com> |
Sat, 17 Apr 2010 13:50:17 +0400 | |
changeset 40957 | 981132d2f5d6476a0b96fb005367b84421268d21 |
parent 40956 | 545ddfeebe837da6f0c198caa2da45f525ec1c7e |
child 40958 | 4cf9cdbdae0af86928601d5f5e562ec002ea06d0 |
push id | 12847 |
push user | asqueella@gmail.com |
push date | Sat, 17 Apr 2010 09:50:49 +0000 |
treeherder | mozilla-central@981132d2f5d6 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 369147 |
milestone | 1.9.3a5pre |
first release with | nightly linux32
981132d2f5d6
/
3.7a5pre
/
20100417031107
/
files
nightly linux64
981132d2f5d6
/
3.7a5pre
/
20100417030650
/
files
nightly mac
981132d2f5d6
/
3.7a5pre
/
20100417030650
/
files
nightly win32
981132d2f5d6
/
3.7a5pre
/
20100417040211
/
files
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
|
releases | nightly linux32
3.7a5pre
/
20100417031107
/
pushlog to previous
nightly linux64
3.7a5pre
/
20100417030650
/
pushlog to previous
nightly mac
3.7a5pre
/
20100417030650
/
pushlog to previous
nightly win32
3.7a5pre
/
20100417040211
/
pushlog to previous
|
--- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -1709,17 +1709,17 @@ static nsresult LaunchChild(nsINativeApp if (aBlankCommandLine) { gRestartArgc = 1; gRestartArgv[gRestartArgc] = nsnull; } PR_SetEnv("MOZ_LAUNCHED_CHILD=1"); #if defined(XP_MACOSX) - SetupMacCommandLine(gRestartArgc, gRestartArgv); + SetupMacCommandLine(gRestartArgc, gRestartArgv, PR_TRUE); LaunchChildMac(gRestartArgc, gRestartArgv); #else nsCOMPtr<nsILocalFile> lf; nsresult rv = XRE_GetBinaryPath(gArgv[0], getter_AddRefs(lf)); if (NS_FAILED(rv)) return rv; #if defined(XP_WIN) @@ -1914,17 +1914,17 @@ ShowProfileManager(nsIToolkitProfileServ NS_ENSURE_SUCCESS(rv, rv); rv = xpcom.DoAutoreg(); rv |= xpcom.RegisterProfileService(); rv |= xpcom.SetWindowCreator(aNative); NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); #ifdef XP_MACOSX - SetupMacCommandLine(gRestartArgc, gRestartArgv); + SetupMacCommandLine(gRestartArgc, gRestartArgv, PR_TRUE); #endif #ifdef XP_WIN // we don't have to wait here because profile manager window will pump // and DDE message will be handled ProcessDDE(aNative, PR_FALSE); #endif @@ -2004,17 +2004,17 @@ ImportProfiles(nsIToolkitProfileService* { // scope XPCOM ScopedXPCOMStartup xpcom; rv = xpcom.Initialize(); if (NS_SUCCEEDED(rv)) { xpcom.DoAutoreg(); xpcom.RegisterProfileService(); #ifdef XP_MACOSX - SetupMacCommandLine(gRestartArgc, gRestartArgv); + SetupMacCommandLine(gRestartArgc, gRestartArgv, PR_TRUE); #endif nsCOMPtr<nsIProfileMigrator> migrator (do_GetService(NS_PROFILEMIGRATOR_CONTRACTID)); if (migrator) { migrator->Import(); } } @@ -3463,17 +3463,17 @@ XRE_main(int argc, char* argv[], const n if (!shuttingDown) { #ifdef XP_MACOSX // we re-initialize the command-line service and do appleevents munging // after we are sure that we're not restarting cmdLine = do_CreateInstance("@mozilla.org/toolkit/command-line;1"); NS_ENSURE_TRUE(cmdLine, 1); - SetupMacCommandLine(gArgc, gArgv); + SetupMacCommandLine(gArgc, gArgv, PR_FALSE); rv = cmdLine->Init(gArgc, gArgv, workingDir, nsICommandLine::STATE_INITIAL_LAUNCH); NS_ENSURE_SUCCESS(rv, 1); #endif #ifdef MOZ_WIDGET_COCOA // Prepare Cocoa's form of Apple Event handling. SetupMacApplicationDelegate(); @@ -3552,17 +3552,17 @@ XRE_main(int argc, char* argv[], const n // registry - major milestone vs. build id. needsRestart = PR_TRUE; #ifdef XP_WIN ProcessDDE(nativeApp, PR_TRUE); #endif #ifdef XP_MACOSX - SetupMacCommandLine(gRestartArgc, gRestartArgv); + SetupMacCommandLine(gRestartArgc, gRestartArgv, PR_TRUE); #endif } } } // unlock the profile after ScopedXPCOMStartup object (xpcom) // has gone out of scope. see bug #386739 for more details profileLock->Unlock();
--- a/toolkit/xre/nsCommandLineServiceMac.cpp +++ b/toolkit/xre/nsCommandLineServiceMac.cpp @@ -138,44 +138,45 @@ nsresult nsMacCommandLine::Initialize(in mStartedUp = PR_TRUE; argc = mArgsUsed; argv = mArgs; return NS_OK; } -void nsMacCommandLine::SetupCommandLine(int& argc, char**& argv) +void nsMacCommandLine::SetupCommandLine(int& argc, char**& argv, PRBool forRestart) { // Initializes the command line from Apple Events and other sources, // as appropriate for OS X. // // IMPORTANT: This must be done before XPCOM shutdown if the app is to // relaunch (i.e. before the ScopedXPCOMStartup object goes out of scope). // XPCOM shutdown can cause other things to process native events, and // native event processing can cause the waiting Apple Events to be // discarded. // Process Apple Events and put them into the arguments. Initialize(argc, argv); - Boolean isForeground = PR_FALSE; - ProcessSerialNumber psnSelf, psnFront; + if (forRestart) { + Boolean isForeground = PR_FALSE; + ProcessSerialNumber psnSelf, psnFront; - // If the process will be relaunched, the child should be in the foreground - // if the parent is in the foreground. This will be communicated in a - // command-line argument to the child. Adding this argument is harmless - // if not relaunching. - if (::GetCurrentProcess(&psnSelf) == noErr && - ::GetFrontProcess(&psnFront) == noErr && - ::SameProcess(&psnSelf, &psnFront, &isForeground) == noErr && - isForeground) { - // The process is currently in the foreground. The relaunched - // process should come to the front, too. - AddToCommandLine("-foreground"); + // If the process will be relaunched, the child should be in the foreground + // if the parent is in the foreground. This will be communicated in a + // command-line argument to the child. + if (::GetCurrentProcess(&psnSelf) == noErr && + ::GetFrontProcess(&psnFront) == noErr && + ::SameProcess(&psnSelf, &psnFront, &isForeground) == noErr && + isForeground) { + // The process is currently in the foreground. The relaunched + // process should come to the front, too. + AddToCommandLine("-foreground"); + } } argc = mArgsUsed; argv = mArgs; } nsresult nsMacCommandLine::AddToCommandLine(const char* inArgText) { @@ -317,13 +318,13 @@ nsresult nsMacCommandLine::DispatchURLTo if (NS_SUCCEEDED(rv)) rv = AddToCommandLine(url); return rv; } #pragma mark - -void SetupMacCommandLine(int& argc, char**& argv) +void SetupMacCommandLine(int& argc, char**& argv, PRBool forRestart) { nsMacCommandLine& cmdLine = nsMacCommandLine::GetMacCommandLine(); - return cmdLine.SetupCommandLine(argc, argv); + return cmdLine.SetupCommandLine(argc, argv, forRestart); }
--- a/toolkit/xre/nsCommandLineServiceMac.h +++ b/toolkit/xre/nsCommandLineServiceMac.h @@ -54,17 +54,17 @@ public: { kArgsGrowSize = 20 }; nsMacCommandLine(); ~nsMacCommandLine(); nsresult Initialize(int& argc, char**& argv); - void SetupCommandLine(int& argc, char**& argv); + void SetupCommandLine(int& argc, char**& argv, PRBool forRestart); nsresult AddToCommandLine(const char* inArgText); nsresult AddToCommandLine(const char* inOptionString, const CFURLRef file); nsresult AddToEnvironmentVars(const char* inArgText); nsresult HandleOpenOneDoc(const CFURLRef file, OSType inFileType); nsresult HandlePrintOneDoc(const CFURLRef file, OSType fileType); @@ -87,11 +87,11 @@ public: static nsMacCommandLine& GetMacCommandLine() { return sMacCommandLine; } private: static nsMacCommandLine sMacCommandLine; }; -void SetupMacCommandLine(int& argc, char**& argv); +void SetupMacCommandLine(int& argc, char**& argv, PRBool forRestart); #endif // nsCommandLineServiceMac_h_
--- a/toolkit/xre/nsUpdateDriver.cpp +++ b/toolkit/xre/nsUpdateDriver.cpp @@ -537,17 +537,17 @@ ApplyUpdate(nsIFile *greDir, nsIFile *up if (!attr) goto end; status = PR_ProcessAttrSetCurrentDirectory(attr, applyToDir.get()); if (status != PR_SUCCESS) goto end; #ifdef XP_MACOSX - SetupMacCommandLine(argc, argv); + SetupMacCommandLine(argc, argv, PR_TRUE); #endif PR_CreateProcessDetached(updaterPath.get(), argv, nsnull, attr); exit(0); end: PR_DestroyProcessAttr(attr); delete[] argv;