| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y | 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y |
| 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N | 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N |
| 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #ifndef SecurityPolicyViolationEvent_h | 25 #ifndef SecurityPolicyViolationEvent_h |
| 26 #define SecurityPolicyViolationEvent_h | 26 #define SecurityPolicyViolationEvent_h |
| 27 | 27 |
| 28 #include "core/events/Event.h" | 28 #include "core/events/Event.h" |
| 29 #include "core/events/SecurityPolicyViolationEventInit.h" | 29 #include "core/events/SecurityPolicyViolationEventInit.h" |
| 30 #include "platform/network/ContentSecurityPolicyParsers.h" |
| 30 | 31 |
| 31 namespace blink { | 32 namespace blink { |
| 32 | 33 |
| 33 class SecurityPolicyViolationEvent final : public Event { | 34 class SecurityPolicyViolationEvent final : public Event { |
| 34 DEFINE_WRAPPERTYPEINFO(); | 35 DEFINE_WRAPPERTYPEINFO(); |
| 35 public: | 36 public: |
| 36 static SecurityPolicyViolationEvent* create(const AtomicString& type, const
SecurityPolicyViolationEventInit& initializer) | 37 static SecurityPolicyViolationEvent* create(const AtomicString& type, const
SecurityPolicyViolationEventInit& initializer) |
| 37 { | 38 { |
| 38 return new SecurityPolicyViolationEvent(type, initializer); | 39 return new SecurityPolicyViolationEvent(type, initializer); |
| 39 } | 40 } |
| 40 | 41 |
| 41 const String& documentURI() const { return m_documentURI; } | 42 const String& documentURI() const { return m_documentURI; } |
| 42 const String& referrer() const { return m_referrer; } | 43 const String& referrer() const { return m_referrer; } |
| 43 const String& blockedURI() const { return m_blockedURI; } | 44 const String& blockedURI() const { return m_blockedURI; } |
| 44 const String& violatedDirective() const { return m_violatedDirective; } | 45 const String& violatedDirective() const { return m_violatedDirective; } |
| 45 const String& effectiveDirective() const { return m_effectiveDirective; } | 46 const String& effectiveDirective() const { return m_effectiveDirective; } |
| 46 const String& originalPolicy() const { return m_originalPolicy; } | 47 const String& originalPolicy() const { return m_originalPolicy; } |
| 48 const String& disposition() const; |
| 47 const String& sourceFile() const { return m_sourceFile; } | 49 const String& sourceFile() const { return m_sourceFile; } |
| 48 int lineNumber() const { return m_lineNumber; } | 50 int lineNumber() const { return m_lineNumber; } |
| 49 int columnNumber() const { return m_columnNumber; } | 51 int columnNumber() const { return m_columnNumber; } |
| 50 uint16_t statusCode() const { return m_statusCode; } | 52 uint16_t statusCode() const { return m_statusCode; } |
| 51 | 53 |
| 52 const AtomicString& interfaceName() const override { return EventNames::Secu
rityPolicyViolationEvent; } | 54 const AtomicString& interfaceName() const override { return EventNames::Secu
rityPolicyViolationEvent; } |
| 53 | 55 |
| 54 DEFINE_INLINE_VIRTUAL_TRACE() { Event::trace(visitor); } | 56 DEFINE_INLINE_VIRTUAL_TRACE() { Event::trace(visitor); } |
| 55 | 57 |
| 56 private: | 58 private: |
| 57 SecurityPolicyViolationEvent(const AtomicString& type, const SecurityPolicyV
iolationEventInit& initializer) | 59 SecurityPolicyViolationEvent(const AtomicString& type, const SecurityPolicyV
iolationEventInit& initializer); |
| 58 : Event(type, initializer) | |
| 59 , m_lineNumber(0) | |
| 60 , m_columnNumber(0) | |
| 61 , m_statusCode(0) | |
| 62 { | |
| 63 if (initializer.hasDocumentURI()) | |
| 64 m_documentURI = initializer.documentURI(); | |
| 65 if (initializer.hasReferrer()) | |
| 66 m_referrer = initializer.referrer(); | |
| 67 if (initializer.hasBlockedURI()) | |
| 68 m_blockedURI = initializer.blockedURI(); | |
| 69 if (initializer.hasViolatedDirective()) | |
| 70 m_violatedDirective = initializer.violatedDirective(); | |
| 71 if (initializer.hasEffectiveDirective()) | |
| 72 m_effectiveDirective = initializer.effectiveDirective(); | |
| 73 if (initializer.hasOriginalPolicy()) | |
| 74 m_originalPolicy = initializer.originalPolicy(); | |
| 75 if (initializer.hasSourceFile()) | |
| 76 m_sourceFile = initializer.sourceFile(); | |
| 77 if (initializer.hasLineNumber()) | |
| 78 m_lineNumber = initializer.lineNumber(); | |
| 79 if (initializer.hasColumnNumber()) | |
| 80 m_columnNumber = initializer.columnNumber(); | |
| 81 if (initializer.hasStatusCode()) | |
| 82 m_statusCode = initializer.statusCode(); | |
| 83 } | |
| 84 | 60 |
| 85 String m_documentURI; | 61 String m_documentURI; |
| 86 String m_referrer; | 62 String m_referrer; |
| 87 String m_blockedURI; | 63 String m_blockedURI; |
| 88 String m_violatedDirective; | 64 String m_violatedDirective; |
| 89 String m_effectiveDirective; | 65 String m_effectiveDirective; |
| 90 String m_originalPolicy; | 66 String m_originalPolicy; |
| 67 ContentSecurityPolicyHeaderType m_disposition; |
| 91 String m_sourceFile; | 68 String m_sourceFile; |
| 92 int m_lineNumber; | 69 int m_lineNumber; |
| 93 int m_columnNumber; | 70 int m_columnNumber; |
| 94 int m_statusCode; | 71 int m_statusCode; |
| 95 }; | 72 }; |
| 96 | 73 |
| 97 } // namespace blink | 74 } // namespace blink |
| 98 | 75 |
| 99 #endif // SecurityPolicyViolationEvent_h | 76 #endif // SecurityPolicyViolationEvent_h |
| OLD | NEW |