diff --git a/profile/src/nsProfile.cpp b/profile/src/nsProfile.cpp index 7697dec4dd82..c9151491a122 100644 --- a/profile/src/nsProfile.cpp +++ b/profile/src/nsProfile.cpp @@ -1506,6 +1506,11 @@ NS_IMETHODIMP nsProfile::StartApprunner(const char* profileName) prefs->ResetPrefs(); prefs->ReadUserPrefs(); +/* + // rjc says: no longer do this! The profile manager now runs BEFORE + // hiddenwindow.xul (which causes bookmarks to be read in) is loaded + + // we need to re-read the bookmarks here, other wise the user // won't have there 4.x bookmarks until after they exit and come back NS_WITH_SERVICE(nsIBookmarksService, bookmarks, kBookmarksCID, &rv); @@ -1516,6 +1521,7 @@ NS_IMETHODIMP nsProfile::StartApprunner(const char* profileName) printf("failed to read bookmarks\n"); return rv; } +*/ rv = CloseRegistry(); if (NS_FAILED(rv)) return rv; diff --git a/xpfe/appshell/public/nsIAppShellService.idl b/xpfe/appshell/public/nsIAppShellService.idl index b426d9c26452..07f99d4e0de5 100644 --- a/xpfe/appshell/public/nsIAppShellService.idl +++ b/xpfe/appshell/public/nsIAppShellService.idl @@ -149,6 +149,9 @@ interface nsIAppShellService : nsISupports */ void CloseTopLevelWindow(in nsIWebShellWindow aWindow); + [noscript] + void CreateHiddenWindow(); + /** * Return the (singleton) application hidden window, automatically created * and maintained by this AppShellService. diff --git a/xpfe/appshell/src/nsAppShellService.cpp b/xpfe/appshell/src/nsAppShellService.cpp index 803dcf44fb77..54a20ef9ce8f 100644 --- a/xpfe/appshell/src/nsAppShellService.cpp +++ b/xpfe/appshell/src/nsAppShellService.cpp @@ -114,7 +114,6 @@ protected: nsIXULWindowCallbacks *aCallbacks, PRInt32 aInitialWidth, PRInt32 aInitialHeight, nsIWebShellWindow **aResult); - void CreateHiddenWindow(); void InitializeComponent( const nsCID &aComponentCID ); void ShutdownComponent( const nsCID &aComponentCID ); typedef void (nsAppShellService::*EnumeratorMemberFunction)(const nsCID&); @@ -258,13 +257,16 @@ nsAppShellService::Initialize( nsICmdLineService *aCmdLineService ) rv = nsServiceManager::GetService(kWindowMediatorCID, kIWindowMediatorIID, (nsISupports**) &mWindowMediator); - CreateHiddenWindow(); +// CreateHiddenWindow(); // rjc: now require this to be explicitly called done: return rv; } -void nsAppShellService::CreateHiddenWindow() + + +NS_IMETHODIMP +nsAppShellService::CreateHiddenWindow() { nsresult rv; nsIURI* url = nsnull; @@ -814,15 +816,24 @@ nsAppShellService::UnregisterTopLevelWindow(nsIWebShellWindow* aWindow) if (0 == cnt) { #if XP_MAC - // Given hidden window the focus so it puts up the menu - nsIWidget* widget = NULL; - mHiddenWindow->GetWidget( widget ); - if( widget ) - { - widget->SetFocus(); - - widget->Release(); - } + if (mHiddenWindow) + { + // Given hidden window the focus so it puts up the menu + nsIWidget* widget = NULL; + mHiddenWindow->GetWidget( widget ); + if( widget ) + { + widget->SetFocus(); + + widget->Release(); + } + } + else + { + // if no hidden window is available (perhaps due to initial + // Profile Manager window being cancelled), then just quit + Quit(); + } #else Quit(); #endif diff --git a/xpfe/bootstrap/nsAppRunner.cpp b/xpfe/bootstrap/nsAppRunner.cpp index 35f9f897f13a..249e546ccf3d 100644 --- a/xpfe/bootstrap/nsAppRunner.cpp +++ b/xpfe/bootstrap/nsAppRunner.cpp @@ -516,8 +516,8 @@ static nsresult main1(int argc, char* argv[]) #ifdef DEBUG printf("started appcores\n"); #endif + - // Create the Application Shell instance... NS_WITH_SERVICE(nsIAppShellService, appShell, kAppShellServiceCID, &rv); if (NS_FAILED(rv)) { @@ -548,6 +548,10 @@ static nsresult main1(int argc, char* argv[]) } PR_FREEIF(currentProfileStr); + // rjc: now must explicitly call appshell's CreateHiddenWindow() function AFTER profile manager. + // if the profile manager ever switches to using nsIDOMWindow stuff, this might have to change + appShell->CreateHiddenWindow(); + if ( CheckAndRunPrefs(cmdLineArgs) ) return NS_OK;