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

Side by Side Diff: Source/core/frame/csp/ContentSecurityPolicy.cpp

Issue 1362813002: CSP source *.x.y should not match host x.y (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Test fixes Created 5 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/csp/ContentSecurityPolicy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google, Inc. All rights reserved. 2 * Copyright (C) 2011 Google, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 216 }
217 217
218 DEFINE_TRACE(ContentSecurityPolicy) 218 DEFINE_TRACE(ContentSecurityPolicy)
219 { 219 {
220 visitor->trace(m_executionContext); 220 visitor->trace(m_executionContext);
221 visitor->trace(m_consoleMessages); 221 visitor->trace(m_consoleMessages);
222 } 222 }
223 223
224 Document* ContentSecurityPolicy::document() const 224 Document* ContentSecurityPolicy::document() const
225 { 225 {
226 return m_executionContext->isDocument() ? toDocument(m_executionContext) : n ullptr; 226 return (m_executionContext && m_executionContext->isDocument()) ? toDocument (m_executionContext) : nullptr;
227 } 227 }
228 228
229 void ContentSecurityPolicy::copyStateFrom(const ContentSecurityPolicy* other) 229 void ContentSecurityPolicy::copyStateFrom(const ContentSecurityPolicy* other)
230 { 230 {
231 ASSERT(m_policies.isEmpty()); 231 ASSERT(m_policies.isEmpty());
232 for (const auto& policy : other->m_policies) 232 for (const auto& policy : other->m_policies)
233 addPolicyFromHeaderValue(policy->header(), policy->headerType(), policy- >headerSource()); 233 addPolicyFromHeaderValue(policy->header(), policy->headerType(), policy- >headerSource());
234 } 234 }
235 235
236 void ContentSecurityPolicy::copyPluginTypesFrom(const ContentSecurityPolicy* oth er) 236 void ContentSecurityPolicy::copyPluginTypesFrom(const ContentSecurityPolicy* oth er)
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 // Collisions have no security impact, so we can save space by storing only the string's hash rather than the whole report. 1024 // Collisions have no security impact, so we can save space by storing only the string's hash rather than the whole report.
1025 return !m_violationReportsSent.contains(report.impl()->hash()); 1025 return !m_violationReportsSent.contains(report.impl()->hash());
1026 } 1026 }
1027 1027
1028 void ContentSecurityPolicy::didSendViolationReport(const String& report) 1028 void ContentSecurityPolicy::didSendViolationReport(const String& report)
1029 { 1029 {
1030 m_violationReportsSent.add(report.impl()->hash()); 1030 m_violationReportsSent.add(report.impl()->hash());
1031 } 1031 }
1032 1032
1033 } // namespace blink 1033 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/csp/ContentSecurityPolicy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698