OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Adam Barth. All Rights Reserved. | 2 * Copyright (C) 2011 Adam Barth. 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 12 matching lines...) Expand all Loading... |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef XSSAuditor_h | 26 #ifndef XSSAuditor_h |
27 #define XSSAuditor_h | 27 #define XSSAuditor_h |
28 | 28 |
29 #include "core/html/parser/HTMLToken.h" | 29 #include "core/html/parser/HTMLToken.h" |
30 #include "platform/network/HTTPParsers.h" | 30 #include "platform/network/HTTPParsers.h" |
31 #include "platform/text/SuffixTree.h" | 31 #include "platform/text/SuffixTree.h" |
32 #include "platform/weborigin/KURL.h" | 32 #include "platform/weborigin/KURL.h" |
| 33 #include "wtf/Allocator.h" |
33 #include "wtf/PassOwnPtr.h" | 34 #include "wtf/PassOwnPtr.h" |
34 #include "wtf/text/TextEncoding.h" | 35 #include "wtf/text/TextEncoding.h" |
35 | 36 |
36 namespace blink { | 37 namespace blink { |
37 | 38 |
38 class Document; | 39 class Document; |
39 class HTMLSourceTracker; | 40 class HTMLSourceTracker; |
40 class XSSInfo; | 41 class XSSInfo; |
41 class XSSAuditorDelegate; | 42 class XSSAuditorDelegate; |
42 | 43 |
43 struct FilterTokenRequest { | 44 struct FilterTokenRequest { |
| 45 STACK_ALLOCATED(); |
44 FilterTokenRequest(HTMLToken& token, HTMLSourceTracker& sourceTracker, bool
shouldAllowCDATA) | 46 FilterTokenRequest(HTMLToken& token, HTMLSourceTracker& sourceTracker, bool
shouldAllowCDATA) |
45 : token(token) | 47 : token(token) |
46 , sourceTracker(sourceTracker) | 48 , sourceTracker(sourceTracker) |
47 , shouldAllowCDATA(shouldAllowCDATA) | 49 , shouldAllowCDATA(shouldAllowCDATA) |
48 { } | 50 { } |
49 | 51 |
50 HTMLToken& token; | 52 HTMLToken& token; |
51 HTMLSourceTracker& sourceTracker; | 53 HTMLSourceTracker& sourceTracker; |
52 bool shouldAllowCDATA; | 54 bool shouldAllowCDATA; |
53 }; | 55 }; |
54 | 56 |
55 class XSSAuditor { | 57 class XSSAuditor { |
| 58 WTF_MAKE_FAST_ALLOCATED(XSSAuditor); |
56 WTF_MAKE_NONCOPYABLE(XSSAuditor); | 59 WTF_MAKE_NONCOPYABLE(XSSAuditor); |
57 public: | 60 public: |
58 XSSAuditor(); | 61 XSSAuditor(); |
59 | 62 |
60 void init(Document*, XSSAuditorDelegate*); | 63 void init(Document*, XSSAuditorDelegate*); |
61 void initForFragment(); | 64 void initForFragment(); |
62 | 65 |
63 PassOwnPtr<XSSInfo> filterToken(const FilterTokenRequest&); | 66 PassOwnPtr<XSSInfo> filterToken(const FilterTokenRequest&); |
64 bool isSafeToSendToAnotherThread() const; | 67 bool isSafeToSendToAnotherThread() const; |
65 | 68 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 132 |
130 State m_state; | 133 State m_state; |
131 bool m_scriptTagFoundInRequest; | 134 bool m_scriptTagFoundInRequest; |
132 unsigned m_scriptTagNestingLevel; | 135 unsigned m_scriptTagNestingLevel; |
133 WTF::TextEncoding m_encoding; | 136 WTF::TextEncoding m_encoding; |
134 }; | 137 }; |
135 | 138 |
136 } | 139 } |
137 | 140 |
138 #endif | 141 #endif |
OLD | NEW |