Bug 544535 - Ignore push/replaceState's title argument. r=sicking, approval2.0=benjamin

--HG--
extra : rebase_source : 3db157c08faee321e2ae1e86fc45d1290c8009ae
This commit is contained in:
Justin Lebar 2010-07-19 14:46:01 -07:00
parent 820e122c88
commit 9601b70dc6
2 changed files with 8 additions and 7 deletions

View File

@ -9219,8 +9219,7 @@ nsDocShell::AddState(nsIVariant *aData, const nsAString& aTitle,
// after the current entry with the following properties, or modify the
// current session history entry to set
// a. cloned data as the state object,
// b. the given title as the title, and,
// c. if the third argument was present, the absolute URL found in
// b. if the third argument was present, the absolute URL found in
// step 2
// 5. If aReplace is false (i.e. we're doing a pushState instead of a
// replaceState), notify bfcache that we've navigated to a new page.
@ -9233,6 +9232,8 @@ nsDocShell::AddState(nsIVariant *aData, const nsAString& aTitle,
// active content viewer. Since EvictContentViewers at the end of step 5
// might run script, we can't just put a script blocker around the critical
// section.
//
// Note that we completely ignore the aTitle parameter.
nsresult rv;
@ -9421,10 +9422,6 @@ nsDocShell::AddState(nsIVariant *aData, const nsAString& aTitle,
FireOnLocationChange(this, nsnull, mCurrentURI);
}
// Try to set the title of the current history element
if (mOSHE)
mOSHE->SetTitle(aTitle);
return NS_OK;
}

View File

@ -480,7 +480,11 @@ function runTest() {
popup.history.replaceState({n:1, ok:true}, "state 1", "good1.html");
locationEndsWith(popup, "good1.html");
is(getSHTitle(shistory), "state 1", "SHEntry title 'state 1'");
// Even though we replaceState with title "state 1", the title should remain
// "test 1" because we ignore the title argument in push/replaceState.
// See bug 544535.
is(getSHTitle(shistory), "test 1", "SHEntry title 'state 1'");
// Flush the event loop so our next load creates a new session history entry.
shortWait();