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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #include "content/browser/web_contents/web_contents_view_child_frame.h" 72 #include "content/browser/web_contents/web_contents_view_child_frame.h"
73 #include "content/browser/web_contents/web_contents_view_guest.h" 73 #include "content/browser/web_contents/web_contents_view_guest.h"
74 #include "content/browser/webui/generic_handler.h" 74 #include "content/browser/webui/generic_handler.h"
75 #include "content/browser/webui/web_ui_controller_factory_registry.h" 75 #include "content/browser/webui/web_ui_controller_factory_registry.h"
76 #include "content/browser/webui/web_ui_impl.h" 76 #include "content/browser/webui/web_ui_impl.h"
77 #include "content/common/browser_plugin/browser_plugin_constants.h" 77 #include "content/common/browser_plugin/browser_plugin_constants.h"
78 #include "content/common/browser_plugin/browser_plugin_messages.h" 78 #include "content/common/browser_plugin/browser_plugin_messages.h"
79 #include "content/common/frame_messages.h" 79 #include "content/common/frame_messages.h"
80 #include "content/common/input_messages.h" 80 #include "content/common/input_messages.h"
81 #include "content/common/page_messages.h" 81 #include "content/common/page_messages.h"
82 #include "content/common/page_state_serialization.h"
82 #include "content/common/site_isolation_policy.h" 83 #include "content/common/site_isolation_policy.h"
83 #include "content/common/ssl_status_serialization.h" 84 #include "content/common/ssl_status_serialization.h"
84 #include "content/common/view_messages.h" 85 #include "content/common/view_messages.h"
85 #include "content/public/browser/ax_event_notification_details.h" 86 #include "content/public/browser/ax_event_notification_details.h"
86 #include "content/public/browser/browser_context.h" 87 #include "content/public/browser/browser_context.h"
87 #include "content/public/browser/browser_plugin_guest_manager.h" 88 #include "content/public/browser/browser_plugin_guest_manager.h"
88 #include "content/public/browser/content_browser_client.h" 89 #include "content/public/browser/content_browser_client.h"
89 #include "content/public/browser/devtools_agent_host.h" 90 #include "content/public/browser/devtools_agent_host.h"
90 #include "content/public/browser/download_manager.h" 91 #include "content/public/browser/download_manager.h"
91 #include "content/public/browser/download_url_parameters.h" 92 #include "content/public/browser/download_url_parameters.h"
(...skipping 4371 matching lines...) Expand 10 before | Expand all | Expand 10 after
4463 // The SiteInstance might not match if we do a cross-process navigation with 4464 // The SiteInstance might not match if we do a cross-process navigation with
4464 // replacement (e.g., auto-subframe), in which case the swap out of the old 4465 // replacement (e.g., auto-subframe), in which case the swap out of the old
4465 // RenderFrameHost runs in the background after the old FrameNavigationEntry 4466 // RenderFrameHost runs in the background after the old FrameNavigationEntry
4466 // has already been replaced and destroyed. 4467 // has already been replaced and destroyed.
4467 if (frame_entry->site_instance() != rfhi->GetSiteInstance()) 4468 if (frame_entry->site_instance() != rfhi->GetSiteInstance())
4468 return; 4469 return;
4469 4470
4470 if (page_state == frame_entry->page_state()) 4471 if (page_state == frame_entry->page_state())
4471 return; // Nothing to update. 4472 return; // Nothing to update.
4472 4473
4474 // The document_sequence_number and item_sequence_number recorded in the
4475 // FrameNavigationEntry should not differ from the one coming with the update,
4476 // since it must come from the same document. Do not update it if a difference
4477 // is detected, as this indicates that |frame_entry| is not the correct one.
4478 ExplodedPageState exploded_state;
4479 if (!DecodePageState(page_state.ToEncodedData(), &exploded_state))
4480 return;
4481
4482 if (exploded_state.top.document_sequence_number !=
4483 frame_entry->document_sequence_number() ||
4484 exploded_state.top.item_sequence_number !=
4485 frame_entry->item_sequence_number()) {
4486 return;
4487 }
4488
4473 frame_entry->set_page_state(page_state); 4489 frame_entry->set_page_state(page_state);
4474 controller_.NotifyEntryChanged(entry); 4490 controller_.NotifyEntryChanged(entry);
4475 } 4491 }
4476 4492
4477 void WebContentsImpl::UpdateTitle(RenderFrameHost* render_frame_host, 4493 void WebContentsImpl::UpdateTitle(RenderFrameHost* render_frame_host,
4478 int32_t page_id, 4494 int32_t page_id,
4479 const base::string16& title, 4495 const base::string16& title,
4480 base::i18n::TextDirection title_direction) { 4496 base::i18n::TextDirection title_direction) {
4481 // If we have a title, that's a pretty good indication that we've started 4497 // If we have a title, that's a pretty good indication that we've started
4482 // getting useful data. 4498 // getting useful data.
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
5153 for (RenderViewHost* render_view_host : render_view_host_set) 5169 for (RenderViewHost* render_view_host : render_view_host_set)
5154 render_view_host->OnWebkitPreferencesChanged(); 5170 render_view_host->OnWebkitPreferencesChanged();
5155 } 5171 }
5156 5172
5157 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 5173 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
5158 JavaScriptDialogManager* dialog_manager) { 5174 JavaScriptDialogManager* dialog_manager) {
5159 dialog_manager_ = dialog_manager; 5175 dialog_manager_ = dialog_manager;
5160 } 5176 }
5161 5177
5162 } // namespace content 5178 } // namespace content
OLDNEW
« 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