Bug 426646, Using location.replace breaks iframe history, r=bz,sr=jst,a=dsicore

git-svn-id: svn://10.0.0.236/trunk@250912 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
Olli.Pettay%helsinki.fi
2008-04-29 07:18:57 +00:00
parent 2cd86f2ed8
commit 4fc99cf5cc
8 changed files with 157 additions and 5 deletions

View File

@@ -2366,8 +2366,26 @@ nsDocShell::AddChild(nsIDocShellTreeItem * aChild)
// XXX in that case docshell hierarchy and SH hierarchy won't match.
{
nsCOMPtr<nsIDocShell> childDocShell = do_QueryInterface(aChild);
if (childDocShell)
childDocShell->SetChildOffset(mChildList.Count() - 1);
if (childDocShell) {
// If there are frameloaders in the finalization list, reduce
// the offset so that the SH hierarchy is more likely to match the
// docshell hierarchy
nsCOMPtr<nsIDOMDocument> domDoc =
do_GetInterface(GetAsSupports(this));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
PRUint32 offset = mChildList.Count() - 1;
if (doc) {
PRUint32 oldChildCount = offset; // Current child count - 1
for (PRUint32 i = 0; i < oldChildCount; ++i) {
nsCOMPtr<nsIDocShell> child = do_QueryInterface(ChildAt(i));
if (doc->FrameLoaderScheduledToBeFinalized(child)) {
--offset;
}
}
}
childDocShell->SetChildOffset(offset);
}
}
/* Set the child's global history if the parent has one */