From e01849d5baafc6154aff90e5c544519fd92957a3 Mon Sep 17 00:00:00 2001 From: "racham%netscape.com" Date: Fri, 10 Jan 2003 00:41:54 +0000 Subject: [PATCH] Fixing bug 167803. Make sure we load content tree owner exists before we load the chrome to avoid crashing on linux in some cases. r=danm, sr=sspitzer --- xpfe/appshell/src/nsXULWindow.cpp | 74 ++++++++++++++++--------------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/xpfe/appshell/src/nsXULWindow.cpp b/xpfe/appshell/src/nsXULWindow.cpp index 63c0fa4e3b1..b3e1d33f4ad 100644 --- a/xpfe/appshell/src/nsXULWindow.cpp +++ b/xpfe/appshell/src/nsXULWindow.cpp @@ -811,44 +811,48 @@ NS_IMETHODIMP nsXULWindow::EnsureAuthPrompter() void nsXULWindow::OnChromeLoaded() { - mChromeLoaded = PR_TRUE; + nsresult rv = EnsureContentTreeOwner(); - if(mContentTreeOwner) - mContentTreeOwner->ApplyChromeFlags(); + if (NS_SUCCEEDED(rv)) { + mChromeLoaded = PR_TRUE; - LoadTitleFromXUL(); - LoadWindowClassFromXUL(); - LoadIconFromXUL(); - LoadSizeFromXUL(); - if(mIntrinsicallySized) { - // (if LoadSizeFromXUL set the size, mIntrinsicallySized will be false) - nsCOMPtr cv; - mDocShell->GetContentViewer(getter_AddRefs(cv)); - nsCOMPtr markupViewer(do_QueryInterface(cv)); - if(markupViewer) - markupViewer->SizeToContent(); + if(mContentTreeOwner) + mContentTreeOwner->ApplyChromeFlags(); + + LoadTitleFromXUL(); + LoadWindowClassFromXUL(); + LoadIconFromXUL(); + LoadSizeFromXUL(); + if(mIntrinsicallySized) { + // (if LoadSizeFromXUL set the size, mIntrinsicallySized will be false) + nsCOMPtr cv; + mDocShell->GetContentViewer(getter_AddRefs(cv)); + nsCOMPtr markupViewer(do_QueryInterface(cv)); + if(markupViewer) + markupViewer->SizeToContent(); + } + + PRBool positionSet = PR_TRUE; + nsCOMPtr parentWindow(do_QueryReferent(mParentWindow)); + #ifdef XP_UNIX + // don't override WM placement on unix for independent, top-level windows + // (however, we think the benefits of intelligent dependent window placement + // trump that override.) + if (!parentWindow) + positionSet = PR_FALSE; + #endif + if (positionSet) + positionSet = LoadPositionFromXUL(); + LoadSizeStateFromXUL(); + + //LoadContentAreas(); + + if (mCenterAfterLoad && !positionSet) + Center(parentWindow, parentWindow ? PR_FALSE : PR_TRUE, PR_FALSE); + + if(mShowAfterLoad) + SetVisibility(PR_TRUE); } - - PRBool positionSet = PR_TRUE; - nsCOMPtr parentWindow(do_QueryReferent(mParentWindow)); -#ifdef XP_UNIX - // don't override WM placement on unix for independent, top-level windows - // (however, we think the benefits of intelligent dependent window placement - // trump that override.) - if (!parentWindow) - positionSet = PR_FALSE; -#endif - if (positionSet) - positionSet = LoadPositionFromXUL(); - LoadSizeStateFromXUL(); - - //LoadContentAreas(); - - if (mCenterAfterLoad && !positionSet) - Center(parentWindow, parentWindow ? PR_FALSE : PR_TRUE, PR_FALSE); - - if(mShowAfterLoad) - SetVisibility(PR_TRUE); } PRBool nsXULWindow::LoadPositionFromXUL()