| Index: content/browser/site_per_process_browsertest.cc
|
| diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
|
| index c91e6b1592c5ed9150be7eb3b562882b55a28d60..e3e4b30b8077229160981332c55d5085480ec0d7 100644
|
| --- a/content/browser/site_per_process_browsertest.cc
|
| +++ b/content/browser/site_per_process_browsertest.cc
|
| @@ -37,6 +37,7 @@
|
| #include "content/public/browser/resource_dispatcher_host.h"
|
| #include "content/public/common/browser_side_navigation_policy.h"
|
| #include "content/public/common/content_switches.h"
|
| +#include "content/public/common/url_constants.h"
|
| #include "content/public/test/browser_test_utils.h"
|
| #include "content/public/test/content_browser_test_utils.h"
|
| #include "content/public/test/test_navigation_observer.h"
|
| @@ -3559,6 +3560,42 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OpenPopupWithRemoteParent) {
|
| EXPECT_TRUE(success);
|
| }
|
|
|
| +// Test that cross-process popups can't be navigated to disallowed URLs by
|
| +// their opener. This ensures that proper URL validation is performed when
|
| +// RenderFrameProxyHosts are navigated. See https://crbug.com/595339.
|
| +IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigatePopupToIllegalURL) {
|
| + GURL main_url(embedded_test_server()->GetURL("a.com", "/title1.html"));
|
| + EXPECT_TRUE(NavigateToURL(shell(), main_url));
|
| +
|
| + // Open a cross-site popup.
|
| + GURL popup_url(embedded_test_server()->GetURL("b.com", "/title2.html"));
|
| + Shell* popup = OpenPopup(shell()->web_contents(), popup_url, "foo");
|
| + EXPECT_TRUE(popup);
|
| + EXPECT_NE(popup->web_contents()->GetSiteInstance(),
|
| + shell()->web_contents()->GetSiteInstance());
|
| +
|
| + // From the opener, navigate the popup to a file:/// URL. This should be
|
| + // disallowed and result in an about:blank navigation.
|
| + GURL file_url("file:///");
|
| + NavigateNamedFrame(shell()->web_contents(), file_url, "foo");
|
| + EXPECT_TRUE(WaitForLoadStop(popup->web_contents()));
|
| + EXPECT_EQ(GURL(url::kAboutBlankURL),
|
| + popup->web_contents()->GetLastCommittedURL());
|
| +
|
| + // Navigate popup back to a cross-site URL.
|
| + EXPECT_TRUE(NavigateToURL(popup, popup_url));
|
| + EXPECT_NE(popup->web_contents()->GetSiteInstance(),
|
| + shell()->web_contents()->GetSiteInstance());
|
| +
|
| + // Now try the same test with a chrome:// URL.
|
| + GURL chrome_url(std::string(kChromeUIScheme) + "://" +
|
| + std::string(kChromeUIGpuHost));
|
| + NavigateNamedFrame(shell()->web_contents(), chrome_url, "foo");
|
| + EXPECT_TRUE(WaitForLoadStop(popup->web_contents()));
|
| + EXPECT_EQ(GURL(url::kAboutBlankURL),
|
| + popup->web_contents()->GetLastCommittedURL());
|
| +}
|
| +
|
| // Verify that named frames are discoverable from their opener's ancestors.
|
| // See https://crbug.com/511474.
|
| IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
|
|