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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2172123004: Add check for mismatching item and document sequence numbers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/debug/dump_without_crashing.h"
13 #include "base/feature_list.h" 14 #include "base/feature_list.h"
14 #include "base/lazy_instance.h" 15 #include "base/lazy_instance.h"
15 #include "base/location.h" 16 #include "base/location.h"
16 #include "base/logging.h" 17 #include "base/logging.h"
17 #include "base/macros.h" 18 #include "base/macros.h"
18 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
19 #include "base/metrics/histogram.h" 20 #include "base/metrics/histogram.h"
20 #include "base/process/process.h" 21 #include "base/process/process.h"
21 #include "base/profiler/scoped_tracker.h" 22 #include "base/profiler/scoped_tracker.h"
22 #include "base/single_thread_task_runner.h" 23 #include "base/single_thread_task_runner.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #include "content/browser/web_contents/web_contents_view_guest.h" 75 #include "content/browser/web_contents/web_contents_view_guest.h"
75 #include "content/browser/webui/generic_handler.h" 76 #include "content/browser/webui/generic_handler.h"
76 #include "content/browser/webui/web_ui_controller_factory_registry.h" 77 #include "content/browser/webui/web_ui_controller_factory_registry.h"
77 #include "content/browser/webui/web_ui_impl.h" 78 #include "content/browser/webui/web_ui_impl.h"
78 #include "content/common/browser_plugin/browser_plugin_constants.h" 79 #include "content/common/browser_plugin/browser_plugin_constants.h"
79 #include "content/common/browser_plugin/browser_plugin_messages.h" 80 #include "content/common/browser_plugin/browser_plugin_messages.h"
80 #include "content/common/frame_messages.h" 81 #include "content/common/frame_messages.h"
81 #include "content/common/input/web_input_event_traits.h" 82 #include "content/common/input/web_input_event_traits.h"
82 #include "content/common/input_messages.h" 83 #include "content/common/input_messages.h"
83 #include "content/common/page_messages.h" 84 #include "content/common/page_messages.h"
85 #include "content/common/page_state_serialization.h"
84 #include "content/common/site_isolation_policy.h" 86 #include "content/common/site_isolation_policy.h"
85 #include "content/common/ssl_status_serialization.h" 87 #include "content/common/ssl_status_serialization.h"
86 #include "content/common/view_messages.h" 88 #include "content/common/view_messages.h"
87 #include "content/public/browser/ax_event_notification_details.h" 89 #include "content/public/browser/ax_event_notification_details.h"
88 #include "content/public/browser/browser_context.h" 90 #include "content/public/browser/browser_context.h"
89 #include "content/public/browser/browser_plugin_guest_manager.h" 91 #include "content/public/browser/browser_plugin_guest_manager.h"
90 #include "content/public/browser/content_browser_client.h" 92 #include "content/public/browser/content_browser_client.h"
91 #include "content/public/browser/devtools_agent_host.h" 93 #include "content/public/browser/devtools_agent_host.h"
92 #include "content/public/browser/download_manager.h" 94 #include "content/public/browser/download_manager.h"
93 #include "content/public/browser/download_url_parameters.h" 95 #include "content/public/browser/download_url_parameters.h"
(...skipping 4374 matching lines...) Expand 10 before | Expand all | Expand 10 after
4468 // The SiteInstance might not match if we do a cross-process navigation with 4470 // The SiteInstance might not match if we do a cross-process navigation with
4469 // replacement (e.g., auto-subframe), in which case the swap out of the old 4471 // replacement (e.g., auto-subframe), in which case the swap out of the old
4470 // RenderFrameHost runs in the background after the old FrameNavigationEntry 4472 // RenderFrameHost runs in the background after the old FrameNavigationEntry
4471 // has already been replaced and destroyed. 4473 // has already been replaced and destroyed.
4472 if (frame_entry->site_instance() != rfhi->GetSiteInstance()) 4474 if (frame_entry->site_instance() != rfhi->GetSiteInstance())
4473 return; 4475 return;
4474 4476
4475 if (page_state == frame_entry->page_state()) 4477 if (page_state == frame_entry->page_state())
4476 return; // Nothing to update. 4478 return; // Nothing to update.
4477 4479
4480 // The document_sequence_number and item_sequence_number recorded in the
4481 // FrameNavigationEntry should not differ from the one coming with the update,
4482 // since it must come from the same document.
4483 ExplodedPageState exploded_state;
4484 if (!DecodePageState(page_state.ToEncodedData(), &exploded_state))
4485 return;
Charlie Reis 2016/07/22 22:46:11 I'm slightly curious if there are ever cases we'd
nasko 2016/07/22 23:02:34 It would fail only in the case we fail to deserial
4486
4487 if (exploded_state.top.document_sequence_number !=
4488 frame_entry->document_sequence_number() ||
4489 exploded_state.top.item_sequence_number !=
4490 frame_entry->item_sequence_number()) {
4491 // TODO(nasko): Generate a minidump, which can be debugged to understand the
Charlie Reis 2016/07/22 22:46:11 This isn't really a TODO, since we're generating t
nasko 2016/07/22 23:02:34 Hah, this is what I meant to do, but didn't. Fixed
4492 // root cause of this unexpected update.
4493 base::debug::Alias(&page_state);
4494 base::debug::DumpWithoutCrashing();
4495 return;
4496 }
4497
4478 frame_entry->set_page_state(page_state); 4498 frame_entry->set_page_state(page_state);
4479 controller_.NotifyEntryChanged(entry); 4499 controller_.NotifyEntryChanged(entry);
4480 } 4500 }
4481 4501
4482 void WebContentsImpl::UpdateTitle(RenderFrameHost* render_frame_host, 4502 void WebContentsImpl::UpdateTitle(RenderFrameHost* render_frame_host,
4483 int32_t page_id, 4503 int32_t page_id,
4484 const base::string16& title, 4504 const base::string16& title,
4485 base::i18n::TextDirection title_direction) { 4505 base::i18n::TextDirection title_direction) {
4486 // If we have a title, that's a pretty good indication that we've started 4506 // If we have a title, that's a pretty good indication that we've started
4487 // getting useful data. 4507 // getting useful data.
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
5153 for (RenderViewHost* render_view_host : render_view_host_set) 5173 for (RenderViewHost* render_view_host : render_view_host_set)
5154 render_view_host->OnWebkitPreferencesChanged(); 5174 render_view_host->OnWebkitPreferencesChanged();
5155 } 5175 }
5156 5176
5157 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 5177 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
5158 JavaScriptDialogManager* dialog_manager) { 5178 JavaScriptDialogManager* dialog_manager) {
5159 dialog_manager_ = dialog_manager; 5179 dialog_manager_ = dialog_manager;
5160 } 5180 }
5161 5181
5162 } // namespace content 5182 } // 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