Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1035)

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2243443005: Add check for mismatching item and document sequence numbers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index ed4281631ae4539e348e05b2d6f7d17025c9ef2f..b9ee451241f972fcbe382d6809e4b8611b220fd5 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -79,6 +79,7 @@
#include "content/common/frame_messages.h"
#include "content/common/input_messages.h"
#include "content/common/page_messages.h"
+#include "content/common/page_state_serialization.h"
#include "content/common/site_isolation_policy.h"
#include "content/common/ssl_status_serialization.h"
#include "content/common/view_messages.h"
@@ -4470,6 +4471,21 @@ void WebContentsImpl::UpdateStateForFrame(RenderFrameHost* render_frame_host,
if (page_state == frame_entry->page_state())
return; // Nothing to update.
+ // The document_sequence_number and item_sequence_number recorded in the
+ // FrameNavigationEntry should not differ from the one coming with the update,
+ // since it must come from the same document. Do not update it if a difference
+ // is detected, as this indicates that |frame_entry| is not the correct one.
+ ExplodedPageState exploded_state;
+ if (!DecodePageState(page_state.ToEncodedData(), &exploded_state))
+ return;
+
+ if (exploded_state.top.document_sequence_number !=
+ frame_entry->document_sequence_number() ||
+ exploded_state.top.item_sequence_number !=
+ frame_entry->item_sequence_number()) {
+ return;
+ }
+
frame_entry->set_page_state(page_state);
controller_.NotifyEntryChanged(entry);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698