summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-24 23:05:01 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-24 23:05:01 +0000
commitf4d34b535564d19fbad5109c8b9535b3ce2df705 (patch)
treead37507aa6889190c639b02be6d2067312d1972a /chrome
parent09c767b6f7ca36f57f27712fd19f2c0f6673da02 (diff)
downloadchromium_src-f4d34b535564d19fbad5109c8b9535b3ce2df705.zip
chromium_src-f4d34b535564d19fbad5109c8b9535b3ce2df705.tar.gz
chromium_src-f4d34b535564d19fbad5109c8b9535b3ce2df705.tar.bz2
Don't save state when the page ID doesn't change.
http://code.google.com/p/chromium/issues/detail?id=4684 Review URL: http://codereview.chromium.org/12613 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5942 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/renderer/render_view.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 3fd05d1..6b84f9f 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -1147,6 +1147,9 @@ void RenderView::UpdateEncoding(WebFrame* frame,
}
}
+// Sends the previous session history state to the browser so it will be saved
+// before we navigate to a new page. This must be called *before* the page ID
+// has been updated so we know what it was.
void RenderView::UpdateSessionHistory(WebFrame* frame) {
// If we have a valid page ID at this point, then it corresponds to the page
// we are navigating away from. Otherwise, this is the first navigation, so
@@ -1387,11 +1390,15 @@ void RenderView::DidCommitLoadForFrame(WebView *webview, WebFrame* frame,
// of capturing session history, the first committed frame suffices. We
// keep track of whether we've seen this commit before so that only capture
// session history once per navigation.
+ //
+ // Note that we need to check if the page ID changed. In the case of a
+ // reload, the page ID doesn't change, and UpdateSessionHistory gets the
+ // previous URL and the current page ID, which would be wrong.
if (extra_data && !extra_data->is_new_navigation() &&
- !extra_data->request_committed) {
+ !extra_data->request_committed &&
+ page_id_ != extra_data->pending_page_id()) {
// This is a successful session history navigation!
UpdateSessionHistory(frame);
-
page_id_ = extra_data->pending_page_id();
}
}