OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 bool should_preserve_entry = controller_->IsUnmodifiedBlankTab() || | 220 bool should_preserve_entry = controller_->IsUnmodifiedBlankTab() || |
221 delegate_->ShouldPreserveAbortedURLs(); | 221 delegate_->ShouldPreserveAbortedURLs(); |
222 if (controller_->GetPendingEntry() != controller_->GetVisibleEntry() || | 222 if (controller_->GetPendingEntry() != controller_->GetVisibleEntry() || |
223 !should_preserve_entry) { | 223 !should_preserve_entry) { |
224 controller_->DiscardPendingEntry(true); | 224 controller_->DiscardPendingEntry(true); |
225 | 225 |
226 // Also force the UI to refresh. | 226 // Also force the UI to refresh. |
227 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); | 227 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); |
228 } | 228 } |
229 | 229 |
| 230 // If this failure came from a pending RenderFrameHost rather than the |
| 231 // current one, the current RenderFrameHost needs to be notified to stop |
| 232 // its load. Typically, the pending RenderFrameHost should be created only |
| 233 // once the browser process is sure that it will commit, but there is a case |
| 234 // where this is currently not true, which is when a cross-process frame is |
| 235 // blocked by X-Frame-Options or CSP frame-ancestors. This check will also |
| 236 // guard against any future such cases. |
| 237 // |
| 238 // TODO(mkwst, alexmos): The case above should disappear when X-Frame-Options |
| 239 // and CSP enforcement moves to the browser process |
| 240 // (https://crbug.com/555418). |
| 241 RenderFrameHostManager* manager = |
| 242 render_frame_host->frame_tree_node()->render_manager(); |
| 243 if (render_frame_host == manager->pending_frame_host()) |
| 244 manager->current_frame_host()->Stop(); |
| 245 |
230 if (delegate_) | 246 if (delegate_) |
231 delegate_->DidFailProvisionalLoadWithError(render_frame_host, params); | 247 delegate_->DidFailProvisionalLoadWithError(render_frame_host, params); |
232 } | 248 } |
233 | 249 |
234 void NavigatorImpl::DidFailLoadWithError( | 250 void NavigatorImpl::DidFailLoadWithError( |
235 RenderFrameHostImpl* render_frame_host, | 251 RenderFrameHostImpl* render_frame_host, |
236 const GURL& url, | 252 const GURL& url, |
237 int error_code, | 253 int error_code, |
238 const base::string16& error_description, | 254 const base::string16& error_description, |
239 bool was_ignored_by_handler) { | 255 bool was_ignored_by_handler) { |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 entry->set_should_replace_entry(pending_entry->should_replace_entry()); | 1093 entry->set_should_replace_entry(pending_entry->should_replace_entry()); |
1078 entry->SetRedirectChain(pending_entry->GetRedirectChain()); | 1094 entry->SetRedirectChain(pending_entry->GetRedirectChain()); |
1079 } | 1095 } |
1080 controller_->SetPendingEntry(std::move(entry)); | 1096 controller_->SetPendingEntry(std::move(entry)); |
1081 if (delegate_) | 1097 if (delegate_) |
1082 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1098 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
1083 } | 1099 } |
1084 } | 1100 } |
1085 | 1101 |
1086 } // namespace content | 1102 } // namespace content |
OLD | NEW |