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

Unified Diff: third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp

Issue 2764993002: CSP: group policies in didAddContentSecurityPolicy. (Closed)
Patch Set: Group the IPC instead of splitting them. (browser -> renderer) Created 3 years, 9 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: third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
index d2969188c519c1d01d8e902d268bb0e5d0797045..b9f6f100a246149304c9246a099eb8709352d8d6 100644
--- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
@@ -324,11 +324,10 @@ void ContentSecurityPolicy::reportAccumulatedHeaders(
// navigation got committed. See comments in
// addAndReportPolicyFromHeaderValue for more details and context.
DCHECK(client);
- for (const auto& policy : m_policies) {
- client->didAddContentSecurityPolicy(
- policy->header(), policy->headerType(), policy->headerSource(),
- {policy->exposeForNavigationalChecks()});
- }
+ WebVector<WebContentSecurityPolicyPolicy> policies(m_policies.size());
+ for (size_t i = 0; i < m_policies.size(); ++i)
+ policies[i] = m_policies[i]->exposeForNavigationalChecks();
+ client->didAddContentSecurityPolicies(policies);
}
void ContentSecurityPolicy::addAndReportPolicyFromHeaderValue(
@@ -345,15 +344,13 @@ void ContentSecurityPolicy::addAndReportPolicyFromHeaderValue(
// 2) enforce CSP in the browser process (long-term - see
// https://crbug.com/376522).
// TODO(arthursonzogni): policies are actually replicated (1) and some of
- // them are (or will) be enforced on the browser process (2). Stop doing (1)
- // when (2) is finished.
+ // them are enforced on the browser process (2). Stop doing (1) when (2) is
+ // finished.
- // Zero, one or several policies could be produced by only one header.
- std::vector<blink::WebContentSecurityPolicyPolicy> policies;
+ WebVector<WebContentSecurityPolicyPolicy> policies(m_policies.size());
for (size_t i = previousPolicyCount; i < m_policies.size(); ++i)
- policies.push_back(m_policies[i]->exposeForNavigationalChecks());
- document()->frame()->client()->didAddContentSecurityPolicy(
- header, type, source, policies);
+ policies[i] = m_policies[i]->exposeForNavigationalChecks();
+ document()->frame()->client()->didAddContentSecurityPolicies(policies);
}
}

Powered by Google App Engine
This is Rietveld 408576698