| 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 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 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 ContentSecurityPolicy_h | 26 #ifndef ContentSecurityPolicy_h |
| 27 #define ContentSecurityPolicy_h | 27 #define ContentSecurityPolicy_h |
| 28 | 28 |
| 29 #include "bindings/core/v8/ScriptState.h" | 29 #include "bindings/core/v8/ScriptState.h" |
| 30 #include "core/dom/ExecutionContext.h" | 30 #include "core/dom/ExecutionContext.h" |
| 31 #include "core/dom/SecurityContext.h" | 31 #include "core/dom/SecurityContext.h" |
| 32 #include "core/fetch/Resource.h" | |
| 33 #include "core/frame/ConsoleTypes.h" | 32 #include "core/frame/ConsoleTypes.h" |
| 34 #include "platform/network/ContentSecurityPolicyParsers.h" | 33 #include "platform/network/ContentSecurityPolicyParsers.h" |
| 35 #include "platform/network/HTTPParsers.h" | 34 #include "platform/network/HTTPParsers.h" |
| 36 #include "platform/weborigin/ReferrerPolicy.h" | 35 #include "platform/weborigin/ReferrerPolicy.h" |
| 37 #include "wtf/HashSet.h" | 36 #include "wtf/HashSet.h" |
| 38 #include "wtf/PassOwnPtr.h" | 37 #include "wtf/PassOwnPtr.h" |
| 39 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
| 40 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
| 41 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
| 42 #include "wtf/text/StringHash.h" | 41 #include "wtf/text/StringHash.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 String evalDisabledErrorMessage() const; | 225 String evalDisabledErrorMessage() const; |
| 227 | 226 |
| 228 void setInsecureRequestsPolicy(SecurityContext::InsecureRequestsPolicy); | 227 void setInsecureRequestsPolicy(SecurityContext::InsecureRequestsPolicy); |
| 229 SecurityContext::InsecureRequestsPolicy insecureRequestsPolicy() const { ret
urn m_insecureRequestsPolicy; }; | 228 SecurityContext::InsecureRequestsPolicy insecureRequestsPolicy() const { ret
urn m_insecureRequestsPolicy; }; |
| 230 | 229 |
| 231 bool urlMatchesSelf(const KURL&) const; | 230 bool urlMatchesSelf(const KURL&) const; |
| 232 bool protocolMatchesSelf(const KURL&) const; | 231 bool protocolMatchesSelf(const KURL&) const; |
| 233 | 232 |
| 234 bool experimentalFeaturesEnabled() const; | 233 bool experimentalFeaturesEnabled() const; |
| 235 | 234 |
| 236 bool shouldSendCSPHeader(Resource::Type) const; | |
| 237 | |
| 238 static bool shouldBypassMainWorld(const ExecutionContext*); | 235 static bool shouldBypassMainWorld(const ExecutionContext*); |
| 239 | 236 |
| 240 static bool isDirectiveName(const String&); | 237 static bool isDirectiveName(const String&); |
| 241 | 238 |
| 242 private: | 239 private: |
| 243 ContentSecurityPolicy(); | 240 ContentSecurityPolicy(); |
| 244 | 241 |
| 245 void applyPolicySideEffectsToExecutionContext(); | 242 void applyPolicySideEffectsToExecutionContext(); |
| 246 | 243 |
| 247 Document* document() const; | 244 Document* document() const; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 274 String m_disableEvalErrorMessage; | 271 String m_disableEvalErrorMessage; |
| 275 SecurityContext::InsecureRequestsPolicy m_insecureRequestsPolicy; | 272 SecurityContext::InsecureRequestsPolicy m_insecureRequestsPolicy; |
| 276 | 273 |
| 277 OwnPtr<CSPSource> m_selfSource; | 274 OwnPtr<CSPSource> m_selfSource; |
| 278 String m_selfProtocol; | 275 String m_selfProtocol; |
| 279 }; | 276 }; |
| 280 | 277 |
| 281 } | 278 } |
| 282 | 279 |
| 283 #endif | 280 #endif |
| OLD | NEW |