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" | 9 #include "base/debug/dump_without_crashing.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 is_download_(false), | 117 is_download_(false), |
118 is_stream_(false), | 118 is_stream_(false), |
119 started_from_context_menu_(started_from_context_menu), | 119 started_from_context_menu_(started_from_context_menu), |
120 reload_type_(ReloadType::NONE), | 120 reload_type_(ReloadType::NONE), |
121 restore_type_(RestoreType::NONE), | 121 restore_type_(RestoreType::NONE), |
122 navigation_type_(NAVIGATION_TYPE_UNKNOWN), | 122 navigation_type_(NAVIGATION_TYPE_UNKNOWN), |
123 should_check_main_world_csp_(should_check_main_world_csp), | 123 should_check_main_world_csp_(should_check_main_world_csp), |
124 is_form_submission_(is_form_submission), | 124 is_form_submission_(is_form_submission), |
125 expected_render_process_host_id_(ChildProcessHost::kInvalidUniqueID), | 125 expected_render_process_host_id_(ChildProcessHost::kInvalidUniqueID), |
126 weak_factory_(this) { | 126 weak_factory_(this) { |
127 is_in_constructor = true; | |
128 TRACE_EVENT_ASYNC_BEGIN2("navigation", "NavigationHandle", this, | 127 TRACE_EVENT_ASYNC_BEGIN2("navigation", "NavigationHandle", this, |
129 "frame_tree_node", | 128 "frame_tree_node", |
130 frame_tree_node_->frame_tree_node_id(), "url", | 129 frame_tree_node_->frame_tree_node_id(), "url", |
131 url_.possibly_invalid_spec()); | 130 url_.possibly_invalid_spec()); |
132 DCHECK(!navigation_start.is_null()); | 131 DCHECK(!navigation_start.is_null()); |
133 | 132 |
134 site_url_ = SiteInstance::GetSiteForURL(frame_tree_node_->current_frame_host() | 133 site_url_ = SiteInstance::GetSiteForURL(frame_tree_node_->current_frame_host() |
135 ->GetSiteInstance() | 134 ->GetSiteInstance() |
136 ->GetBrowserContext(), | 135 ->GetBrowserContext(), |
137 url_); | 136 url_); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 if (IsInMainFrame()) { | 170 if (IsInMainFrame()) { |
172 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( | 171 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( |
173 "navigation", "Navigation StartToCommit", this, | 172 "navigation", "Navigation StartToCommit", this, |
174 navigation_start, "Initial URL", url_.spec()); | 173 navigation_start, "Initial URL", url_.spec()); |
175 } | 174 } |
176 | 175 |
177 if (is_same_document_) { | 176 if (is_same_document_) { |
178 TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this, | 177 TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this, |
179 "Same document"); | 178 "Same document"); |
180 } | 179 } |
181 is_in_constructor = false; | |
182 } | 180 } |
183 | 181 |
184 NavigationHandleImpl::~NavigationHandleImpl() { | 182 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. | 183 // Inform the RenderProcessHost to no longer expect a navigation. |
191 if (expected_render_process_host_id_ != ChildProcessHost::kInvalidUniqueID) { | 184 if (expected_render_process_host_id_ != ChildProcessHost::kInvalidUniqueID) { |
192 RenderProcessHost* process = | 185 RenderProcessHost* process = |
193 RenderProcessHost::FromID(expected_render_process_host_id_); | 186 RenderProcessHost::FromID(expected_render_process_host_id_); |
194 if (process) { | 187 if (process) { |
195 RenderProcessHostImpl::RemoveExpectedNavigationToSite( | 188 RenderProcessHostImpl::RemoveExpectedNavigationToSite( |
196 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), | 189 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), |
197 process, site_url_); | 190 process, site_url_); |
198 } | 191 } |
199 } | 192 } |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
623 const GURL& new_referrer_url, | 616 const GURL& new_referrer_url, |
624 bool new_is_external_protocol, | 617 bool new_is_external_protocol, |
625 scoped_refptr<net::HttpResponseHeaders> response_headers, | 618 scoped_refptr<net::HttpResponseHeaders> response_headers, |
626 net::HttpResponseInfo::ConnectionInfo connection_info, | 619 net::HttpResponseInfo::ConnectionInfo connection_info, |
627 RenderProcessHost* post_redirect_process, | 620 RenderProcessHost* post_redirect_process, |
628 const ThrottleChecksFinishedCallback& callback) { | 621 const ThrottleChecksFinishedCallback& callback) { |
629 TRACE_EVENT_ASYNC_STEP_INTO1("navigation", "NavigationHandle", this, | 622 TRACE_EVENT_ASYNC_STEP_INTO1("navigation", "NavigationHandle", this, |
630 "WillRedirectRequest", "url", | 623 "WillRedirectRequest", "url", |
631 new_url.possibly_invalid_spec()); | 624 new_url.possibly_invalid_spec()); |
632 | 625 |
633 // TODO(arthursonzogni): Remove this when we understand the root cause behind | 626 // |new_url| is not expected to be a "renderer debug" url. It should be |
634 // crbug.com/704892 and crbug.com/736658 | 627 // blocked in NavigationRequest::OnRequestRedirected or in |
628 // ResourceLoader::OnReceivedRedirect. If it is not the case, | |
629 // DidFinishNavigation will not be called. It could confuse some | |
630 // WebContentsObserver because DidStartNavigation was called. | |
635 if (IsRendererDebugURL(new_url)) | 631 if (IsRendererDebugURL(new_url)) |
636 base::debug::DumpWithoutCrashing(); | 632 base::debug::DumpWithoutCrashing(); |
Charlie Reis
2017/07/07 17:12:59
We shouldn't leave DumpWithoutCrashing calls in th
arthursonzogni
2017/07/10 16:07:04
Done.
| |
637 | 633 |
638 // Update the navigation parameters. | 634 // Update the navigation parameters. |
639 url_ = new_url; | 635 url_ = new_url; |
640 method_ = new_method; | 636 method_ = new_method; |
641 UpdateSiteURL(post_redirect_process); | 637 UpdateSiteURL(post_redirect_process); |
642 | 638 |
643 if (!(transition_ & ui::PAGE_TRANSITION_CLIENT_REDIRECT)) { | 639 if (!(transition_ & ui::PAGE_TRANSITION_CLIENT_REDIRECT)) { |
644 sanitized_referrer_.url = new_referrer_url; | 640 sanitized_referrer_.url = new_referrer_url; |
645 sanitized_referrer_ = | 641 sanitized_referrer_ = |
646 Referrer::SanitizeForRequest(url_, sanitized_referrer_); | 642 Referrer::SanitizeForRequest(url_, sanitized_referrer_); |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1184 // Stop expecting a navigation to the current site URL in the current expected | 1180 // Stop expecting a navigation to the current site URL in the current expected |
1185 // process. | 1181 // process. |
1186 SetExpectedProcess(nullptr); | 1182 SetExpectedProcess(nullptr); |
1187 | 1183 |
1188 // Update the site URL and the expected process. | 1184 // Update the site URL and the expected process. |
1189 site_url_ = new_site_url; | 1185 site_url_ = new_site_url; |
1190 SetExpectedProcess(post_redirect_process); | 1186 SetExpectedProcess(post_redirect_process); |
1191 } | 1187 } |
1192 | 1188 |
1193 } // namespace content | 1189 } // namespace content |
OLD | NEW |