| 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/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 // chrome://crash, however. | 1392 // chrome://crash, however. |
| 1393 // TODO(creis): Refactor this method so this duplicated code isn't needed. | 1393 // TODO(creis): Refactor this method so this duplicated code isn't needed. |
| 1394 // See http://crbug.com/123007. | 1394 // See http://crbug.com/123007. |
| 1395 if (current_entry && | 1395 if (current_entry && |
| 1396 current_entry->IsViewSourceMode() != dest_is_view_source_mode && | 1396 current_entry->IsViewSourceMode() != dest_is_view_source_mode && |
| 1397 !IsRendererDebugURL(dest_url)) { | 1397 !IsRendererDebugURL(dest_url)) { |
| 1398 return SiteInstanceDescriptor(browser_context, dest_url, | 1398 return SiteInstanceDescriptor(browser_context, dest_url, |
| 1399 SiteInstanceRelation::UNRELATED); | 1399 SiteInstanceRelation::UNRELATED); |
| 1400 } | 1400 } |
| 1401 | 1401 |
| 1402 // Use the source SiteInstance in case of data URLs or about:blank pages, | 1402 if (source_instance) { |
| 1403 // because the content is then controlled and/or scriptable by the source | 1403 // Use the source SiteInstance in case of data URLs or about:blank pages, |
| 1404 // SiteInstance. | 1404 // because the content is then controlled and/or scriptable by the source |
| 1405 GURL about_blank(url::kAboutBlankURL); | 1405 // SiteInstance. |
| 1406 if (source_instance && | 1406 GURL about_blank(url::kAboutBlankURL); |
| 1407 (dest_url == about_blank || dest_url.scheme() == url::kDataScheme)) { | 1407 if (dest_url == about_blank || dest_url.SchemeIs(url::kDataScheme)) |
| 1408 return SiteInstanceDescriptor(source_instance); | 1408 return SiteInstanceDescriptor(source_instance); |
| 1409 // Process transfers for filesystem and blob URLs work similarly: |
| 1410 // Although these URLs have origins, they are disallowed in |
| 1411 // cross-origin contexts. So the only site instance swap we |
| 1412 // allow is to |source_instance|. |
| 1413 if (dest_url.SchemeIsBlob() || dest_url.SchemeIsFileSystem()) { |
| 1414 // TODO(nick): do we need to check for origin safety? Are we downstream |
| 1415 // of existing enforcement or what? |
| 1416 return SiteInstanceDescriptor(source_instance); |
| 1417 } |
| 1409 } | 1418 } |
| 1410 | 1419 |
| 1411 // Use the current SiteInstance for same site navigations. | 1420 // Use the current SiteInstance for same site navigations. |
| 1412 if (IsCurrentlySameSite(render_frame_host_.get(), dest_url)) | 1421 if (IsCurrentlySameSite(render_frame_host_.get(), dest_url)) |
| 1413 return SiteInstanceDescriptor(render_frame_host_->GetSiteInstance()); | 1422 return SiteInstanceDescriptor(render_frame_host_->GetSiteInstance()); |
| 1414 | 1423 |
| 1415 if (SiteIsolationPolicy::IsTopDocumentIsolationEnabled()) { | 1424 if (SiteIsolationPolicy::IsTopDocumentIsolationEnabled()) { |
| 1416 // TODO(nick): Looking at the main frame and openers is required for TDI | 1425 // TODO(nick): Looking at the main frame and openers is required for TDI |
| 1417 // mode, but should be safe to enable unconditionally. | 1426 // mode, but should be safe to enable unconditionally. |
| 1418 if (!frame_tree_node_->IsMainFrame()) { | 1427 if (!frame_tree_node_->IsMainFrame()) { |
| (...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2717 resolved_url)) { | 2726 resolved_url)) { |
| 2718 DCHECK(!dest_instance || | 2727 DCHECK(!dest_instance || |
| 2719 dest_instance == render_frame_host_->GetSiteInstance()); | 2728 dest_instance == render_frame_host_->GetSiteInstance()); |
| 2720 return false; | 2729 return false; |
| 2721 } | 2730 } |
| 2722 | 2731 |
| 2723 return true; | 2732 return true; |
| 2724 } | 2733 } |
| 2725 | 2734 |
| 2726 } // namespace content | 2735 } // namespace content |
| OLD | NEW |