Index: content/renderer/render_view.cc |
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc |
index 972349f99357ff3f7c6cac7319e352f3c04c2599..622be2e3b95271e288180d6bac83fa3c7c6f0374 100644 |
--- a/content/renderer/render_view.cc |
+++ b/content/renderer/render_view.cc |
@@ -703,6 +703,8 @@ bool RenderView::OnMessageReceived(const IPC::Message& message) { |
#endif |
IPC_MESSAGE_HANDLER(ViewMsg_UpdateRemoteAccessClientFirewallTraversal, |
OnUpdateRemoteAccessClientFirewallTraversal) |
+ IPC_MESSAGE_HANDLER(ViewMsg_OffsetAndPruneHistory, |
+ OnOffsetAndPruneHistory) |
// Have the super handle all other messages. |
IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
IPC_END_MESSAGE_MAP() |
@@ -713,6 +715,16 @@ void RenderView::OnNavigate(const ViewMsg_Navigate_Params& params) { |
if (!webview()) |
return; |
+ LOG(ERROR) << "OnNavigate." |
+ << " rv=" << this |
+ << " url=" << params.url.spec() |
+ << " history_list_offset_=" << history_list_offset_ |
+ << " history_list_length_=" << history_list_length_ |
+ << " params.current_history_list_offset=" |
+ << params.current_history_list_offset |
+ << " params.current_history_list_length=" |
+ << params.current_history_list_length; |
+ |
bool is_reload = |
params.navigation_type == ViewMsg_Navigate_Type::RELOAD || |
params.navigation_type == ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE; |
@@ -845,14 +857,21 @@ bool RenderView::IsBackForwardToStaleEntry( |
// Check for whether the forward history has been cropped due to a recent |
// navigation the browser didn't know about. |
- if (params.pending_history_list_offset >= history_list_length_) |
+ if (params.pending_history_list_offset >= history_list_length_) { |
+ LOG(ERROR) << "History Length is cropped." |
+ << " rv=" << this |
+ << " pending=" << params.pending_history_list_offset |
+ << " stored=" << history_list_length_; |
return true; |
+ } |
// Check for whether this entry has been replaced with a new one. |
int expected_page_id = |
history_page_ids_[params.pending_history_list_offset]; |
- if (expected_page_id > 0 && params.page_id != expected_page_id) |
+ if (expected_page_id > 0 && params.page_id != expected_page_id) { |
+ LOG(ERROR) << "Mismatched page id"; |
return true; |
+ } |
return false; |
} |
@@ -1017,6 +1036,22 @@ void RenderView::OnScrollFocusedEditableNodeIntoView() { |
} |
} |
+void RenderView::OnOffsetAndPruneHistory(int offset) { |
+ LOG(ERROR) << "OnOffsetAndPruneHistory." |
+ << " offset=" << offset; |
+ int current_page_id = -1; |
+ if (history_list_offset_ >= 0) { |
+ current_page_id = history_page_ids_[history_list_offset_]; |
+ } |
+ |
+ // We may have multiple things in the list? Or just one? |
+ history_list_offset_ = offset; |
+ history_list_length_ = offset + 1; |
+ if (history_list_length_ >= 0) |
+ history_page_ids_.resize(history_list_length_, -1); |
+ history_page_ids_[history_list_offset_] = current_page_id; |
+} |
+ |
/////////////////////////////////////////////////////////////////////////////// |
// Tell the embedding application that the URL of the active page has changed |
@@ -1230,6 +1265,9 @@ void RenderView::UpdateSessionHistory(WebFrame* frame) { |
if (item.isNull()) |
return; |
+ LOG(ERROR) << "Updating session history." |
+ << " rv=" << this |
+ << " page_id_=" << page_id_; |
Send(new ViewHostMsg_UpdateState( |
routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); |
} |
@@ -2493,6 +2531,10 @@ void RenderView::didCommitProvisionalLoad(WebFrame* frame, |
if (history_list_offset_ >= content::kMaxSessionHistoryEntries) |
history_list_offset_ = content::kMaxSessionHistoryEntries - 1; |
history_list_length_ = history_list_offset_ + 1; |
+ LOG(ERROR) << "didCommitProvisionalLoad." |
+ << " rv=" << this |
+ << " page_id_" << page_id_ |
+ << " history_list_length_=" << history_list_length_; |
history_page_ids_.resize(history_list_length_, -1); |
history_page_ids_[history_list_offset_] = page_id_; |
} else { |