| 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 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1676 for (CSPDirectiveListVector::const_iterator iter = other->m_policies.begin()
; iter != other->m_policies.end(); ++iter) | 1676 for (CSPDirectiveListVector::const_iterator iter = other->m_policies.begin()
; iter != other->m_policies.end(); ++iter) |
| 1677 addPolicyFromHeaderValue((*iter)->header(), (*iter)->headerType(), (*ite
r)->headerSource()); | 1677 addPolicyFromHeaderValue((*iter)->header(), (*iter)->headerType(), (*ite
r)->headerSource()); |
| 1678 } | 1678 } |
| 1679 | 1679 |
| 1680 void ContentSecurityPolicy::didReceiveHeaders(const ContentSecurityPolicyRespons
eHeaders& headers) | 1680 void ContentSecurityPolicy::didReceiveHeaders(const ContentSecurityPolicyRespons
eHeaders& headers) |
| 1681 { | 1681 { |
| 1682 if (!headers.contentSecurityPolicy().isEmpty()) | 1682 if (!headers.contentSecurityPolicy().isEmpty()) |
| 1683 didReceiveHeader(headers.contentSecurityPolicy(), ContentSecurityPolicy:
:Enforce, ContentSecurityPolicy::HeaderSourceHTTP); | 1683 didReceiveHeader(headers.contentSecurityPolicy(), ContentSecurityPolicy:
:Enforce, ContentSecurityPolicy::HeaderSourceHTTP); |
| 1684 if (!headers.contentSecurityPolicyReportOnly().isEmpty()) | 1684 if (!headers.contentSecurityPolicyReportOnly().isEmpty()) |
| 1685 didReceiveHeader(headers.contentSecurityPolicyReportOnly(), ContentSecur
ityPolicy::Report, ContentSecurityPolicy::HeaderSourceHTTP); | 1685 didReceiveHeader(headers.contentSecurityPolicyReportOnly(), ContentSecur
ityPolicy::Report, ContentSecurityPolicy::HeaderSourceHTTP); |
| 1686 | |
| 1687 // FIXME: Remove this reporting (and the 'xWebKitCSP*' methods) after the ne
xt release branch. | |
| 1688 if (m_client->isDocument()) { | |
| 1689 Document* document = static_cast<Document*>(m_client); | |
| 1690 if (!headers.xWebKitCSP().isEmpty()) | |
| 1691 UseCounter::countDeprecation(*document, UseCounter::PrefixedContentS
ecurityPolicy); | |
| 1692 if (!headers.xWebKitCSPReportOnly().isEmpty()) | |
| 1693 UseCounter::countDeprecation(*document, UseCounter::PrefixedContentS
ecurityPolicyReportOnly); | |
| 1694 } | |
| 1695 } | 1686 } |
| 1696 | 1687 |
| 1697 void ContentSecurityPolicy::didReceiveHeader(const String& header, HeaderType ty
pe, HeaderSource source) | 1688 void ContentSecurityPolicy::didReceiveHeader(const String& header, HeaderType ty
pe, HeaderSource source) |
| 1698 { | 1689 { |
| 1699 addPolicyFromHeaderValue(header, type, source); | 1690 addPolicyFromHeaderValue(header, type, source); |
| 1700 } | 1691 } |
| 1701 | 1692 |
| 1702 void ContentSecurityPolicy::addPolicyFromHeaderValue(const String& header, Heade
rType type, HeaderSource source) | 1693 void ContentSecurityPolicy::addPolicyFromHeaderValue(const String& header, Heade
rType type, HeaderSource source) |
| 1703 { | 1694 { |
| 1704 Document* document = 0; | 1695 Document* document = 0; |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2303 // Collisions have no security impact, so we can save space by storing only
the string's hash rather than the whole report. | 2294 // Collisions have no security impact, so we can save space by storing only
the string's hash rather than the whole report. |
| 2304 return !m_violationReportsSent.contains(report.impl()->hash()); | 2295 return !m_violationReportsSent.contains(report.impl()->hash()); |
| 2305 } | 2296 } |
| 2306 | 2297 |
| 2307 void ContentSecurityPolicy::didSendViolationReport(const String& report) | 2298 void ContentSecurityPolicy::didSendViolationReport(const String& report) |
| 2308 { | 2299 { |
| 2309 m_violationReportsSent.add(report.impl()->hash()); | 2300 m_violationReportsSent.add(report.impl()->hash()); |
| 2310 } | 2301 } |
| 2311 | 2302 |
| 2312 } // namespace WebCore | 2303 } // namespace WebCore |
| OLD | NEW |