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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/browser/browsing_instance.h" | 8 #include "content/browser/browsing_instance.h" |
9 #include "content/browser/child_process_security_policy_impl.h" | 9 #include "content/browser/child_process_security_policy_impl.h" |
10 #include "content/browser/frame_host/debug_urls.h" | 10 #include "content/browser/frame_host/debug_urls.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 // Some special URLs will match the site instance of any other URL. This is | 254 // Some special URLs will match the site instance of any other URL. This is |
255 // done before checking both of them for validity, since we want these URLs | 255 // done before checking both of them for validity, since we want these URLs |
256 // to have the same site instance as even an invalid one. | 256 // to have the same site instance as even an invalid one. |
257 if (IsRendererDebugURL(url1) || IsRendererDebugURL(url2)) | 257 if (IsRendererDebugURL(url1) || IsRendererDebugURL(url2)) |
258 return true; | 258 return true; |
259 | 259 |
260 // If either URL is invalid, they aren't part of the same site. | 260 // If either URL is invalid, they aren't part of the same site. |
261 if (!url1.is_valid() || !url2.is_valid()) | 261 if (!url1.is_valid() || !url2.is_valid()) |
262 return false; | 262 return false; |
263 | 263 |
264 // If either url is just a blank page, we treat them as part of the same site. | |
Charlie Reis
2014/07/25 17:31:22
Ah, we don't actually want this for navigating fro
shatch
2014/07/25 20:57:05
Done.
| |
265 GURL blank_page = GURL(url::kAboutBlankURL); | |
266 if (url1 == blank_page || url2 == blank_page) | |
267 return true; | |
268 | |
264 // If the schemes differ, they aren't part of the same site. | 269 // If the schemes differ, they aren't part of the same site. |
265 if (url1.scheme() != url2.scheme()) | 270 if (url1.scheme() != url2.scheme()) |
266 return false; | 271 return false; |
267 | 272 |
268 return net::registry_controlled_domains::SameDomainOrHost( | 273 return net::registry_controlled_domains::SameDomainOrHost( |
269 url1, | 274 url1, |
270 url2, | 275 url2, |
271 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); | 276 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
272 } | 277 } |
273 | 278 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 337 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
333 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || | 338 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || |
334 command_line.HasSwitch(switches::kSitePerProcess)) { | 339 command_line.HasSwitch(switches::kSitePerProcess)) { |
335 ChildProcessSecurityPolicyImpl* policy = | 340 ChildProcessSecurityPolicyImpl* policy = |
336 ChildProcessSecurityPolicyImpl::GetInstance(); | 341 ChildProcessSecurityPolicyImpl::GetInstance(); |
337 policy->LockToOrigin(process_->GetID(), site_); | 342 policy->LockToOrigin(process_->GetID(), site_); |
338 } | 343 } |
339 } | 344 } |
340 | 345 |
341 } // namespace content | 346 } // namespace content |
OLD | NEW |