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()) | |
alexmos
2016/02/25 21:59:12
Here, one case I was thinking about is if A embeds
Charlie Reis
2016/02/26 01:13:22
Right, the RFHM will destroy the RFH for B before
| |
244 manager->current_frame_host()->Stop(); | |
alexmos
2016/02/25 21:59:12
I did this more generically, as opposed to stoppin
alexmos
2016/02/25 21:59:12
Note also that I'm not cleaning up the pending RFH
Charlie Reis
2016/02/26 01:13:22
Camille, is RFHI::Stop() the right way to handle t
Charlie Reis
2016/02/26 01:13:22
Right. I'm sad to hear that there's still trouble
| |
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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1065 entry->set_should_replace_entry(pending_entry->should_replace_entry()); | 1081 entry->set_should_replace_entry(pending_entry->should_replace_entry()); |
1066 entry->SetRedirectChain(pending_entry->GetRedirectChain()); | 1082 entry->SetRedirectChain(pending_entry->GetRedirectChain()); |
1067 } | 1083 } |
1068 controller_->SetPendingEntry(std::move(entry)); | 1084 controller_->SetPendingEntry(std::move(entry)); |
1069 if (delegate_) | 1085 if (delegate_) |
1070 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1086 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
1071 } | 1087 } |
1072 } | 1088 } |
1073 | 1089 |
1074 } // namespace content | 1090 } // namespace content |
OLD | NEW |