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 |
(...skipping 28 matching lines...) Expand all Loading... |
39 class Document; | 39 class Document; |
40 class EncodedFormData; | 40 class EncodedFormData; |
41 | 41 |
42 class XSSInfo { | 42 class XSSInfo { |
43 USING_FAST_MALLOC(XSSInfo); | 43 USING_FAST_MALLOC(XSSInfo); |
44 WTF_MAKE_NONCOPYABLE(XSSInfo); | 44 WTF_MAKE_NONCOPYABLE(XSSInfo); |
45 | 45 |
46 public: | 46 public: |
47 static std::unique_ptr<XSSInfo> create(const String& originalURL, | 47 static std::unique_ptr<XSSInfo> create(const String& originalURL, |
48 bool didBlockEntirePage, | 48 bool didBlockEntirePage, |
49 bool didSendXSSProtectionHeader, | 49 bool didSendXSSProtectionHeader) { |
50 bool didSendCSPHeader) { | |
51 return wrapUnique(new XSSInfo(originalURL, didBlockEntirePage, | 50 return wrapUnique(new XSSInfo(originalURL, didBlockEntirePage, |
52 didSendXSSProtectionHeader, | 51 didSendXSSProtectionHeader)); |
53 didSendCSPHeader)); | |
54 } | 52 } |
55 | 53 |
56 String buildConsoleError() const; | 54 String buildConsoleError() const; |
57 bool isSafeToSendToAnotherThread() const; | 55 bool isSafeToSendToAnotherThread() const; |
58 | 56 |
59 String m_originalURL; | 57 String m_originalURL; |
60 bool m_didBlockEntirePage; | 58 bool m_didBlockEntirePage; |
61 bool m_didSendXSSProtectionHeader; | 59 bool m_didSendXSSProtectionHeader; |
62 bool m_didSendCSPHeader; | |
63 TextPosition m_textPosition; | 60 TextPosition m_textPosition; |
64 | 61 |
65 private: | 62 private: |
66 XSSInfo(const String& originalURL, | 63 XSSInfo(const String& originalURL, |
67 bool didBlockEntirePage, | 64 bool didBlockEntirePage, |
68 bool didSendXSSProtectionHeader, | 65 bool didSendXSSProtectionHeader) |
69 bool didSendCSPHeader) | |
70 : m_originalURL(originalURL.isolatedCopy()), | 66 : m_originalURL(originalURL.isolatedCopy()), |
71 m_didBlockEntirePage(didBlockEntirePage), | 67 m_didBlockEntirePage(didBlockEntirePage), |
72 m_didSendXSSProtectionHeader(didSendXSSProtectionHeader), | 68 m_didSendXSSProtectionHeader(didSendXSSProtectionHeader) {} |
73 m_didSendCSPHeader(didSendCSPHeader) {} | |
74 }; | 69 }; |
75 | 70 |
76 class XSSAuditorDelegate final { | 71 class XSSAuditorDelegate final { |
77 DISALLOW_NEW(); | 72 DISALLOW_NEW(); |
78 WTF_MAKE_NONCOPYABLE(XSSAuditorDelegate); | 73 WTF_MAKE_NONCOPYABLE(XSSAuditorDelegate); |
79 | 74 |
80 public: | 75 public: |
81 explicit XSSAuditorDelegate(Document*); | 76 explicit XSSAuditorDelegate(Document*); |
82 DECLARE_TRACE(); | 77 DECLARE_TRACE(); |
83 | 78 |
84 void didBlockScript(const XSSInfo&); | 79 void didBlockScript(const XSSInfo&); |
85 void setReportURL(const KURL& url) { m_reportURL = url; } | 80 void setReportURL(const KURL& url) { m_reportURL = url; } |
86 | 81 |
87 private: | 82 private: |
88 PassRefPtr<EncodedFormData> generateViolationReport(const XSSInfo&); | 83 PassRefPtr<EncodedFormData> generateViolationReport(const XSSInfo&); |
89 | 84 |
90 Member<Document> m_document; | 85 Member<Document> m_document; |
91 bool m_didSendNotifications; | 86 bool m_didSendNotifications; |
92 KURL m_reportURL; | 87 KURL m_reportURL; |
93 }; | 88 }; |
94 | 89 |
95 typedef Vector<std::unique_ptr<XSSInfo>> XSSInfoStream; | 90 typedef Vector<std::unique_ptr<XSSInfo>> XSSInfoStream; |
96 | 91 |
97 } // namespace blink | 92 } // namespace blink |
98 | 93 |
99 #endif | 94 #endif |
OLD | NEW |