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/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 4132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4143 // This is fine normally, except if we're showing UI from one security | 4143 // This is fine normally, except if we're showing UI from one security |
4144 // context and they're trying to navigate to a different context. | 4144 // context and they're trying to navigate to a different context. |
4145 const GURL& url = info.urlRequest.url(); | 4145 const GURL& url = info.urlRequest.url(); |
4146 | 4146 |
4147 // A content initiated navigation may have originated from a link-click, | 4147 // A content initiated navigation may have originated from a link-click, |
4148 // script, drag-n-drop operation, etc. | 4148 // script, drag-n-drop operation, etc. |
4149 DocumentState* document_state = static_cast<DocumentState*>(info.extraData); | 4149 DocumentState* document_state = static_cast<DocumentState*>(info.extraData); |
4150 bool is_content_initiated = | 4150 bool is_content_initiated = |
4151 document_state->navigation_state()->IsContentInitiated(); | 4151 document_state->navigation_state()->IsContentInitiated(); |
4152 | 4152 |
4153 // Experimental: | |
4154 // If --enable-strict-site-isolation is enabled, send all top-level | |
4155 // navigations to the browser to let it swap processes when crossing site | |
4156 // boundaries. This is currently expected to break some script calls and | |
4157 // navigations, such as form submissions. | |
4158 bool force_swap_due_to_flag = | |
4159 command_line.HasSwitch(switches::kEnableStrictSiteIsolation); | |
4160 if (force_swap_due_to_flag && | |
4161 !info.frame->parent() && (is_content_initiated || info.isRedirect)) { | |
4162 WebString origin_str = info.frame->document().securityOrigin().toString(); | |
4163 GURL frame_url(origin_str.utf8().data()); | |
4164 // TODO(cevans): revisit whether this site check is still necessary once | |
4165 // crbug.com/101395 is fixed. | |
4166 bool same_domain_or_host = | |
4167 net::registry_controlled_domains::SameDomainOrHost( | |
4168 frame_url, | |
4169 url, | |
4170 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); | |
4171 // Only keep same-site (domain + scheme) and data URLs in the same process. | |
4172 bool is_same_site = | |
4173 (same_domain_or_host && frame_url.scheme() == url.scheme()) || | |
4174 url.SchemeIs(url::kDataScheme); | |
4175 if (!is_same_site) { | |
4176 OpenURL(info.frame, url, referrer, info.defaultPolicy); | |
4177 return blink::WebNavigationPolicyIgnore; | |
4178 } | |
4179 } | |
4180 | |
4181 // If the browser is interested, then give it a chance to look at the request. | 4153 // If the browser is interested, then give it a chance to look at the request. |
4182 if (is_content_initiated) { | 4154 if (is_content_initiated) { |
4183 bool is_form_post = | 4155 bool is_form_post = |
4184 ((info.navigationType == blink::WebNavigationTypeFormSubmitted) || | 4156 ((info.navigationType == blink::WebNavigationTypeFormSubmitted) || |
4185 (info.navigationType == blink::WebNavigationTypeFormResubmitted)) && | 4157 (info.navigationType == blink::WebNavigationTypeFormResubmitted)) && |
4186 EqualsASCII(info.urlRequest.httpMethod(), "POST"); | 4158 EqualsASCII(info.urlRequest.httpMethod(), "POST"); |
4187 bool browser_handles_request = | 4159 bool browser_handles_request = |
4188 render_view_->renderer_preferences_ | 4160 render_view_->renderer_preferences_ |
4189 .browser_handles_non_local_top_level_requests | 4161 .browser_handles_non_local_top_level_requests |
4190 && IsNonLocalTopLevelNavigation(url, info.frame, info.navigationType, | 4162 && IsNonLocalTopLevelNavigation(url, info.frame, info.navigationType, |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4913 #elif defined(ENABLE_BROWSER_CDMS) | 4885 #elif defined(ENABLE_BROWSER_CDMS) |
4914 cdm_manager_, | 4886 cdm_manager_, |
4915 #endif | 4887 #endif |
4916 this); | 4888 this); |
4917 } | 4889 } |
4918 | 4890 |
4919 return cdm_factory_; | 4891 return cdm_factory_; |
4920 } | 4892 } |
4921 | 4893 |
4922 } // namespace content | 4894 } // namespace content |
OLD | NEW |