For fastback, dispatch the title change notification after we've updated our history entry in the docshell, so that we don't set the title on the wrong history entry. Bug 296745, r+sr=darin, a=asa.
This commit is contained in:
@@ -5248,15 +5248,6 @@ nsDocShell::RestorePresentation(nsISHEntry *aSHEntry, PRBool aSavePresentation,
|
|||||||
aSHEntry->GetRefreshURIList(getter_AddRefs(mRefreshURIList));
|
aSHEntry->GetRefreshURIList(getter_AddRefs(mRefreshURIList));
|
||||||
aSHEntry->SetRefreshURIList(nsnull);
|
aSHEntry->SetRefreshURIList(nsnull);
|
||||||
|
|
||||||
// Restore the page title. Re-setting the current title on the document
|
|
||||||
// will update the docshell title and dispatch DOMTitleChanged.
|
|
||||||
nsIDocument *doc = shell->GetDocument();
|
|
||||||
nsCOMPtr<nsIDOMNSDocument> nsDoc = do_QueryInterface(doc);
|
|
||||||
if (doc && nsDoc) {
|
|
||||||
const nsAFlatString &title = doc->GetDocumentTitle();
|
|
||||||
nsDoc->SetTitle(title);
|
|
||||||
}
|
|
||||||
|
|
||||||
// aSHEntry is now our currently-loaded document.
|
// aSHEntry is now our currently-loaded document.
|
||||||
mOSHE = aSHEntry;
|
mOSHE = aSHEntry;
|
||||||
|
|
||||||
@@ -5304,7 +5295,18 @@ nsDocShell::RestorePresentation(nsISHEntry *aSHEntry, PRBool aSavePresentation,
|
|||||||
|
|
||||||
SetCurrentURI(uri);
|
SetCurrentURI(uri);
|
||||||
|
|
||||||
// Dispatch onload and DOMPageRestore.
|
// Restore the page title. Re-setting the current title on the document
|
||||||
|
// will update the docshell title and dispatch DOMTitleChanged.
|
||||||
|
// (We must do this after setting mOSHE so that the correct history entry
|
||||||
|
// title is set).
|
||||||
|
nsIDocument *doc = shell->GetDocument();
|
||||||
|
nsCOMPtr<nsIDOMNSDocument> nsDoc = do_QueryInterface(doc);
|
||||||
|
if (doc && nsDoc) {
|
||||||
|
const nsAFlatString &title = doc->GetDocumentTitle();
|
||||||
|
nsDoc->SetTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dispatch DOMPageShow and other events.
|
||||||
rv = BeginRestore(PR_TRUE);
|
rv = BeginRestore(PR_TRUE);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user