Chromium Code Reviews| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 845 EXPECT_FALSE(extension_origin.IsSameOriginWith( | 845 EXPECT_FALSE(extension_origin.IsSameOriginWith( |
| 846 popup->GetMainFrame()->GetLastCommittedOrigin())); | 846 popup->GetMainFrame()->GetLastCommittedOrigin())); |
| 847 EXPECT_NE("foo", GetTextContent(popup->GetMainFrame())); | 847 EXPECT_NE("foo", GetTextContent(popup->GetMainFrame())); |
| 848 | 848 |
| 849 EXPECT_EQ(IfExtensionsIsolated(1, 0), | 849 EXPECT_EQ(IfExtensionsIsolated(1, 0), |
| 850 pm->GetRenderFrameHostsForExtension(extension->id()).size()); | 850 pm->GetRenderFrameHostsForExtension(extension->id()).size()); |
| 851 EXPECT_EQ(IfExtensionsIsolated(1, 0), pm->GetAllFrames().size()); | 851 EXPECT_EQ(IfExtensionsIsolated(1, 0), pm->GetAllFrames().size()); |
| 852 } | 852 } |
| 853 | 853 |
| 854 // Navigate second subframe to each nested URL from the main frame (i.e., | 854 // Navigate second subframe to each nested URL from the main frame (i.e., |
| 855 // from non-extension process). This should be blocked in | 855 // from non-extension process). These should be canceled. |
| 856 // --isolate-extensions, but allowed without --isolate-extensions due to | |
| 857 // unblessed extension frames. | |
| 858 // | |
| 859 // TODO(alexmos): This is also temporarily allowed under PlzNavigate, because | |
| 860 // currently this particular blocking happens in | |
| 861 // ChromeContentBrowserClientExtensionsPart::ShouldAllowOpenURL, which isn't | |
| 862 // triggered below under PlzNavigate (since there'll be no transfer). Once | |
| 863 // the blob/filesystem URL checks in ExtensionNavigationThrottle are updated | |
| 864 // to apply to all frames and not just main frames, the PlzNavigate exception | |
| 865 // below can be removed. See https://crbug.com/661324. | |
| 866 for (size_t i = 0; i < arraysize(nested_urls); i++) { | 856 for (size_t i = 0; i < arraysize(nested_urls); i++) { |
| 867 EXPECT_TRUE(content::NavigateIframeToURL(tab, "frame2", nested_urls[i])); | 857 EXPECT_TRUE(content::NavigateIframeToURL(tab, "frame2", nested_urls[i])); |
| 868 content::RenderFrameHost* second_frame = ChildFrameAt(main_frame, 1); | 858 content::RenderFrameHost* second_frame = ChildFrameAt(main_frame, 1); |
| 869 if (IsIsolateExtensionsEnabled() && | 859 |
| 870 !content::IsBrowserSideNavigationEnabled()) { | 860 EXPECT_NE(nested_urls[i], second_frame->GetLastCommittedURL()); |
|
nasko
2017/04/27 23:14:06
Nice to see this difference gone! Thanks!
| |
| 871 EXPECT_NE(nested_urls[i], second_frame->GetLastCommittedURL()); | 861 EXPECT_FALSE(extension_origin.IsSameOriginWith( |
| 872 EXPECT_FALSE(extension_origin.IsSameOriginWith( | 862 second_frame->GetLastCommittedOrigin())); |
| 873 second_frame->GetLastCommittedOrigin())); | 863 EXPECT_NE("foo", GetTextContent(second_frame)); |
| 874 EXPECT_NE("foo", GetTextContent(second_frame)); | 864 EXPECT_EQ(IfExtensionsIsolated(1, 0), |
| 875 EXPECT_EQ(IfExtensionsIsolated(1, 0), | 865 pm->GetRenderFrameHostsForExtension(extension->id()).size()); |
| 876 pm->GetRenderFrameHostsForExtension(extension->id()).size()); | 866 EXPECT_EQ(IfExtensionsIsolated(1, 0), pm->GetAllFrames().size()); |
| 877 EXPECT_EQ(IfExtensionsIsolated(1, 0), pm->GetAllFrames().size()); | 867 |
| 878 } else { | |
| 879 EXPECT_EQ(nested_urls[i], second_frame->GetLastCommittedURL()); | |
| 880 EXPECT_EQ(extension_origin, second_frame->GetLastCommittedOrigin()); | |
| 881 EXPECT_EQ("foo", GetTextContent(second_frame)); | |
| 882 EXPECT_EQ(IfExtensionsIsolated(2, 0), | |
| 883 pm->GetRenderFrameHostsForExtension(extension->id()).size()); | |
| 884 EXPECT_EQ(IfExtensionsIsolated(2, 0), pm->GetAllFrames().size()); | |
| 885 } | |
| 886 EXPECT_TRUE( | 868 EXPECT_TRUE( |
| 887 content::NavigateIframeToURL(tab, "frame2", GURL(url::kAboutBlankURL))); | 869 content::NavigateIframeToURL(tab, "frame2", GURL(url::kAboutBlankURL))); |
| 888 } | 870 } |
| 889 } | 871 } |
| 890 | 872 |
| 891 // Test that navigations to blob: and filesystem: URLs with extension origins | 873 // Test that navigations to blob: and filesystem: URLs with extension origins |
| 892 // are allowed when initiated from extension processes. See | 874 // are allowed when initiated from extension processes. See |
| 893 // https://crbug.com/645028 and https://crbug.com/644426. | 875 // https://crbug.com/645028 and https://crbug.com/644426. |
| 894 IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, | 876 IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, |
| 895 NestedURLNavigationsToExtensionAllowed) { | 877 NestedURLNavigationsToExtensionAllowed) { |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1265 GURL b_url(embedded_test_server()->GetURL("b.com", "/empty.html")); | 1247 GURL b_url(embedded_test_server()->GetURL("b.com", "/empty.html")); |
| 1266 EXPECT_TRUE(content::NavigateIframeToURL(tab, "frame0", b_url)); | 1248 EXPECT_TRUE(content::NavigateIframeToURL(tab, "frame0", b_url)); |
| 1267 { | 1249 { |
| 1268 content::RenderFrameHost* subframe = ChildFrameAt(main_frame, 0); | 1250 content::RenderFrameHost* subframe = ChildFrameAt(main_frame, 0); |
| 1269 EXPECT_EQ(subframe->GetProcess(), main_frame->GetProcess()); | 1251 EXPECT_EQ(subframe->GetProcess(), main_frame->GetProcess()); |
| 1270 EXPECT_EQ(subframe->GetSiteInstance(), main_frame->GetSiteInstance()); | 1252 EXPECT_EQ(subframe->GetSiteInstance(), main_frame->GetSiteInstance()); |
| 1271 } | 1253 } |
| 1272 } | 1254 } |
| 1273 | 1255 |
| 1274 } // namespace extensions | 1256 } // namespace extensions |
| OLD | NEW |