OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/site_instance_impl.h" | 5 #include "content/browser/site_instance_impl.h" |
6 | 6 |
7 #include "content/browser/browsing_instance.h" | 7 #include "content/browser/browsing_instance.h" |
8 #include "content/browser/child_process_security_policy_impl.h" | 8 #include "content/browser/child_process_security_policy_impl.h" |
9 #include "content/browser/frame_host/debug_urls.h" | 9 #include "content/browser/frame_host/debug_urls.h" |
10 #include "content/browser/frame_host/frame_tree_node.h" | 10 #include "content/browser/frame_host/frame_tree_node.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 // Some special URLs will match the site instance of any other URL. This is | 309 // Some special URLs will match the site instance of any other URL. This is |
310 // done before checking both of them for validity, since we want these URLs | 310 // done before checking both of them for validity, since we want these URLs |
311 // to have the same site instance as even an invalid one. | 311 // to have the same site instance as even an invalid one. |
312 if (IsRendererDebugURL(src_url) || IsRendererDebugURL(dest_url)) | 312 if (IsRendererDebugURL(src_url) || IsRendererDebugURL(dest_url)) |
313 return true; | 313 return true; |
314 | 314 |
315 // If either URL is invalid, they aren't part of the same site. | 315 // If either URL is invalid, they aren't part of the same site. |
316 if (!src_url.is_valid() || !dest_url.is_valid()) | 316 if (!src_url.is_valid() || !dest_url.is_valid()) |
317 return false; | 317 return false; |
318 | 318 |
319 // If the destination url is just a blank page, we treat them as part of the | 319 // If the destination url is just about:blank or about:srcdoc, we treat them |
320 // same site. | 320 // as part of the same site. |
321 GURL blank_page(url::kAboutBlankURL); | 321 if (dest_url == url::kAboutBlankURL || dest_url == content::kAboutSrcDocURL) |
Charlie Reis
2016/11/22 01:01:20
Let's leave this out. As I mentioned in a previou
arthursonzogni
2016/11/22 16:43:27
I add a test in a separate CL:
https://codereview.
| |
322 if (dest_url == blank_page) | |
323 return true; | 322 return true; |
324 | 323 |
325 // If the schemes differ, they aren't part of the same site. | 324 // If the schemes differ, they aren't part of the same site. |
326 if (src_url.scheme() != dest_url.scheme()) | 325 if (src_url.scheme() != dest_url.scheme()) |
327 return false; | 326 return false; |
328 | 327 |
329 return net::registry_controlled_domains::SameDomainOrHost( | 328 return net::registry_controlled_domains::SameDomainOrHost( |
330 src_url, | 329 src_url, |
331 dest_url, | 330 dest_url, |
332 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); | 331 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
440 browsing_instance_->browser_context(), site_)) | 439 browsing_instance_->browser_context(), site_)) |
441 return; | 440 return; |
442 | 441 |
443 ChildProcessSecurityPolicyImpl* policy = | 442 ChildProcessSecurityPolicyImpl* policy = |
444 ChildProcessSecurityPolicyImpl::GetInstance(); | 443 ChildProcessSecurityPolicyImpl::GetInstance(); |
445 policy->LockToOrigin(process_->GetID(), site_); | 444 policy->LockToOrigin(process_->GetID(), site_); |
446 } | 445 } |
447 } | 446 } |
448 | 447 |
449 } // namespace content | 448 } // namespace content |
OLD | NEW |