mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
When creating a frame after a page has loaded and loading a new document into
it, don't try to treat it as a subframe history traversal, since there is no original history entry involved so the cloning operation fails. Just append the session history entry for the newly loaded frame to the history entry for the page as we would have if the load were done during pageload. Bug 237717, r=adamlock, sr=darin
This commit is contained in:
parent
b5aa006eb5
commit
2a21577680
@ -2251,6 +2251,13 @@ nsDocShell::AddChildSHEntry(nsISHEntry * aCloneRef, nsISHEntry * aNewEntry,
|
|||||||
rv = container->AddChild(aNewEntry, aChildOffset);
|
rv = container->AddChild(aNewEntry, aChildOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!aCloneRef) {
|
||||||
|
/* This is an initial load in some subframe. Just append it if we can */
|
||||||
|
nsCOMPtr<nsISHContainer> container(do_QueryInterface(mOSHE, &rv));
|
||||||
|
if (container) {
|
||||||
|
rv = container->AddChild(aNewEntry, aChildOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (mSessionHistory) {
|
else if (mSessionHistory) {
|
||||||
/* You are currently in the rootDocShell.
|
/* You are currently in the rootDocShell.
|
||||||
* You will get here when a subframe has a new url
|
* You will get here when a subframe has a new url
|
||||||
@ -2272,9 +2279,7 @@ nsDocShell::AddChildSHEntry(nsISHEntry * aCloneRef, nsISHEntry * aNewEntry,
|
|||||||
nsCOMPtr<nsISHEntry> currentEntry(do_QueryInterface(currentHE));
|
nsCOMPtr<nsISHEntry> currentEntry(do_QueryInterface(currentHE));
|
||||||
if (currentEntry) {
|
if (currentEntry) {
|
||||||
PRUint32 cloneID = 0;
|
PRUint32 cloneID = 0;
|
||||||
nsCOMPtr<nsISHEntry> nextEntry; //(do_CreateInstance(NS_SHENTRY_CONTRACTID));
|
nsCOMPtr<nsISHEntry> nextEntry;
|
||||||
// NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
|
|
||||||
if (aCloneRef)
|
|
||||||
aCloneRef->GetID(&cloneID);
|
aCloneRef->GetID(&cloneID);
|
||||||
rv = CloneAndReplace(currentEntry, cloneID, aNewEntry,
|
rv = CloneAndReplace(currentEntry, cloneID, aNewEntry,
|
||||||
getter_AddRefs(nextEntry));
|
getter_AddRefs(nextEntry));
|
||||||
@ -2288,6 +2293,18 @@ nsDocShell::AddChildSHEntry(nsISHEntry * aCloneRef, nsISHEntry * aNewEntry,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
/* Just pass this along */
|
||||||
|
nsCOMPtr<nsIDocShellHistory> parent(do_QueryInterface(mParent, &rv));
|
||||||
|
if (parent) {
|
||||||
|
rv = parent->AddChildSHEntry(aCloneRef, aNewEntry, aChildOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsDocShell::DoAddChildSHEntry(nsISHEntry* aNewEntry, PRInt32 aChildOffset)
|
||||||
|
{
|
||||||
/* You will get here when you are in a subframe and
|
/* You will get here when you are in a subframe and
|
||||||
* a new url has been loaded on you.
|
* a new url has been loaded on you.
|
||||||
* The mOSHE in this subframe will be the previous url's
|
* The mOSHE in this subframe will be the previous url's
|
||||||
@ -2295,14 +2312,10 @@ nsDocShell::AddChildSHEntry(nsISHEntry * aCloneRef, nsISHEntry * aNewEntry,
|
|||||||
* for this subframe in the CloneAndReplace function.
|
* for this subframe in the CloneAndReplace function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
nsCOMPtr<nsIDocShellHistory> parent(do_QueryInterface(mParent, &rv));
|
nsCOMPtr<nsIDocShellHistory> parent(do_QueryInterface(mParent, &rv));
|
||||||
if (parent) {
|
if (parent) {
|
||||||
if (!aCloneRef) {
|
rv = parent->AddChildSHEntry(mOSHE, aNewEntry, aChildOffset);
|
||||||
aCloneRef = mOSHE;
|
|
||||||
}
|
|
||||||
rv = parent->AddChildSHEntry(aCloneRef, aNewEntry, aChildOffset);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -6212,7 +6225,7 @@ nsDocShell::AddToSessionHistory(nsIURI * aURI,
|
|||||||
// This is a subframe.
|
// This is a subframe.
|
||||||
if ((mLoadType != LOAD_NORMAL_REPLACE) ||
|
if ((mLoadType != LOAD_NORMAL_REPLACE) ||
|
||||||
(mLoadType == LOAD_NORMAL_REPLACE && !mOSHE))
|
(mLoadType == LOAD_NORMAL_REPLACE && !mOSHE))
|
||||||
rv = AddChildSHEntry(nsnull, entry, mChildOffset);
|
rv = DoAddChildSHEntry(entry, mChildOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the new SH entry...
|
// Return the new SH entry...
|
||||||
|
@ -251,6 +251,7 @@ protected:
|
|||||||
virtual PRBool ShouldAddToSessionHistory(nsIURI * aURI);
|
virtual PRBool ShouldAddToSessionHistory(nsIURI * aURI);
|
||||||
virtual nsresult AddToSessionHistory(nsIURI * aURI, nsIChannel * aChannel,
|
virtual nsresult AddToSessionHistory(nsIURI * aURI, nsIChannel * aChannel,
|
||||||
nsISHEntry ** aNewEntry);
|
nsISHEntry ** aNewEntry);
|
||||||
|
nsresult DoAddChildSHEntry(nsISHEntry* aNewEntry, PRInt32 aChildOffset);
|
||||||
|
|
||||||
NS_IMETHOD LoadHistoryEntry(nsISHEntry * aEntry, PRUint32 aLoadType);
|
NS_IMETHOD LoadHistoryEntry(nsISHEntry * aEntry, PRUint32 aLoadType);
|
||||||
NS_IMETHOD PersistLayoutHistoryState();
|
NS_IMETHOD PersistLayoutHistoryState();
|
||||||
|
Loading…
Reference in New Issue
Block a user