Chromium Code Reviews| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "content/browser/frame_host/frame_tree.h" | |
| 8 #include "content/browser/frame_host/frame_tree_node.h" | 9 #include "content/browser/frame_host/frame_tree_node.h" |
| 9 #include "content/browser/frame_host/navigation_controller_impl.h" | 10 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 10 #include "content/browser/frame_host/navigation_entry_impl.h" | 11 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 11 #include "content/browser/frame_host/navigator_delegate.h" | 12 #include "content/browser/frame_host/navigator_delegate.h" |
| 12 #include "content/browser/frame_host/render_frame_host_impl.h" | 13 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 13 #include "content/browser/renderer_host/render_view_host_impl.h" | 14 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 14 #include "content/browser/site_instance_impl.h" | 15 #include "content/browser/site_instance_impl.h" |
| 16 #include "content/common/frame_messages.h" | |
| 15 #include "content/public/browser/browser_context.h" | 17 #include "content/public/browser/browser_context.h" |
| 16 #include "content/public/browser/invalidate_type.h" | 18 #include "content/public/browser/invalidate_type.h" |
| 17 #include "content/public/browser/navigation_controller.h" | 19 #include "content/public/browser/navigation_controller.h" |
| 18 #include "content/public/browser/render_view_host.h" | 20 #include "content/public/browser/render_view_host.h" |
| 19 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 20 #include "content/public/common/url_constants.h" | 22 #include "content/public/common/url_constants.h" |
| 21 | 23 |
| 22 namespace content { | 24 namespace content { |
| 23 | 25 |
| 24 NavigatorImpl::NavigatorImpl( | 26 NavigatorImpl::NavigatorImpl( |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 } | 86 } |
| 85 | 87 |
| 86 if (delegate_) { | 88 if (delegate_) { |
| 87 // Notify the observer about the start of the provisional load. | 89 // Notify the observer about the start of the provisional load. |
| 88 delegate_->DidStartProvisionalLoad( | 90 delegate_->DidStartProvisionalLoad( |
| 89 render_frame_host, frame_id, parent_frame_id, is_main_frame, | 91 render_frame_host, frame_id, parent_frame_id, is_main_frame, |
| 90 validated_url, is_error_page, is_iframe_srcdoc); | 92 validated_url, is_error_page, is_iframe_srcdoc); |
| 91 } | 93 } |
| 92 } | 94 } |
| 93 | 95 |
| 96 | |
| 97 void NavigatorImpl::DidFailProvisionalLoadWithError( | |
| 98 RenderFrameHostImpl* render_frame_host, | |
| 99 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | |
| 100 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | |
| 101 << ", error_code: " << params.error_code | |
| 102 << ", error_description: " << params.error_description | |
| 103 << ", is_main_frame: " << params.is_main_frame | |
| 104 << ", showing_repost_interstitial: " << | |
| 105 params.showing_repost_interstitial | |
| 106 << ", frame_id: " << params.frame_id; | |
| 107 GURL validated_url(params.url); | |
| 108 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); | |
| 109 render_process_host->FilterURL(false, &validated_url); | |
| 110 | |
| 111 if (net::ERR_ABORTED == params.error_code) { | |
| 112 // EVIL HACK ALERT! Ignore failed loads when we're showing interstitials. | |
| 113 // This means that the interstitial won't be torn down properly, which is | |
| 114 // bad. But if we have an interstitial, go back to another tab type, and | |
| 115 // then load the same interstitial again, we could end up getting the first | |
| 116 // interstitial's "failed" message (as a result of the cancel) when we're on | |
| 117 // the second one. | |
| 118 // | |
| 119 // We can't tell this apart, so we think we're tearing down the current page | |
|
Charlie Reis
2014/01/06 19:07:17
Please keep the first sentence (and put it at the
nasko
2014/01/06 19:16:31
Done.
| |
| 120 // which will cause a crash later one. There is also some code in | |
| 121 // RenderFrameHostManager::RendererAbortedProvisionalLoad that is commented | |
|
Charlie Reis
2014/01/06 18:13:35
We can remove this mention of RFHM::RendererAborte
nasko
2014/01/06 18:47:03
Done.
| |
| 122 // out because of this problem. | |
| 123 // | |
| 124 // http://code.google.com/p/chromium/issues/detail?id=2855 | |
| 125 // Because this will not tear down the interstitial properly, if "back" is | |
| 126 // back to another tab type, the interstitial will still be somewhat alive | |
| 127 // in the previous tab type. If you navigate somewhere that activates the | |
| 128 // tab with the interstitial again, you'll see a flash before the new load | |
| 129 // commits of the interstitial page. | |
| 130 RenderFrameHostManager* root_rfhm = render_frame_host->frame_tree_node() | |
|
Charlie Reis
2014/01/06 18:13:35
Nit: I wonder if there's a better way to format th
nasko
2014/01/06 18:47:03
Done.
| |
| 131 ->frame_tree() | |
| 132 ->root() | |
| 133 ->render_manager(); | |
| 134 if (root_rfhm->interstitial_page() != NULL) { | |
| 135 LOG(WARNING) << "Discarding message during interstitial."; | |
| 136 return; | |
| 137 } | |
|
Charlie Reis
2014/01/06 18:13:35
Let's put the useful part of the RFHM::RendererAbo
nasko
2014/01/06 18:47:03
Done.
| |
| 138 } | |
| 139 | |
| 140 // Do not usually clear the pending entry if one exists, so that the user's | |
| 141 // typed URL is not lost when a navigation fails or is aborted. However, in | |
| 142 // cases that we don't show the pending entry (e.g., renderer-initiated | |
| 143 // navigations in an existing tab), we don't keep it around. That prevents | |
| 144 // spoofs on in-page navigations that don't go through | |
| 145 // DidStartProvisionalLoadForFrame. | |
| 146 // In general, we allow the view to clear the pending entry and typed URL if | |
| 147 // the user requests (e.g., hitting Escape with focus in the address bar). | |
| 148 // Note: don't touch the transient entry, since an interstitial may exist. | |
| 149 if (controller_->GetPendingEntry() != controller_->GetVisibleEntry()) | |
| 150 controller_->DiscardPendingEntry(); | |
| 151 | |
| 152 delegate_->DidFailProvisionalLoadWithError(render_frame_host, params); | |
| 153 } | |
| 154 | |
| 94 } // namespace content | 155 } // namespace content |
| OLD | NEW |