Bug 395891 - Profile Manager prevents Minefield startup from OS Integration points (links in Mails, etc). patch=Masatoshi Kimura (:emk), r=rstrong, approval1.9.0.2=samuel.sidler

git-svn-id: svn://10.0.0.236/trunk@253313 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rob_strong%exchangecode.com
2008-07-28 02:13:09 +00:00
parent 8c5e0c73cc
commit c5073bc601

View File

@@ -524,13 +524,14 @@ CheckArgShell(const char* aArg)
}
/**
* Spins up Windows DDE when the app needs to restart or the profile manager
* will be displayed during startup and the app has been launched by the Windows
* shell to open an url. This prevents Windows from displaying an error message
* due to the DDE message not being acknowledged.
* Enable Native App Support to process DDE messages when the app needs to
* restart and the app has been launched by the Windows shell to open an url.
* When aWait is false this will process the DDE events manually. This prevents
* Windows from displaying an error message due to the DDE message not being
* acknowledged.
*/
static void
ProcessDDE(nsINativeAppSupport* aNative)
ProcessDDE(nsINativeAppSupport* aNative, PRBool aWait)
{
// When the app is launched by the windows shell the windows shell
// expects the app to be available for DDE messages and if it isn't
@@ -544,13 +545,15 @@ ProcessDDE(nsINativeAppSupport* aNative)
ar = CheckArgShell("requestpending");
if (ar == ARG_FOUND) {
aNative->Enable(); // enable win32 DDE responses
nsIThread *thread = NS_GetCurrentThread();
// This is just a guesstimate based on testing different values.
// If count is 8 or less windows will display an error dialog.
PRInt32 count = 20;
while(--count >= 0) {
NS_ProcessNextEvent(thread);
PR_Sleep(PR_MillisecondsToInterval(1));
if (aWait) {
nsIThread *thread = NS_GetCurrentThread();
// This is just a guesstimate based on testing different values.
// If count is 8 or less windows will display an error dialog.
PRInt32 count = 20;
while(--count >= 0) {
NS_ProcessNextEvent(thread);
PR_Sleep(PR_MillisecondsToInterval(1));
}
}
}
}
@@ -1716,7 +1719,9 @@ ShowProfileManager(nsIToolkitProfileService* aProfileSvc,
#endif
#ifdef XP_WIN
ProcessDDE(aNative);
// we don't have to wait here because profile manager window will pump
// and DDE message will be handled
ProcessDDE(aNative, PR_FALSE);
#endif
{ //extra scoping is needed so we release these components before xpcom shutdown
@@ -3200,7 +3205,7 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
needsRestart = PR_TRUE;
#ifdef XP_WIN
ProcessDDE(nativeApp);
ProcessDDE(nativeApp, PR_TRUE);
#endif
#ifdef XP_MACOSX