OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |