From afed83178c02a7400e4a32eaa3872b0779bd73d3 Mon Sep 17 00:00:00 2001 From: Mike Conley Date: Wed, 17 Jun 2015 10:26:28 -0400 Subject: [PATCH] Bug 1170488 - Document URI should be updated before sending out onLocationChange. r=smaug --- docshell/base/nsDocShell.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 5b331a43931..1fc4a85afa6 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -10094,6 +10094,11 @@ nsDocShell::InternalLoad(nsIURI* aURI, */ SetHistoryEntry(&mLSHE, aSHEntry); + // Set the doc's URI according to the new history entry's URI. + nsCOMPtr doc = GetDocument(); + NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); + doc->SetDocumentURI(aURI); + /* This is a anchor traversal with in the same page. * call OnNewURI() so that, this traversal will be * recorded in session and global history. @@ -10184,11 +10189,6 @@ nsDocShell::InternalLoad(nsIURI* aURI, } } - // Set the doc's URI according to the new history entry's URI. - nsCOMPtr doc = GetDocument(); - NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); - doc->SetDocumentURI(aURI); - SetDocCurrentStateObj(mOSHE); // Inform the favicon service that the favicon for oldURI also @@ -11716,8 +11716,8 @@ nsDocShell::AddState(JS::Handle aData, const nsAString& aTitle, // document and it requires LOCATION_CHANGE_SAME_DOCUMENT flag. Otherwise, // FireOnLocationChange(...) breaks security UI. if (!equalURIs) { - SetCurrentURI(newURI, nullptr, true, LOCATION_CHANGE_SAME_DOCUMENT); document->SetDocumentURI(newURI); + SetCurrentURI(newURI, nullptr, true, LOCATION_CHANGE_SAME_DOCUMENT); AddURIVisit(newURI, oldURI, oldURI, 0);