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

Unified Diff: content/browser/frame_host/frame_tree_node.cc

Issue 1957783002: Replicate Content-Security-Policy into remote frame proxies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing CSP inheritance for srcdoc. Created 4 years, 7 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/frame_host/frame_tree_node.cc
diff --git a/content/browser/frame_host/frame_tree_node.cc b/content/browser/frame_host/frame_tree_node.cc
index 73ef0c3d9d084f6d63db8fff506099ec1fc61bac..109ab457edb42cac68ae0fc60dda84060788e788 100644
--- a/content/browser/frame_host/frame_tree_node.cc
+++ b/content/browser/frame_host/frame_tree_node.cc
@@ -245,6 +245,26 @@ void FrameTreeNode::SetFrameName(const std::string& name,
replication_state_.unique_name = unique_name;
}
+void FrameTreeNode::AddContentSecurityPolicy(
+ const ContentSecurityPolicyHeader& header) {
+ // Deduplicate the headers (Blink can send a notification about the same
+ // header multiple times, as ContentSecurityPolicy object is copied around).
Łukasz Anforowicz 2016/05/13 23:31:44 I tried to look into why Blink processes the same
alexmos 2016/05/16 16:17:03 Seems like at least two of the copies are plausibl
Łukasz Anforowicz 2016/05/16 19:44:45 Thanks for the suggestion - it worked out really w
alexmos 2016/05/16 22:31:55 Thanks -- yes, sending them right after dispatchin
+ for (const auto& other : replication_state_.accumulated_csp_headers) {
+ if (header.header_value == other.header_value &&
+ header.source == other.source && header.type == other.type)
+ return;
+ }
+
+ // Append the newly discovered CSP header and notify render frame proxies.
+ replication_state_.accumulated_csp_headers.push_back(header);
+ render_manager_.OnDidAddContentSecurityPolicy(header);
+}
+
+void FrameTreeNode::ResetContentSecurityPolicy() {
+ replication_state_.accumulated_csp_headers.clear();
+ render_manager_.OnDidResetContentSecurityPolicy();
+}
+
void FrameTreeNode::SetEnforceStrictMixedContentChecking(bool should_enforce) {
if (should_enforce ==
replication_state_.should_enforce_strict_mixed_content_checking) {

Powered by Google App Engine
This is Rietveld 408576698