diff --git a/mozilla/xpfe/appshell/src/nsXULWindow.cpp b/mozilla/xpfe/appshell/src/nsXULWindow.cpp index 23f27fcc2c9..281faabfd34 100644 --- a/mozilla/xpfe/appshell/src/nsXULWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsXULWindow.cpp @@ -557,6 +557,27 @@ NS_IMETHODIMP nsXULWindow::PersistPositionAndSize(PRBool aPosition, PRBool aSize return NS_OK; } +NS_IMETHODIMP nsXULWindow::ContentShellAdded(nsIDocShellTreeItem* aContentShell, + PRBool aPrimary, const PRUnichar* aID) +{ + nsContentShellInfo* shellInfo = new nsContentShellInfo(aID, aPrimary, aContentShell); + + mContentShells.AppendElement((void*)shellInfo); + + // Set the default content tree owner if one does not exist. + + nsCOMPtr treeOwner; + aContentShell->GetTreeOwner(getter_AddRefs(treeOwner)); + + if(!treeOwner) + { + NS_ENSURE_SUCCESS(EnsureContentTreeOwner(), NS_ERROR_FAILURE); + aContentShell->SetTreeOwner(mContentTreeOwner); + } + + return NS_OK; +} + //***************************************************************************** // nsXULWindow: Accessors //***************************************************************************** @@ -572,4 +593,5 @@ nsContentShellInfo::nsContentShellInfo(const nsString& aID, PRBool aPrimary, nsContentShellInfo::~nsContentShellInfo() { + //XXX Set Tree Owner to null if the tree owner is nsXULWindow->mContentTreeOwner } diff --git a/mozilla/xpfe/appshell/src/nsXULWindow.h b/mozilla/xpfe/appshell/src/nsXULWindow.h index a95eae5e03a..82c745c0404 100644 --- a/mozilla/xpfe/appshell/src/nsXULWindow.h +++ b/mozilla/xpfe/appshell/src/nsXULWindow.h @@ -54,7 +54,7 @@ public: protected: nsXULWindow(); - ~nsXULWindow(); + virtual ~nsXULWindow(); NS_IMETHOD EnsureChromeTreeOwner(); NS_IMETHOD EnsureContentTreeOwner(); @@ -62,6 +62,8 @@ protected: NS_IMETHOD GetDOMElementFromDocShell(nsIDocShell* aDocShell, nsIDOMElement** aDOMElement); NS_IMETHOD PersistPositionAndSize(PRBool aPosition, PRBool aSize); + NS_IMETHOD ContentShellAdded(nsIDocShellTreeItem* aContentShell, + PRBool aPrimary, const PRUnichar* aID); protected: nsChromeTreeOwner* mChromeTreeOwner;