bug 88844 preventing xpcom from double init on launch after turbo mode is enabled. Getting turbo mode initialized properly. r=law, sr=alec,seth
git-svn-id: svn://10.0.0.236/branches/MOZILLA_0_9_4_BRANCH@103133 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -793,8 +793,27 @@ static nsresult OpenBrowserWindow(PRInt32 height, PRInt32 width)
|
||||
|
||||
|
||||
static nsresult Ensure1Window( nsICmdLineService* cmdLineArgs)
|
||||
{
|
||||
nsresult rv;
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
#ifdef XP_WIN32
|
||||
// If starting up in server mode, then we do things differently.
|
||||
nsCOMPtr<nsINativeAppSupport> nativeApp;
|
||||
rv = GetNativeAppSupport(getter_AddRefs(nativeApp));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool isServerMode = PR_FALSE;
|
||||
nativeApp->GetIsServerMode(&isServerMode);
|
||||
if (isServerMode) {
|
||||
nativeApp->StartServerMode();
|
||||
}
|
||||
PRBool shouldShowUI = PR_TRUE;
|
||||
nativeApp->GetShouldShowUI(&shouldShowUI);
|
||||
if (!shouldShowUI) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIWindowMediator> windowMediator(do_GetService(kWindowMediatorCID, &rv));
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
@@ -809,21 +828,6 @@ static nsresult Ensure1Window( nsICmdLineService* cmdLineArgs)
|
||||
windowEnumerator->HasMoreElements(&more);
|
||||
if ( !more )
|
||||
{
|
||||
#ifdef XP_WIN32
|
||||
// If starting up in server mode, then we do things differently.
|
||||
nsCOMPtr<nsINativeAppSupport> nativeApp;
|
||||
rv = GetNativeAppSupport(getter_AddRefs(nativeApp));
|
||||
// Create special Nav window.
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool shouldShowUI = PR_TRUE;
|
||||
nativeApp->GetShouldShowUI(&shouldShowUI);
|
||||
if (!shouldShowUI) {
|
||||
nativeApp->StartServerMode();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// No window exists so lets create a browser one
|
||||
PRInt32 height = NS_SIZETOCONTENT;
|
||||
PRInt32 width = NS_SIZETOCONTENT;
|
||||
|
||||
@@ -603,7 +603,29 @@ nsNativeAppSupportWin::CheckConsole() {
|
||||
// Ignore other args.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// check if this is a restart of the browser after quiting from
|
||||
// the servermoded browser instance.
|
||||
if (!mServerMode ) {
|
||||
HKEY key;
|
||||
LONG result = ::RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_QUERY_VALUE, &key );
|
||||
if ( result == ERROR_SUCCESS ) {
|
||||
BYTE regvalue[_MAX_PATH];
|
||||
DWORD type, len = sizeof(regvalue);
|
||||
result = ::RegQueryValueEx( key, NS_QUICKLAUNCH_RUN_KEY, NULL, &type, regvalue, &len);
|
||||
::RegCloseKey( key );
|
||||
if ( result == ERROR_SUCCESS && len > 0 ) {
|
||||
// Make sure the filename in the quicklaunch command matches us
|
||||
char fileName[_MAX_PATH];
|
||||
int rv = ::GetModuleFileName( NULL, fileName, sizeof fileName );
|
||||
if (rv && !PL_strncasecmp(fileName, (const char *)regvalue, PR_MIN(len, strlen(fileName)))) {
|
||||
mServerMode = PR_TRUE;
|
||||
mShouldShowUI = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -919,19 +941,6 @@ nsNativeAppSupportWin::Start( PRBool *aResult ) {
|
||||
|
||||
startupLock.Unlock();
|
||||
|
||||
PRBool serverMode = PR_FALSE;
|
||||
GetIsServerMode( &serverMode );
|
||||
if ( !serverMode ) { // okay, so it's not -turbo
|
||||
HKEY key;
|
||||
LONG result = ::RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_QUERY_VALUE, &key );
|
||||
if ( result == ERROR_SUCCESS ) {
|
||||
result = ::RegQueryValueEx( key, NS_QUICKLAUNCH_RUN_KEY, NULL, NULL, NULL, NULL );
|
||||
::RegCloseKey( key );
|
||||
if ( result == ERROR_SUCCESS )
|
||||
SetIsServerMode( PR_TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -1896,6 +1905,15 @@ nsNativeAppSupportWin::StartServerMode() {
|
||||
|
||||
// Turn on system tray icon.
|
||||
SetupSysTrayIcon();
|
||||
|
||||
if (mShouldShowUI) {
|
||||
// We dont have to anything anymore. The native UI
|
||||
// will create the window
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Since native UI wont create any window, we create a hidden window
|
||||
// so thing work alright.
|
||||
|
||||
// Create some of the objects we'll need.
|
||||
nsCOMPtr<nsIWindowWatcher> ww(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
@@ -1919,24 +1937,24 @@ nsNativeAppSupportWin::StartServerMode() {
|
||||
|
||||
// Put args into array.
|
||||
if ( NS_FAILED( argArray->AppendElement( arg1 ) ) ||
|
||||
NS_FAILED( argArray->AppendElement( arg2 ) ) ) {
|
||||
NS_FAILED( argArray->AppendElement( arg2 ) ) ) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// Now open the window.
|
||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||
ww->OpenWindow( 0,
|
||||
"chrome://navigator/content",
|
||||
"_blank",
|
||||
"chrome,dialog=no,toolbar=no",
|
||||
argArray,
|
||||
getter_AddRefs( newWindow ) );
|
||||
|
||||
"chrome://navigator/content",
|
||||
"_blank",
|
||||
"chrome,dialog=no,toolbar=no",
|
||||
argArray,
|
||||
getter_AddRefs( newWindow ) );
|
||||
|
||||
if ( !newWindow ) {
|
||||
return NS_OK;
|
||||
}
|
||||
mInitialWindow = newWindow;
|
||||
|
||||
|
||||
// Hide this window by re-parenting it (to ensure it doesn't appear).
|
||||
ReParent( newWindow, (HWND)MessageWindow() );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user