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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 NavigationController* NavigatorImpl::GetController() { | 139 NavigationController* NavigatorImpl::GetController() { |
140 return controller_; | 140 return controller_; |
141 } | 141 } |
142 | 142 |
143 void NavigatorImpl::DidStartProvisionalLoad( | 143 void NavigatorImpl::DidStartProvisionalLoad( |
144 RenderFrameHostImpl* render_frame_host, | 144 RenderFrameHostImpl* render_frame_host, |
145 const GURL& url, | 145 const GURL& url, |
146 const base::TimeTicks& navigation_start) { | 146 const base::TimeTicks& navigation_start) { |
147 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); | 147 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); |
148 bool is_error_page = (url.spec() == kUnreachableWebDataURL); | 148 bool is_error_page = (url.spec() == kUnreachableWebDataURL); |
149 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL); | |
150 GURL validated_url(url); | 149 GURL validated_url(url); |
151 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); | 150 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); |
152 render_process_host->FilterURL(false, &validated_url); | 151 if (validated_url != GURL(content::kAboutSrcDocURL)) |
nasko
2016/11/10 18:14:14
This doesn't strike me as a good practice. We don'
Charlie Reis
2016/11/11 22:53:24
Agreed.
arthursonzogni
2016/11/15 16:37:09
I agree, but do you think it is careful to modify
Charlie Reis
2016/11/16 18:20:22
Yes, I think it's fine to allow about:srcdoc throu
| |
152 render_process_host->FilterURL(false, &validated_url); | |
153 | 153 |
154 // Do not allow browser plugin guests to navigate to non-web URLs, since they | 154 // Do not allow browser plugin guests to navigate to non-web URLs, since they |
155 // cannot swap processes or grant bindings. | 155 // cannot swap processes or grant bindings. |
156 ChildProcessSecurityPolicyImpl* policy = | 156 ChildProcessSecurityPolicyImpl* policy = |
157 ChildProcessSecurityPolicyImpl::GetInstance(); | 157 ChildProcessSecurityPolicyImpl::GetInstance(); |
158 if (render_process_host->IsForGuestsOnly() && | 158 if (render_process_host->IsForGuestsOnly() && |
159 !policy->IsWebSafeScheme(validated_url.scheme())) { | 159 !policy->IsWebSafeScheme(validated_url.scheme())) { |
160 validated_url = GURL(url::kAboutBlankURL); | 160 validated_url = GURL(url::kAboutBlankURL); |
161 } | 161 } |
162 | 162 |
163 if (is_main_frame && !is_error_page) { | 163 if (is_main_frame && !is_error_page) { |
164 DidStartMainFrameNavigation(validated_url, | 164 DidStartMainFrameNavigation(validated_url, |
165 render_frame_host->GetSiteInstance(), | 165 render_frame_host->GetSiteInstance(), |
166 render_frame_host->navigation_handle()); | 166 render_frame_host->navigation_handle()); |
167 } | 167 } |
168 | 168 |
169 if (delegate_) { | 169 if (delegate_) { |
170 // Notify the observer about the start of the provisional load. | 170 // Notify the observer about the start of the provisional load. |
171 delegate_->DidStartProvisionalLoad(render_frame_host, validated_url, | 171 delegate_->DidStartProvisionalLoad(render_frame_host, validated_url, |
172 is_error_page, is_iframe_srcdoc); | 172 is_error_page); |
173 } | 173 } |
174 | 174 |
175 if (is_error_page || IsBrowserSideNavigationEnabled()) | 175 if (is_error_page || IsBrowserSideNavigationEnabled()) |
176 return; | 176 return; |
177 | 177 |
178 if (render_frame_host->navigation_handle()) { | 178 if (render_frame_host->navigation_handle()) { |
179 if (render_frame_host->navigation_handle()->is_transferring()) { | 179 if (render_frame_host->navigation_handle()->is_transferring()) { |
180 // If the navigation is completing a transfer, this | 180 // If the navigation is completing a transfer, this |
181 // DidStartProvisionalLoad should not correspond to a new navigation. | 181 // DidStartProvisionalLoad should not correspond to a new navigation. |
182 DCHECK_EQ(url, render_frame_host->navigation_handle()->GetURL()); | 182 DCHECK_EQ(url, render_frame_host->navigation_handle()->GetURL()); |
(...skipping 18 matching lines...) Expand all Loading... | |
201 if (pending_entry) { | 201 if (pending_entry) { |
202 is_renderer_initiated = pending_entry->is_renderer_initiated(); | 202 is_renderer_initiated = pending_entry->is_renderer_initiated(); |
203 pending_nav_entry_id = pending_entry->GetUniqueID(); | 203 pending_nav_entry_id = pending_entry->GetUniqueID(); |
204 started_from_context_menu = pending_entry->has_started_from_context_menu(); | 204 started_from_context_menu = pending_entry->has_started_from_context_menu(); |
205 } | 205 } |
206 | 206 |
207 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( | 207 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( |
208 validated_url, render_frame_host->frame_tree_node(), | 208 validated_url, render_frame_host->frame_tree_node(), |
209 is_renderer_initiated, | 209 is_renderer_initiated, |
210 false, // is_same_page | 210 false, // is_same_page |
211 is_iframe_srcdoc, // is_srcdoc | |
212 navigation_start, pending_nav_entry_id, started_from_context_menu)); | 211 navigation_start, pending_nav_entry_id, started_from_context_menu)); |
213 } | 212 } |
214 | 213 |
215 void NavigatorImpl::DidFailProvisionalLoadWithError( | 214 void NavigatorImpl::DidFailProvisionalLoadWithError( |
216 RenderFrameHostImpl* render_frame_host, | 215 RenderFrameHostImpl* render_frame_host, |
217 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 216 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
218 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 217 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() |
219 << ", error_code: " << params.error_code | 218 << ", error_code: " << params.error_code |
220 << ", error_description: " << params.error_description | 219 << ", error_description: " << params.error_description |
221 << ", showing_repost_interstitial: " << | 220 << ", showing_repost_interstitial: " << |
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1264 if (navigation_handle) | 1263 if (navigation_handle) |
1265 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); | 1264 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); |
1266 | 1265 |
1267 controller_->SetPendingEntry(std::move(entry)); | 1266 controller_->SetPendingEntry(std::move(entry)); |
1268 if (delegate_) | 1267 if (delegate_) |
1269 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1268 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
1270 } | 1269 } |
1271 } | 1270 } |
1272 | 1271 |
1273 } // namespace content | 1272 } // namespace content |
OLD | NEW |