| 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 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 void ContentSecurityPolicy::reportBlockedScriptExecutionToInspector(const String
& directiveText) const | 893 void ContentSecurityPolicy::reportBlockedScriptExecutionToInspector(const String
& directiveText) const |
| 894 { | 894 { |
| 895 m_executionContext->reportBlockedScriptExecutionToInspector(directiveText); | 895 m_executionContext->reportBlockedScriptExecutionToInspector(directiveText); |
| 896 } | 896 } |
| 897 | 897 |
| 898 bool ContentSecurityPolicy::experimentalFeaturesEnabled() const | 898 bool ContentSecurityPolicy::experimentalFeaturesEnabled() const |
| 899 { | 899 { |
| 900 return RuntimeEnabledFeatures::experimentalContentSecurityPolicyFeaturesEnab
led(); | 900 return RuntimeEnabledFeatures::experimentalContentSecurityPolicyFeaturesEnab
led(); |
| 901 } | 901 } |
| 902 | 902 |
| 903 bool ContentSecurityPolicy::shouldSendCSPHeader(Resource::Type type) const |
| 904 { |
| 905 for (const auto& policy : m_policies) { |
| 906 if (policy->shouldSendCSPHeader(type)) |
| 907 return true; |
| 908 } |
| 909 return false; |
| 910 } |
| 911 |
| 903 bool ContentSecurityPolicy::urlMatchesSelf(const KURL& url) const | 912 bool ContentSecurityPolicy::urlMatchesSelf(const KURL& url) const |
| 904 { | 913 { |
| 905 return m_selfSource->matches(url, DidNotRedirect); | 914 return m_selfSource->matches(url, DidNotRedirect); |
| 906 } | 915 } |
| 907 | 916 |
| 908 bool ContentSecurityPolicy::protocolMatchesSelf(const KURL& url) const | 917 bool ContentSecurityPolicy::protocolMatchesSelf(const KURL& url) const |
| 909 { | 918 { |
| 910 if (equalIgnoringCase("http", m_selfProtocol)) | 919 if (equalIgnoringCase("http", m_selfProtocol)) |
| 911 return url.protocolIsInHTTPFamily(); | 920 return url.protocolIsInHTTPFamily(); |
| 912 return equalIgnoringCase(url.protocol(), m_selfProtocol); | 921 return equalIgnoringCase(url.protocol(), m_selfProtocol); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 927 // Collisions have no security impact, so we can save space by storing only
the string's hash rather than the whole report. | 936 // Collisions have no security impact, so we can save space by storing only
the string's hash rather than the whole report. |
| 928 return !m_violationReportsSent.contains(report.impl()->hash()); | 937 return !m_violationReportsSent.contains(report.impl()->hash()); |
| 929 } | 938 } |
| 930 | 939 |
| 931 void ContentSecurityPolicy::didSendViolationReport(const String& report) | 940 void ContentSecurityPolicy::didSendViolationReport(const String& report) |
| 932 { | 941 { |
| 933 m_violationReportsSent.add(report.impl()->hash()); | 942 m_violationReportsSent.add(report.impl()->hash()); |
| 934 } | 943 } |
| 935 | 944 |
| 936 } // namespace blink | 945 } // namespace blink |
| OLD | NEW |