OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/frame_host/navigation_handle_impl.h" | 5 #include "content/browser/frame_host/navigation_handle_impl.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/debug/dump_without_crashing.h" | |
10 #include "base/logging.h" | 9 #include "base/logging.h" |
11 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
12 #include "content/browser/appcache/appcache_navigation_handle.h" | 11 #include "content/browser/appcache/appcache_navigation_handle.h" |
13 #include "content/browser/appcache/appcache_service_impl.h" | 12 #include "content/browser/appcache/appcache_service_impl.h" |
14 #include "content/browser/child_process_security_policy_impl.h" | 13 #include "content/browser/child_process_security_policy_impl.h" |
15 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 14 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
16 #include "content/browser/frame_host/ancestor_throttle.h" | 15 #include "content/browser/frame_host/ancestor_throttle.h" |
17 #include "content/browser/frame_host/data_url_navigation_throttle.h" | 16 #include "content/browser/frame_host/data_url_navigation_throttle.h" |
18 #include "content/browser/frame_host/debug_urls.h" | 17 #include "content/browser/frame_host/debug_urls.h" |
19 #include "content/browser/frame_host/form_submission_throttle.h" | 18 #include "content/browser/frame_host/form_submission_throttle.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 is_download_(false), | 116 is_download_(false), |
118 is_stream_(false), | 117 is_stream_(false), |
119 started_from_context_menu_(started_from_context_menu), | 118 started_from_context_menu_(started_from_context_menu), |
120 reload_type_(ReloadType::NONE), | 119 reload_type_(ReloadType::NONE), |
121 restore_type_(RestoreType::NONE), | 120 restore_type_(RestoreType::NONE), |
122 navigation_type_(NAVIGATION_TYPE_UNKNOWN), | 121 navigation_type_(NAVIGATION_TYPE_UNKNOWN), |
123 should_check_main_world_csp_(should_check_main_world_csp), | 122 should_check_main_world_csp_(should_check_main_world_csp), |
124 is_form_submission_(is_form_submission), | 123 is_form_submission_(is_form_submission), |
125 expected_render_process_host_id_(ChildProcessHost::kInvalidUniqueID), | 124 expected_render_process_host_id_(ChildProcessHost::kInvalidUniqueID), |
126 weak_factory_(this) { | 125 weak_factory_(this) { |
127 is_in_constructor = true; | |
128 TRACE_EVENT_ASYNC_BEGIN2("navigation", "NavigationHandle", this, | 126 TRACE_EVENT_ASYNC_BEGIN2("navigation", "NavigationHandle", this, |
129 "frame_tree_node", | 127 "frame_tree_node", |
130 frame_tree_node_->frame_tree_node_id(), "url", | 128 frame_tree_node_->frame_tree_node_id(), "url", |
131 url_.possibly_invalid_spec()); | 129 url_.possibly_invalid_spec()); |
132 DCHECK(!navigation_start.is_null()); | 130 DCHECK(!navigation_start.is_null()); |
133 | 131 |
134 site_url_ = SiteInstance::GetSiteForURL(frame_tree_node_->current_frame_host() | 132 site_url_ = SiteInstance::GetSiteForURL(frame_tree_node_->current_frame_host() |
135 ->GetSiteInstance() | 133 ->GetSiteInstance() |
136 ->GetBrowserContext(), | 134 ->GetBrowserContext(), |
137 url_); | 135 url_); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 if (IsInMainFrame()) { | 169 if (IsInMainFrame()) { |
172 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( | 170 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( |
173 "navigation", "Navigation StartToCommit", this, | 171 "navigation", "Navigation StartToCommit", this, |
174 navigation_start, "Initial URL", url_.spec()); | 172 navigation_start, "Initial URL", url_.spec()); |
175 } | 173 } |
176 | 174 |
177 if (is_same_document_) { | 175 if (is_same_document_) { |
178 TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this, | 176 TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this, |
179 "Same document"); | 177 "Same document"); |
180 } | 178 } |
181 is_in_constructor = false; | |
182 } | 179 } |
183 | 180 |
184 NavigationHandleImpl::~NavigationHandleImpl() { | 181 NavigationHandleImpl::~NavigationHandleImpl() { |
185 // TODO(arthursonzogni): Remove this when we understand the root cause behind | |
186 // crbug.com/704892. | |
187 if (is_in_constructor) | |
188 base::debug::DumpWithoutCrashing(); | |
189 | |
190 // Inform the RenderProcessHost to no longer expect a navigation. | 182 // Inform the RenderProcessHost to no longer expect a navigation. |
191 if (expected_render_process_host_id_ != ChildProcessHost::kInvalidUniqueID) { | 183 if (expected_render_process_host_id_ != ChildProcessHost::kInvalidUniqueID) { |
192 RenderProcessHost* process = | 184 RenderProcessHost* process = |
193 RenderProcessHost::FromID(expected_render_process_host_id_); | 185 RenderProcessHost::FromID(expected_render_process_host_id_); |
194 if (process) { | 186 if (process) { |
195 RenderProcessHostImpl::RemoveExpectedNavigationToSite( | 187 RenderProcessHostImpl::RemoveExpectedNavigationToSite( |
196 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), | 188 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), |
197 process, site_url_); | 189 process, site_url_); |
198 } | 190 } |
199 } | 191 } |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 const GURL& new_referrer_url, | 638 const GURL& new_referrer_url, |
647 bool new_is_external_protocol, | 639 bool new_is_external_protocol, |
648 scoped_refptr<net::HttpResponseHeaders> response_headers, | 640 scoped_refptr<net::HttpResponseHeaders> response_headers, |
649 net::HttpResponseInfo::ConnectionInfo connection_info, | 641 net::HttpResponseInfo::ConnectionInfo connection_info, |
650 RenderProcessHost* post_redirect_process, | 642 RenderProcessHost* post_redirect_process, |
651 const ThrottleChecksFinishedCallback& callback) { | 643 const ThrottleChecksFinishedCallback& callback) { |
652 TRACE_EVENT_ASYNC_STEP_INTO1("navigation", "NavigationHandle", this, | 644 TRACE_EVENT_ASYNC_STEP_INTO1("navigation", "NavigationHandle", this, |
653 "WillRedirectRequest", "url", | 645 "WillRedirectRequest", "url", |
654 new_url.possibly_invalid_spec()); | 646 new_url.possibly_invalid_spec()); |
655 | 647 |
656 // TODO(arthursonzogni): Remove this when we understand the root cause behind | 648 // |new_url| is not expected to be a "renderer debug" url. It should be |
657 // crbug.com/704892 and crbug.com/736658 | 649 // blocked in NavigationRequest::OnRequestRedirected or in |
658 if (IsRendererDebugURL(new_url)) | 650 // ResourceLoader::OnReceivedRedirect. If it is not the case, |
659 base::debug::DumpWithoutCrashing(); | 651 // DidFinishNavigation will not be called. It could confuse some |
| 652 // WebContentsObserver because DidStartNavigation was called. |
| 653 // See https://crbug.com/728398. |
| 654 CHECK(!IsRendererDebugURL(new_url)); |
660 | 655 |
661 // Update the navigation parameters. | 656 // Update the navigation parameters. |
662 url_ = new_url; | 657 url_ = new_url; |
663 method_ = new_method; | 658 method_ = new_method; |
664 UpdateSiteURL(post_redirect_process); | 659 UpdateSiteURL(post_redirect_process); |
665 | 660 |
666 if (!(transition_ & ui::PAGE_TRANSITION_CLIENT_REDIRECT)) { | 661 if (!(transition_ & ui::PAGE_TRANSITION_CLIENT_REDIRECT)) { |
667 sanitized_referrer_.url = new_referrer_url; | 662 sanitized_referrer_.url = new_referrer_url; |
668 sanitized_referrer_ = | 663 sanitized_referrer_ = |
669 Referrer::SanitizeForRequest(url_, sanitized_referrer_); | 664 Referrer::SanitizeForRequest(url_, sanitized_referrer_); |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 // Stop expecting a navigation to the current site URL in the current expected | 1217 // Stop expecting a navigation to the current site URL in the current expected |
1223 // process. | 1218 // process. |
1224 SetExpectedProcess(nullptr); | 1219 SetExpectedProcess(nullptr); |
1225 | 1220 |
1226 // Update the site URL and the expected process. | 1221 // Update the site URL and the expected process. |
1227 site_url_ = new_site_url; | 1222 site_url_ = new_site_url; |
1228 SetExpectedProcess(post_redirect_process); | 1223 SetExpectedProcess(post_redirect_process); |
1229 } | 1224 } |
1230 | 1225 |
1231 } // namespace content | 1226 } // namespace content |
OLD | NEW |