mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 12:55:46 +00:00
Clear the old child docshells when SetDOMDocument is called, so that they don't get persisted in session history before they're GC'd. Also, update SHEntry to hold strong references to the child docshells. Bug 319551, r=sicking sr=bzbarsky
This commit is contained in:
parent
82349f3f5e
commit
1230d880ae
@ -82,9 +82,7 @@ interface nsISHEntry : nsIHistoryEntry
|
||||
[noscript] void setViewerBounds([const] in nsRect bounds);
|
||||
|
||||
/**
|
||||
* Saved child docshells corresponding to contentViewer. There are weak
|
||||
* references since it's assumed that the content viewer's document has
|
||||
* an owning reference to the subdocument for each shell. The child shells
|
||||
* Saved child docshells corresponding to contentViewer. The child shells
|
||||
* are restored as children of the parent docshell, in this order, when the
|
||||
* parent docshell restores a saved presentation.
|
||||
*/
|
||||
|
@ -572,16 +572,14 @@ NS_IMETHODIMP
|
||||
nsSHEntry::AddChildShell(nsIDocShellTreeItem *aShell)
|
||||
{
|
||||
NS_ASSERTION(aShell, "Null child shell added to history entry");
|
||||
mChildShells.AppendElement(aShell);
|
||||
mChildShells.AppendObject(aShell);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::ChildShellAt(PRInt32 aIndex, nsIDocShellTreeItem **aShell)
|
||||
{
|
||||
NS_IF_ADDREF(*aShell =
|
||||
NS_STATIC_CAST(nsIDocShellTreeItem*,
|
||||
mChildShells.SafeElementAt(aIndex)));
|
||||
NS_IF_ADDREF(*aShell = mChildShells.SafeObjectAt(aIndex));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ private:
|
||||
nsISHEntry * mParent; // weak reference
|
||||
nsCOMPtr<nsISupports> mWindowState;
|
||||
nsRect mViewerBounds;
|
||||
nsVoidArray mChildShells;
|
||||
nsCOMArray<nsIDocShellTreeItem> mChildShells;
|
||||
nsCOMPtr<nsISupportsArray> mRefreshURIList;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
};
|
||||
|
@ -1476,6 +1476,19 @@ DocumentViewerImpl::Destroy()
|
||||
if (mPrintEngine->CheckBeforeDestroy()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Clear the list of old child docshells. CChild docshells for the new
|
||||
// document will be constructed as frames are created.
|
||||
nsCOMPtr<nsIDocShellTreeNode> node = do_QueryInterface(container);
|
||||
if (node) {
|
||||
PRInt32 count;
|
||||
node->GetChildCount(&count);
|
||||
for (PRInt32 i = 0; i < count; ++i) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> child;
|
||||
node->GetChildAt(0, getter_AddRefs(child));
|
||||
node->RemoveChild(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user