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 | |
912 bool ContentSecurityPolicy::urlMatchesSelf(const KURL& url) const | 903 bool ContentSecurityPolicy::urlMatchesSelf(const KURL& url) const |
913 { | 904 { |
914 return m_selfSource->matches(url, DidNotRedirect); | 905 return m_selfSource->matches(url, DidNotRedirect); |
915 } | 906 } |
916 | 907 |
917 bool ContentSecurityPolicy::protocolMatchesSelf(const KURL& url) const | 908 bool ContentSecurityPolicy::protocolMatchesSelf(const KURL& url) const |
918 { | 909 { |
919 if (equalIgnoringCase("http", m_selfProtocol)) | 910 if (equalIgnoringCase("http", m_selfProtocol)) |
920 return url.protocolIsInHTTPFamily(); | 911 return url.protocolIsInHTTPFamily(); |
921 return equalIgnoringCase(url.protocol(), m_selfProtocol); | 912 return equalIgnoringCase(url.protocol(), m_selfProtocol); |
(...skipping 14 matching lines...) Expand all Loading... |
936 // Collisions have no security impact, so we can save space by storing only
the string's hash rather than the whole report. | 927 // Collisions have no security impact, so we can save space by storing only
the string's hash rather than the whole report. |
937 return !m_violationReportsSent.contains(report.impl()->hash()); | 928 return !m_violationReportsSent.contains(report.impl()->hash()); |
938 } | 929 } |
939 | 930 |
940 void ContentSecurityPolicy::didSendViolationReport(const String& report) | 931 void ContentSecurityPolicy::didSendViolationReport(const String& report) |
941 { | 932 { |
942 m_violationReportsSent.add(report.impl()->hash()); | 933 m_violationReportsSent.add(report.impl()->hash()); |
943 } | 934 } |
944 | 935 |
945 } // namespace blink | 936 } // namespace blink |
OLD | NEW |