| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 bool allowScriptFromSource(const KURL&, ReportingStatus = SendReport) const; | 118 bool allowScriptFromSource(const KURL&, ReportingStatus = SendReport) const; |
| 119 bool allowObjectFromSource(const KURL&, ReportingStatus = SendReport) const; | 119 bool allowObjectFromSource(const KURL&, ReportingStatus = SendReport) const; |
| 120 bool allowChildFrameFromSource(const KURL&, ReportingStatus = SendReport) co
nst; | 120 bool allowChildFrameFromSource(const KURL&, ReportingStatus = SendReport) co
nst; |
| 121 bool allowImageFromSource(const KURL&, ReportingStatus = SendReport) const; | 121 bool allowImageFromSource(const KURL&, ReportingStatus = SendReport) const; |
| 122 bool allowStyleFromSource(const KURL&, ReportingStatus = SendReport) const; | 122 bool allowStyleFromSource(const KURL&, ReportingStatus = SendReport) const; |
| 123 bool allowFontFromSource(const KURL&, ReportingStatus = SendReport) const; | 123 bool allowFontFromSource(const KURL&, ReportingStatus = SendReport) const; |
| 124 bool allowMediaFromSource(const KURL&, ReportingStatus = SendReport) const; | 124 bool allowMediaFromSource(const KURL&, ReportingStatus = SendReport) const; |
| 125 bool allowConnectToSource(const KURL&, ReportingStatus = SendReport) const; | 125 bool allowConnectToSource(const KURL&, ReportingStatus = SendReport) const; |
| 126 bool allowFormAction(const KURL&, ReportingStatus = SendReport) const; | 126 bool allowFormAction(const KURL&, ReportingStatus = SendReport) const; |
| 127 bool allowBaseURI(const KURL&, ReportingStatus = SendReport) const; | 127 bool allowBaseURI(const KURL&, ReportingStatus = SendReport) const; |
| 128 bool allowAncestors(LocalFrame*, ReportingStatus = SendReport) const; | 128 bool allowAncestors(LocalFrame*, const KURL&, ReportingStatus = SendReport)
const; |
| 129 bool allowChildContextFromSource(const KURL&, ReportingStatus = SendReport)
const; | 129 bool allowChildContextFromSource(const KURL&, ReportingStatus = SendReport)
const; |
| 130 bool allowWorkerContextFromSource(const KURL&, ReportingStatus = SendReport)
const; | 130 bool allowWorkerContextFromSource(const KURL&, ReportingStatus = SendReport)
const; |
| 131 | 131 |
| 132 // The nonce and hash allow functions are guaranteed to not have any side | 132 // The nonce and hash allow functions are guaranteed to not have any side |
| 133 // effects, including reporting. | 133 // effects, including reporting. |
| 134 // Nonce/Hash functions check all policies relating to use of a script/style | 134 // Nonce/Hash functions check all policies relating to use of a script/style |
| 135 // with the given nonce/hash and return true all CSP policies allow it. | 135 // with the given nonce/hash and return true all CSP policies allow it. |
| 136 // If these return true, callers can then process the content or | 136 // If these return true, callers can then process the content or |
| 137 // issue a load and be safe disabling any further CSP checks. | 137 // issue a load and be safe disabling any further CSP checks. |
| 138 bool allowScriptWithNonce(const String& nonce) const; | 138 bool allowScriptWithNonce(const String& nonce) const; |
| 139 bool allowStyleWithNonce(const String& nonce) const; | 139 bool allowStyleWithNonce(const String& nonce) const; |
| 140 bool allowScriptWithHash(const String& source) const; | 140 bool allowScriptWithHash(const String& source) const; |
| 141 bool allowStyleWithHash(const String& source) const; | 141 bool allowStyleWithHash(const String& source) const; |
| 142 | 142 |
| 143 void usesScriptHashAlgorithms(uint8_t ContentSecurityPolicyHashAlgorithm); | 143 void usesScriptHashAlgorithms(uint8_t ContentSecurityPolicyHashAlgorithm); |
| 144 void usesStyleHashAlgorithms(uint8_t ContentSecurityPolicyHashAlgorithm); | 144 void usesStyleHashAlgorithms(uint8_t ContentSecurityPolicyHashAlgorithm); |
| 145 | 145 |
| 146 ReflectedXSSDisposition reflectedXSSDisposition() const; | 146 ReflectedXSSDisposition reflectedXSSDisposition() const; |
| 147 | 147 |
| 148 ReferrerPolicy referrerPolicy() const; | 148 ReferrerPolicy referrerPolicy() const; |
| 149 bool didSetReferrerPolicy() const; | 149 bool didSetReferrerPolicy() const; |
| 150 | 150 |
| 151 void setOverrideAllowInlineStyle(bool); | 151 void setOverrideAllowInlineStyle(bool); |
| 152 void setOverrideURLForSelf(const KURL&); | 152 void setOverrideURLForSelf(const KURL&); |
| 153 | 153 |
| 154 bool isActive() const; | 154 bool isActive() const; |
| 155 | 155 |
| 156 void logToConsole(PassRefPtr<ConsoleMessage>); | 156 // If a frame is passed in, the message will be logged to its active documen
t's console. |
| 157 // Otherwise, the message will be logged to this object's |m_executionContex
t|. |
| 158 void logToConsole(PassRefPtr<ConsoleMessage>, LocalFrame* = 0); |
| 157 | 159 |
| 158 void reportDirectiveAsSourceExpression(const String& directiveName, const St
ring& sourceExpression); | 160 void reportDirectiveAsSourceExpression(const String& directiveName, const St
ring& sourceExpression); |
| 159 void reportDuplicateDirective(const String&); | 161 void reportDuplicateDirective(const String&); |
| 160 void reportInvalidDirectiveValueCharacter(const String& directiveName, const
String& value); | 162 void reportInvalidDirectiveValueCharacter(const String& directiveName, const
String& value); |
| 161 void reportInvalidPathCharacter(const String& directiveName, const String& v
alue, const char); | 163 void reportInvalidPathCharacter(const String& directiveName, const String& v
alue, const char); |
| 162 void reportInvalidPluginTypes(const String&); | 164 void reportInvalidPluginTypes(const String&); |
| 163 void reportInvalidSandboxFlags(const String&); | 165 void reportInvalidSandboxFlags(const String&); |
| 164 void reportInvalidSourceExpression(const String& directiveName, const String
& source); | 166 void reportInvalidSourceExpression(const String& directiveName, const String
& source); |
| 165 void reportInvalidReflectedXSS(const String&); | 167 void reportInvalidReflectedXSS(const String&); |
| 166 void reportMissingReportURI(const String&); | 168 void reportMissingReportURI(const String&); |
| 167 void reportUnsupportedDirective(const String&); | 169 void reportUnsupportedDirective(const String&); |
| 168 void reportInvalidInReportOnly(const String&); | 170 void reportInvalidInReportOnly(const String&); |
| 169 void reportInvalidReferrer(const String&); | 171 void reportInvalidReferrer(const String&); |
| 170 void reportReportOnlyInMeta(const String&); | 172 void reportReportOnlyInMeta(const String&); |
| 171 void reportMetaOutsideHead(const String&); | 173 void reportMetaOutsideHead(const String&); |
| 172 void reportViolation(const String& directiveText, const String& effectiveDir
ective, const String& consoleMessage, const KURL& blockedURL, const Vector<Strin
g>& reportEndpoints, const String& header); | 174 |
| 175 // If a frame is passed in, the report will be sent using it as a context. I
f no frame is |
| 176 // passed in, the report will be sent via this object's |m_executionContext|
(or dropped |
| 177 // on the floor if no such context is available). |
| 178 void reportViolation(const String& directiveText, const String& effectiveDir
ective, const String& consoleMessage, const KURL& blockedURL, const Vector<Strin
g>& reportEndpoints, const String& header, LocalFrame* = 0); |
| 173 | 179 |
| 174 void reportBlockedScriptExecutionToInspector(const String& directiveText) co
nst; | 180 void reportBlockedScriptExecutionToInspector(const String& directiveText) co
nst; |
| 175 | 181 |
| 176 const KURL url() const; | 182 const KURL url() const; |
| 177 void enforceSandboxFlags(SandboxFlags); | 183 void enforceSandboxFlags(SandboxFlags); |
| 178 String evalDisabledErrorMessage() const; | 184 String evalDisabledErrorMessage() const; |
| 179 | 185 |
| 180 bool urlMatchesSelf(const KURL&) const; | 186 bool urlMatchesSelf(const KURL&) const; |
| 181 bool protocolMatchesSelf(const KURL&) const; | 187 bool protocolMatchesSelf(const KURL&) const; |
| 182 | 188 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 SandboxFlags m_sandboxMask; | 224 SandboxFlags m_sandboxMask; |
| 219 ReferrerPolicy m_referrerPolicy; | 225 ReferrerPolicy m_referrerPolicy; |
| 220 String m_disableEvalErrorMessage; | 226 String m_disableEvalErrorMessage; |
| 221 | 227 |
| 222 OwnPtr<CSPSource> m_selfSource; | 228 OwnPtr<CSPSource> m_selfSource; |
| 223 }; | 229 }; |
| 224 | 230 |
| 225 } | 231 } |
| 226 | 232 |
| 227 #endif | 233 #endif |
| OLD | NEW |