Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1370)

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 2022083002: Move 'frame-src' CSP checks into FrameFetchContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: redirects Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 b4f99d79f2d774d1f42ab4084900273d4207f416..0998c111621763e7c434526dd569757c5c9cbd45 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -76,6 +76,8 @@ namespace content {
namespace {
+const GURL kBlockedURL("data:,");
+
// Helper function to send a postMessage and wait for a reply message. The
// |post_message_script| is executed on the |sender_ftn| frame, and the sender
// frame is expected to post |reply_status| from the DOMAutomationController
@@ -6162,10 +6164,10 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest,
ASSERT_EQ(1U, root->child_count());
FrameTreeNode* mixed_child = root->child_at(0)->child_at(0);
ASSERT_TRUE(mixed_child);
- // The child iframe attempted to create a mixed iframe; this should
- // have been blocked, so the mixed iframe should not have committed a
- // load.
- EXPECT_FALSE(mixed_child->has_committed_real_load());
+ // The child iframe attempted to create a mixed iframe; this will commit
+ // a load to 'data:,' (so that it ends up in a unique origin).
+ EXPECT_TRUE(mixed_child->has_committed_real_load());
+ EXPECT_EQ(kBlockedURL, mixed_child->current_url());
}
// Test that subresources with certificate errors that are redundant
@@ -6379,15 +6381,14 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
load_observer.Wait();
}
- // The blocked frame should stay at the old location.
- EXPECT_EQ(old_subframe_url, root->child_at(0)->current_url());
+ // The blocked frame should commit to |kBlockedURL|
+ EXPECT_EQ(kBlockedURL, root->child_at(0)->current_url());
- // The blocked frame should keep the old title.
std::string frame_title;
EXPECT_TRUE(ExecuteScriptAndExtractString(
root->child_at(0)->current_frame_host(),
"domAutomationController.send(document.title)", &frame_title));
- EXPECT_EQ("Title Of Awesomeness", frame_title);
+ EXPECT_EQ("", frame_title);
// Navigate to a URL without CSP.
EXPECT_TRUE(NavigateToURL(
@@ -6456,15 +6457,14 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
load_observer2.Wait();
}
- // The blocked frame should stay at the old location.
- EXPECT_EQ(old_subframe_url, root->child_at(0)->current_url());
+ // The blocked frame should commit to |kBlockedURL|
+ EXPECT_EQ(kBlockedURL, root->child_at(0)->current_url());
- // The blocked frame should keep the old title.
std::string frame_title;
EXPECT_TRUE(ExecuteScriptAndExtractString(
root->child_at(0)->current_frame_host(),
"domAutomationController.send(document.title)", &frame_title));
- EXPECT_EQ("Title Of Awesomeness", frame_title);
+ EXPECT_EQ("", frame_title);
}
// Test that a cross-origin frame's navigation can be blocked by CSP frame-src.
@@ -6527,15 +6527,14 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
load_observer2.Wait();
}
- // The blocked frame should stay at the old location.
- EXPECT_EQ(old_subframe_url, navigating_frame->current_url());
+ // The blocked frame should commit to |kBlockedURL|
Charlie Reis 2016/06/06 20:43:07 nit: Keep the period. (Same above.)
+ EXPECT_EQ(kBlockedURL, navigating_frame->current_url());
- // The blocked frame should keep the old title.
std::string frame_title;
EXPECT_TRUE(ExecuteScriptAndExtractString(
navigating_frame->current_frame_host(),
"domAutomationController.send(document.title)", &frame_title));
- EXPECT_EQ("Title Of Awesomeness", frame_title);
+ EXPECT_EQ("", frame_title);
// Navigate the subframe to a URL without CSP.
NavigateFrameToURL(srcdoc_frame,

Powered by Google App Engine
This is Rietveld 408576698