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 21 matching lines...) Expand all Loading... |
32 #include "core/dom/Document.h" | 32 #include "core/dom/Document.h" |
33 #include "core/events/SecurityPolicyViolationEvent.h" | 33 #include "core/events/SecurityPolicyViolationEvent.h" |
34 #include "core/frame/LocalDOMWindow.h" | 34 #include "core/frame/LocalDOMWindow.h" |
35 #include "core/frame/LocalFrame.h" | 35 #include "core/frame/LocalFrame.h" |
36 #include "core/frame/UseCounter.h" | 36 #include "core/frame/UseCounter.h" |
37 #include "core/frame/csp/CSPDirectiveList.h" | 37 #include "core/frame/csp/CSPDirectiveList.h" |
38 #include "core/frame/csp/CSPSource.h" | 38 #include "core/frame/csp/CSPSource.h" |
39 #include "core/frame/csp/CSPSourceList.h" | 39 #include "core/frame/csp/CSPSourceList.h" |
40 #include "core/frame/csp/MediaListDirective.h" | 40 #include "core/frame/csp/MediaListDirective.h" |
41 #include "core/frame/csp/SourceListDirective.h" | 41 #include "core/frame/csp/SourceListDirective.h" |
| 42 #include "core/inspector/ConsoleMessage.h" |
42 #include "core/inspector/InspectorInstrumentation.h" | 43 #include "core/inspector/InspectorInstrumentation.h" |
43 #include "core/inspector/ScriptCallStack.h" | 44 #include "core/inspector/ScriptCallStack.h" |
44 #include "core/loader/DocumentLoader.h" | 45 #include "core/loader/DocumentLoader.h" |
45 #include "core/loader/PingLoader.h" | 46 #include "core/loader/PingLoader.h" |
46 #include "platform/Crypto.h" | 47 #include "platform/Crypto.h" |
47 #include "platform/JSONValues.h" | 48 #include "platform/JSONValues.h" |
48 #include "platform/NotImplemented.h" | 49 #include "platform/NotImplemented.h" |
49 #include "platform/ParsingUtilities.h" | 50 #include "platform/ParsingUtilities.h" |
50 #include "platform/RuntimeEnabledFeatures.h" | 51 #include "platform/RuntimeEnabledFeatures.h" |
51 #include "platform/network/ContentSecurityPolicyParsers.h" | 52 #include "platform/network/ContentSecurityPolicyParsers.h" |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 logToConsole(message); | 752 logToConsole(message); |
752 } | 753 } |
753 | 754 |
754 void ContentSecurityPolicy::reportMissingReportURI(const String& policy) const | 755 void ContentSecurityPolicy::reportMissingReportURI(const String& policy) const |
755 { | 756 { |
756 logToConsole("The Content Security Policy '" + policy + "' was delivered in
report-only mode, but does not specify a 'report-uri'; the policy will have no e
ffect. Please either add a 'report-uri' directive, or deliver the policy via the
'Content-Security-Policy' header."); | 757 logToConsole("The Content Security Policy '" + policy + "' was delivered in
report-only mode, but does not specify a 'report-uri'; the policy will have no e
ffect. Please either add a 'report-uri' directive, or deliver the policy via the
'Content-Security-Policy' header."); |
757 } | 758 } |
758 | 759 |
759 void ContentSecurityPolicy::logToConsole(const String& message, MessageLevel lev
el) const | 760 void ContentSecurityPolicy::logToConsole(const String& message, MessageLevel lev
el) const |
760 { | 761 { |
761 m_executionContext->addConsoleMessage(SecurityMessageSource, level, message)
; | 762 m_executionContext->addConsoleMessage(ConsoleMessage::create(SecurityMessage
Source, level, message)); |
762 } | 763 } |
763 | 764 |
764 void ContentSecurityPolicy::reportBlockedScriptExecutionToInspector(const String
& directiveText) const | 765 void ContentSecurityPolicy::reportBlockedScriptExecutionToInspector(const String
& directiveText) const |
765 { | 766 { |
766 m_executionContext->reportBlockedScriptExecutionToInspector(directiveText); | 767 m_executionContext->reportBlockedScriptExecutionToInspector(directiveText); |
767 } | 768 } |
768 | 769 |
769 bool ContentSecurityPolicy::experimentalFeaturesEnabled() const | 770 bool ContentSecurityPolicy::experimentalFeaturesEnabled() const |
770 { | 771 { |
771 return RuntimeEnabledFeatures::experimentalContentSecurityPolicyFeaturesEnab
led(); | 772 return RuntimeEnabledFeatures::experimentalContentSecurityPolicyFeaturesEnab
led(); |
(...skipping 14 matching lines...) Expand all Loading... |
786 // Collisions have no security impact, so we can save space by storing only
the string's hash rather than the whole report. | 787 // Collisions have no security impact, so we can save space by storing only
the string's hash rather than the whole report. |
787 return !m_violationReportsSent.contains(report.impl()->hash()); | 788 return !m_violationReportsSent.contains(report.impl()->hash()); |
788 } | 789 } |
789 | 790 |
790 void ContentSecurityPolicy::didSendViolationReport(const String& report) | 791 void ContentSecurityPolicy::didSendViolationReport(const String& report) |
791 { | 792 { |
792 m_violationReportsSent.add(report.impl()->hash()); | 793 m_violationReportsSent.add(report.impl()->hash()); |
793 } | 794 } |
794 | 795 |
795 } // namespace blink | 796 } // namespace blink |
OLD | NEW |