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 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 EXPECT_NE(nested_urls[i], popup->GetLastCommittedURL()); | 832 EXPECT_NE(nested_urls[i], popup->GetLastCommittedURL()); |
833 EXPECT_FALSE(extension_origin.IsSameOriginWith( | 833 EXPECT_FALSE(extension_origin.IsSameOriginWith( |
834 popup->GetMainFrame()->GetLastCommittedOrigin())); | 834 popup->GetMainFrame()->GetLastCommittedOrigin())); |
835 EXPECT_NE("foo", GetTextContent(popup->GetMainFrame())); | 835 EXPECT_NE("foo", GetTextContent(popup->GetMainFrame())); |
836 | 836 |
837 EXPECT_EQ(1u, pm->GetRenderFrameHostsForExtension(extension->id()).size()); | 837 EXPECT_EQ(1u, pm->GetRenderFrameHostsForExtension(extension->id()).size()); |
838 EXPECT_EQ(1u, pm->GetAllFrames().size()); | 838 EXPECT_EQ(1u, pm->GetAllFrames().size()); |
839 } | 839 } |
840 | 840 |
841 // Navigate second subframe to each nested URL from the main frame (i.e., | 841 // Navigate second subframe to each nested URL from the main frame (i.e., |
842 // from non-extension process). This should be blocked. | 842 // from non-extension process). These should be canceled. |
843 // | |
844 // TODO(alexmos): This is also temporarily allowed under PlzNavigate, because | |
845 // currently this particular blocking happens in | |
846 // ChromeContentBrowserClientExtensionsPart::ShouldAllowOpenURL, which isn't | |
847 // triggered below under PlzNavigate (since there'll be no transfer). Once | |
848 // the blob/filesystem URL checks in ExtensionNavigationThrottle are updated | |
849 // to apply to all frames and not just main frames, the PlzNavigate exception | |
850 // below can be removed. See https://crbug.com/661324. | |
851 for (size_t i = 0; i < arraysize(nested_urls); i++) { | 843 for (size_t i = 0; i < arraysize(nested_urls); i++) { |
852 EXPECT_TRUE(content::NavigateIframeToURL(tab, "frame2", nested_urls[i])); | 844 EXPECT_TRUE(content::NavigateIframeToURL(tab, "frame2", nested_urls[i])); |
853 content::RenderFrameHost* second_frame = ChildFrameAt(main_frame, 1); | 845 content::RenderFrameHost* second_frame = ChildFrameAt(main_frame, 1); |
854 if (!content::IsBrowserSideNavigationEnabled()) { | 846 |
855 EXPECT_NE(nested_urls[i], second_frame->GetLastCommittedURL()); | 847 EXPECT_NE(nested_urls[i], second_frame->GetLastCommittedURL()); |
856 EXPECT_FALSE(extension_origin.IsSameOriginWith( | 848 EXPECT_FALSE(extension_origin.IsSameOriginWith( |
857 second_frame->GetLastCommittedOrigin())); | 849 second_frame->GetLastCommittedOrigin())); |
858 EXPECT_NE("foo", GetTextContent(second_frame)); | 850 EXPECT_NE("foo", GetTextContent(second_frame)); |
859 EXPECT_EQ(1u, | 851 EXPECT_EQ(1u, pm->GetRenderFrameHostsForExtension(extension->id()).size()); |
860 pm->GetRenderFrameHostsForExtension(extension->id()).size()); | 852 EXPECT_EQ(1u, pm->GetAllFrames().size()); |
861 EXPECT_EQ(1u, pm->GetAllFrames().size()); | 853 |
862 } else { | |
863 EXPECT_EQ(nested_urls[i], second_frame->GetLastCommittedURL()); | |
864 EXPECT_EQ(extension_origin, second_frame->GetLastCommittedOrigin()); | |
865 EXPECT_EQ("foo", GetTextContent(second_frame)); | |
866 EXPECT_EQ(2u, | |
867 pm->GetRenderFrameHostsForExtension(extension->id()).size()); | |
868 EXPECT_EQ(2u, pm->GetAllFrames().size()); | |
869 } | |
870 EXPECT_TRUE( | 854 EXPECT_TRUE( |
871 content::NavigateIframeToURL(tab, "frame2", GURL(url::kAboutBlankURL))); | 855 content::NavigateIframeToURL(tab, "frame2", GURL(url::kAboutBlankURL))); |
872 } | 856 } |
873 } | 857 } |
874 | 858 |
875 // Test that navigations to blob: and filesystem: URLs with extension origins | 859 // Test that navigations to blob: and filesystem: URLs with extension origins |
876 // are allowed when initiated from extension processes. See | 860 // are allowed when initiated from extension processes. See |
877 // https://crbug.com/645028 and https://crbug.com/644426. | 861 // https://crbug.com/645028 and https://crbug.com/644426. |
878 IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, | 862 IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, |
879 NestedURLNavigationsToExtensionAllowed) { | 863 NestedURLNavigationsToExtensionAllowed) { |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 GURL b_url(embedded_test_server()->GetURL("b.com", "/empty.html")); | 1227 GURL b_url(embedded_test_server()->GetURL("b.com", "/empty.html")); |
1244 EXPECT_TRUE(content::NavigateIframeToURL(tab, "frame0", b_url)); | 1228 EXPECT_TRUE(content::NavigateIframeToURL(tab, "frame0", b_url)); |
1245 { | 1229 { |
1246 content::RenderFrameHost* subframe = ChildFrameAt(main_frame, 0); | 1230 content::RenderFrameHost* subframe = ChildFrameAt(main_frame, 0); |
1247 EXPECT_EQ(subframe->GetProcess(), main_frame->GetProcess()); | 1231 EXPECT_EQ(subframe->GetProcess(), main_frame->GetProcess()); |
1248 EXPECT_EQ(subframe->GetSiteInstance(), main_frame->GetSiteInstance()); | 1232 EXPECT_EQ(subframe->GetSiteInstance(), main_frame->GetSiteInstance()); |
1249 } | 1233 } |
1250 } | 1234 } |
1251 | 1235 |
1252 } // namespace extensions | 1236 } // namespace extensions |
OLD | NEW |