beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 Apple Inc. All Rights Reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY |
| 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
mjs@apple.com | 9204733 | 2014-03-15 04:08:27 +0000 | [diff] [blame^] | 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
commit-queue@webkit.org | 8bdba9b | 2012-03-09 00:41:22 +0000 | [diff] [blame] | 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 24 | * |
| 25 | */ |
| 26 | #include "config.h" |
| 27 | #include "SchemeRegistry.h" |
cdn@chromium.org | 7696652 | 2012-01-26 23:50:31 +0000 | [diff] [blame] | 28 | #include <wtf/MainThread.h> |
jpfau@apple.com | 39bf85f | 2014-01-30 23:02:39 +0000 | [diff] [blame] | 29 | #include <wtf/NeverDestroyed.h> |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 30 | |
abarth@webkit.org | 617ecad | 2012-01-06 00:39:16 +0000 | [diff] [blame] | 31 | namespace WebCore { |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 32 | |
| 33 | static URLSchemesMap& localURLSchemes() |
| 34 | { |
svillar@igalia.com | 5b31eef | 2014-03-14 08:30:55 +0000 | [diff] [blame] | 35 | DEPRECATED_DEFINE_STATIC_LOCAL(URLSchemesMap, localSchemes, ()); |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 36 | |
| 37 | if (localSchemes.isEmpty()) { |
| 38 | localSchemes.add("file"); |
mitz@apple.com | 1a8d7d3 | 2014-02-07 23:37:54 +0000 | [diff] [blame] | 39 | #if PLATFORM(COCOA) |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 40 | localSchemes.add("applewebdata"); |
| 41 | #endif |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | return localSchemes; |
| 45 | } |
| 46 | |
abarth@webkit.org | c655f68 | 2011-01-11 01:02:01 +0000 | [diff] [blame] | 47 | static URLSchemesMap& displayIsolatedURLSchemes() |
| 48 | { |
svillar@igalia.com | 5b31eef | 2014-03-14 08:30:55 +0000 | [diff] [blame] | 49 | DEPRECATED_DEFINE_STATIC_LOCAL(URLSchemesMap, displayIsolatedSchemes, ()); |
abarth@webkit.org | c655f68 | 2011-01-11 01:02:01 +0000 | [diff] [blame] | 50 | return displayIsolatedSchemes; |
| 51 | } |
| 52 | |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 53 | static URLSchemesMap& secureSchemes() |
| 54 | { |
svillar@igalia.com | 5b31eef | 2014-03-14 08:30:55 +0000 | [diff] [blame] | 55 | DEPRECATED_DEFINE_STATIC_LOCAL(URLSchemesMap, secureSchemes, ()); |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 56 | |
| 57 | if (secureSchemes.isEmpty()) { |
| 58 | secureSchemes.add("https"); |
| 59 | secureSchemes.add("about"); |
| 60 | secureSchemes.add("data"); |
| 61 | } |
| 62 | |
| 63 | return secureSchemes; |
| 64 | } |
| 65 | |
| 66 | static URLSchemesMap& schemesWithUniqueOrigins() |
| 67 | { |
svillar@igalia.com | 5b31eef | 2014-03-14 08:30:55 +0000 | [diff] [blame] | 68 | DEPRECATED_DEFINE_STATIC_LOCAL(URLSchemesMap, schemesWithUniqueOrigins, ()); |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 69 | |
abarth@webkit.org | e864323 | 2011-11-17 21:34:36 +0000 | [diff] [blame] | 70 | if (schemesWithUniqueOrigins.isEmpty()) { |
| 71 | schemesWithUniqueOrigins.add("about"); |
| 72 | schemesWithUniqueOrigins.add("javascript"); |
| 73 | // This is a willful violation of HTML5. |
| 74 | // See https://bugs.webkit.org/show_bug.cgi?id=11885 |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 75 | schemesWithUniqueOrigins.add("data"); |
abarth@webkit.org | e864323 | 2011-11-17 21:34:36 +0000 | [diff] [blame] | 76 | } |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 77 | |
| 78 | return schemesWithUniqueOrigins; |
| 79 | } |
| 80 | |
beidson@apple.com | 5c1fdf1 | 2010-07-26 20:37:56 +0000 | [diff] [blame] | 81 | static URLSchemesMap& emptyDocumentSchemes() |
| 82 | { |
svillar@igalia.com | 5b31eef | 2014-03-14 08:30:55 +0000 | [diff] [blame] | 83 | DEPRECATED_DEFINE_STATIC_LOCAL(URLSchemesMap, emptyDocumentSchemes, ()); |
beidson@apple.com | 5c1fdf1 | 2010-07-26 20:37:56 +0000 | [diff] [blame] | 84 | |
| 85 | if (emptyDocumentSchemes.isEmpty()) |
| 86 | emptyDocumentSchemes.add("about"); |
| 87 | |
| 88 | return emptyDocumentSchemes; |
| 89 | } |
| 90 | |
abarth@webkit.org | 8e056b0 | 2011-11-08 01:37:47 +0000 | [diff] [blame] | 91 | static HashSet<String>& schemesForbiddenFromDomainRelaxation() |
| 92 | { |
svillar@igalia.com | 5b31eef | 2014-03-14 08:30:55 +0000 | [diff] [blame] | 93 | DEPRECATED_DEFINE_STATIC_LOCAL(HashSet<String>, schemes, ()); |
abarth@webkit.org | 8e056b0 | 2011-11-08 01:37:47 +0000 | [diff] [blame] | 94 | return schemes; |
| 95 | } |
| 96 | |
commit-queue@webkit.org | 3b8fac5 | 2011-02-11 21:39:04 +0000 | [diff] [blame] | 97 | static URLSchemesMap& canDisplayOnlyIfCanRequestSchemes() |
| 98 | { |
svillar@igalia.com | 5b31eef | 2014-03-14 08:30:55 +0000 | [diff] [blame] | 99 | DEPRECATED_DEFINE_STATIC_LOCAL(URLSchemesMap, canDisplayOnlyIfCanRequestSchemes, ()); |
commit-queue@webkit.org | 3b8fac5 | 2011-02-11 21:39:04 +0000 | [diff] [blame] | 100 | |
commit-queue@webkit.org | 3b8fac5 | 2011-02-11 21:39:04 +0000 | [diff] [blame] | 101 | #if ENABLE(BLOB) |
commit-queue@webkit.org | 8bdba9b | 2012-03-09 00:41:22 +0000 | [diff] [blame] | 102 | if (canDisplayOnlyIfCanRequestSchemes.isEmpty()) { |
commit-queue@webkit.org | 3b8fac5 | 2011-02-11 21:39:04 +0000 | [diff] [blame] | 103 | canDisplayOnlyIfCanRequestSchemes.add("blob"); |
commit-queue@webkit.org | 3b8fac5 | 2011-02-11 21:39:04 +0000 | [diff] [blame] | 104 | } |
commit-queue@webkit.org | 8bdba9b | 2012-03-09 00:41:22 +0000 | [diff] [blame] | 105 | #endif // ENABLE(BLOB) |
commit-queue@webkit.org | 3b8fac5 | 2011-02-11 21:39:04 +0000 | [diff] [blame] | 106 | |
| 107 | return canDisplayOnlyIfCanRequestSchemes; |
| 108 | } |
| 109 | |
commit-queue@webkit.org | 54a0b04 | 2011-08-24 21:06:43 +0000 | [diff] [blame] | 110 | static URLSchemesMap& notAllowingJavascriptURLsSchemes() |
| 111 | { |
svillar@igalia.com | 5b31eef | 2014-03-14 08:30:55 +0000 | [diff] [blame] | 112 | DEPRECATED_DEFINE_STATIC_LOCAL(URLSchemesMap, notAllowingJavascriptURLsSchemes, ()); |
commit-queue@webkit.org | 54a0b04 | 2011-08-24 21:06:43 +0000 | [diff] [blame] | 113 | return notAllowingJavascriptURLsSchemes; |
| 114 | } |
| 115 | |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 116 | void SchemeRegistry::registerURLSchemeAsLocal(const String& scheme) |
| 117 | { |
abarth@webkit.org | c655f68 | 2011-01-11 01:02:01 +0000 | [diff] [blame] | 118 | localURLSchemes().add(scheme); |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | void SchemeRegistry::removeURLSchemeRegisteredAsLocal(const String& scheme) |
| 122 | { |
| 123 | if (scheme == "file") |
| 124 | return; |
mitz@apple.com | 1a8d7d3 | 2014-02-07 23:37:54 +0000 | [diff] [blame] | 125 | #if PLATFORM(COCOA) |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 126 | if (scheme == "applewebdata") |
| 127 | return; |
| 128 | #endif |
abarth@webkit.org | c655f68 | 2011-01-11 01:02:01 +0000 | [diff] [blame] | 129 | localURLSchemes().remove(scheme); |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 130 | } |
| 131 | |
abarth@webkit.org | c655f68 | 2011-01-11 01:02:01 +0000 | [diff] [blame] | 132 | const URLSchemesMap& SchemeRegistry::localSchemes() |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 133 | { |
abarth@webkit.org | c655f68 | 2011-01-11 01:02:01 +0000 | [diff] [blame] | 134 | return localURLSchemes(); |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 135 | } |
| 136 | |
jberlin@webkit.org | da2af49 | 2011-11-07 18:16:33 +0000 | [diff] [blame] | 137 | static URLSchemesMap& schemesAllowingLocalStorageAccessInPrivateBrowsing() |
| 138 | { |
svillar@igalia.com | 5b31eef | 2014-03-14 08:30:55 +0000 | [diff] [blame] | 139 | DEPRECATED_DEFINE_STATIC_LOCAL(URLSchemesMap, schemesAllowingLocalStorageAccessInPrivateBrowsing, ()); |
jberlin@webkit.org | da2af49 | 2011-11-07 18:16:33 +0000 | [diff] [blame] | 140 | return schemesAllowingLocalStorageAccessInPrivateBrowsing; |
| 141 | } |
| 142 | |
| 143 | static URLSchemesMap& schemesAllowingDatabaseAccessInPrivateBrowsing() |
| 144 | { |
svillar@igalia.com | 5b31eef | 2014-03-14 08:30:55 +0000 | [diff] [blame] | 145 | DEPRECATED_DEFINE_STATIC_LOCAL(URLSchemesMap, schemesAllowingDatabaseAccessInPrivateBrowsing, ()); |
jberlin@webkit.org | da2af49 | 2011-11-07 18:16:33 +0000 | [diff] [blame] | 146 | return schemesAllowingDatabaseAccessInPrivateBrowsing; |
| 147 | } |
| 148 | |
cdn@chromium.org | 7696652 | 2012-01-26 23:50:31 +0000 | [diff] [blame] | 149 | static URLSchemesMap& CORSEnabledSchemes() |
| 150 | { |
commit-queue@webkit.org | 8bdba9b | 2012-03-09 00:41:22 +0000 | [diff] [blame] | 151 | // FIXME: http://bugs.webkit.org/show_bug.cgi?id=77160 |
svillar@igalia.com | 5b31eef | 2014-03-14 08:30:55 +0000 | [diff] [blame] | 152 | DEPRECATED_DEFINE_STATIC_LOCAL(URLSchemesMap, CORSEnabledSchemes, ()); |
cdn@chromium.org | 7696652 | 2012-01-26 23:50:31 +0000 | [diff] [blame] | 153 | |
| 154 | if (CORSEnabledSchemes.isEmpty()) { |
| 155 | CORSEnabledSchemes.add("http"); |
| 156 | CORSEnabledSchemes.add("https"); |
| 157 | } |
| 158 | |
| 159 | return CORSEnabledSchemes; |
| 160 | } |
| 161 | |
commit-queue@webkit.org | 828d239 | 2012-06-19 07:27:33 +0000 | [diff] [blame] | 162 | static URLSchemesMap& ContentSecurityPolicyBypassingSchemes() |
| 163 | { |
svillar@igalia.com | 5b31eef | 2014-03-14 08:30:55 +0000 | [diff] [blame] | 164 | DEPRECATED_DEFINE_STATIC_LOCAL(URLSchemesMap, schemes, ()); |
commit-queue@webkit.org | 828d239 | 2012-06-19 07:27:33 +0000 | [diff] [blame] | 165 | return schemes; |
| 166 | } |
| 167 | |
jpfau@apple.com | 39bf85f | 2014-01-30 23:02:39 +0000 | [diff] [blame] | 168 | #if ENABLE(CACHE_PARTITIONING) |
| 169 | static URLSchemesMap& cachePartitioningSchemes() |
| 170 | { |
| 171 | static NeverDestroyed<URLSchemesMap> schemes; |
| 172 | return schemes; |
| 173 | } |
| 174 | #endif |
| 175 | |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 176 | bool SchemeRegistry::shouldTreatURLSchemeAsLocal(const String& scheme) |
| 177 | { |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 178 | if (scheme.isEmpty()) |
| 179 | return false; |
abarth@webkit.org | c655f68 | 2011-01-11 01:02:01 +0000 | [diff] [blame] | 180 | return localURLSchemes().contains(scheme); |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | void SchemeRegistry::registerURLSchemeAsNoAccess(const String& scheme) |
| 184 | { |
| 185 | schemesWithUniqueOrigins().add(scheme); |
| 186 | } |
| 187 | |
| 188 | bool SchemeRegistry::shouldTreatURLSchemeAsNoAccess(const String& scheme) |
| 189 | { |
commit-queue@webkit.org | 051eef4 | 2011-02-11 22:03:09 +0000 | [diff] [blame] | 190 | if (scheme.isEmpty()) |
| 191 | return false; |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 192 | return schemesWithUniqueOrigins().contains(scheme); |
| 193 | } |
| 194 | |
abarth@webkit.org | c655f68 | 2011-01-11 01:02:01 +0000 | [diff] [blame] | 195 | void SchemeRegistry::registerURLSchemeAsDisplayIsolated(const String& scheme) |
| 196 | { |
| 197 | displayIsolatedURLSchemes().add(scheme); |
| 198 | } |
| 199 | |
| 200 | bool SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated(const String& scheme) |
| 201 | { |
abarth@webkit.org | d7652e8 | 2011-01-25 21:29:14 +0000 | [diff] [blame] | 202 | if (scheme.isEmpty()) |
| 203 | return false; |
abarth@webkit.org | c655f68 | 2011-01-11 01:02:01 +0000 | [diff] [blame] | 204 | return displayIsolatedURLSchemes().contains(scheme); |
| 205 | } |
| 206 | |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 207 | void SchemeRegistry::registerURLSchemeAsSecure(const String& scheme) |
| 208 | { |
| 209 | secureSchemes().add(scheme); |
| 210 | } |
| 211 | |
| 212 | bool SchemeRegistry::shouldTreatURLSchemeAsSecure(const String& scheme) |
| 213 | { |
commit-queue@webkit.org | 051eef4 | 2011-02-11 22:03:09 +0000 | [diff] [blame] | 214 | if (scheme.isEmpty()) |
| 215 | return false; |
beidson@apple.com | c7fe45f | 2010-07-21 23:19:55 +0000 | [diff] [blame] | 216 | return secureSchemes().contains(scheme); |
| 217 | } |
| 218 | |
beidson@apple.com | 5c1fdf1 | 2010-07-26 20:37:56 +0000 | [diff] [blame] | 219 | void SchemeRegistry::registerURLSchemeAsEmptyDocument(const String& scheme) |
| 220 | { |
| 221 | emptyDocumentSchemes().add(scheme); |
| 222 | } |
| 223 | |
| 224 | bool SchemeRegistry::shouldLoadURLSchemeAsEmptyDocument(const String& scheme) |
| 225 | { |
commit-queue@webkit.org | 051eef4 | 2011-02-11 22:03:09 +0000 | [diff] [blame] | 226 | if (scheme.isEmpty()) |
| 227 | return false; |
beidson@apple.com | 5c1fdf1 | 2010-07-26 20:37:56 +0000 | [diff] [blame] | 228 | return emptyDocumentSchemes().contains(scheme); |
| 229 | } |
| 230 | |
abarth@webkit.org | 8e056b0 | 2011-11-08 01:37:47 +0000 | [diff] [blame] | 231 | void SchemeRegistry::setDomainRelaxationForbiddenForURLScheme(bool forbidden, const String& scheme) |
| 232 | { |
| 233 | if (scheme.isEmpty()) |
| 234 | return; |
| 235 | |
| 236 | if (forbidden) |
| 237 | schemesForbiddenFromDomainRelaxation().add(scheme); |
| 238 | else |
| 239 | schemesForbiddenFromDomainRelaxation().remove(scheme); |
| 240 | } |
| 241 | |
| 242 | bool SchemeRegistry::isDomainRelaxationForbiddenForURLScheme(const String& scheme) |
| 243 | { |
| 244 | if (scheme.isEmpty()) |
| 245 | return false; |
| 246 | return schemesForbiddenFromDomainRelaxation().contains(scheme); |
| 247 | } |
| 248 | |
commit-queue@webkit.org | 3b8fac5 | 2011-02-11 21:39:04 +0000 | [diff] [blame] | 249 | bool SchemeRegistry::canDisplayOnlyIfCanRequest(const String& scheme) |
| 250 | { |
| 251 | if (scheme.isEmpty()) |
| 252 | return false; |
| 253 | return canDisplayOnlyIfCanRequestSchemes().contains(scheme); |
| 254 | } |
| 255 | |
| 256 | void SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest(const String& scheme) |
| 257 | { |
| 258 | canDisplayOnlyIfCanRequestSchemes().add(scheme); |
| 259 | } |
| 260 | |
commit-queue@webkit.org | 8bdba9b | 2012-03-09 00:41:22 +0000 | [diff] [blame] | 261 | void SchemeRegistry::registerURLSchemeAsNotAllowingJavascriptURLs(const String& scheme) |
commit-queue@webkit.org | 54a0b04 | 2011-08-24 21:06:43 +0000 | [diff] [blame] | 262 | { |
| 263 | notAllowingJavascriptURLsSchemes().add(scheme); |
| 264 | } |
| 265 | |
| 266 | bool SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs(const String& scheme) |
| 267 | { |
| 268 | if (scheme.isEmpty()) |
| 269 | return false; |
| 270 | return notAllowingJavascriptURLsSchemes().contains(scheme); |
| 271 | } |
| 272 | |
jberlin@webkit.org | da2af49 | 2011-11-07 18:16:33 +0000 | [diff] [blame] | 273 | void SchemeRegistry::registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing(const String& scheme) |
| 274 | { |
| 275 | schemesAllowingLocalStorageAccessInPrivateBrowsing().add(scheme); |
| 276 | } |
| 277 | |
| 278 | bool SchemeRegistry::allowsLocalStorageAccessInPrivateBrowsing(const String& scheme) |
| 279 | { |
| 280 | if (scheme.isEmpty()) |
| 281 | return false; |
| 282 | return schemesAllowingLocalStorageAccessInPrivateBrowsing().contains(scheme); |
| 283 | } |
| 284 | |
| 285 | void SchemeRegistry::registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing(const String& scheme) |
| 286 | { |
| 287 | schemesAllowingDatabaseAccessInPrivateBrowsing().add(scheme); |
| 288 | } |
| 289 | |
| 290 | bool SchemeRegistry::allowsDatabaseAccessInPrivateBrowsing(const String& scheme) |
| 291 | { |
| 292 | if (scheme.isEmpty()) |
| 293 | return false; |
| 294 | return schemesAllowingDatabaseAccessInPrivateBrowsing().contains(scheme); |
| 295 | } |
| 296 | |
cdn@chromium.org | 7696652 | 2012-01-26 23:50:31 +0000 | [diff] [blame] | 297 | void SchemeRegistry::registerURLSchemeAsCORSEnabled(const String& scheme) |
| 298 | { |
| 299 | CORSEnabledSchemes().add(scheme); |
| 300 | } |
| 301 | |
| 302 | bool SchemeRegistry::shouldTreatURLSchemeAsCORSEnabled(const String& scheme) |
| 303 | { |
| 304 | if (scheme.isEmpty()) |
| 305 | return false; |
| 306 | return CORSEnabledSchemes().contains(scheme); |
| 307 | } |
| 308 | |
commit-queue@webkit.org | 828d239 | 2012-06-19 07:27:33 +0000 | [diff] [blame] | 309 | void SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(const String& scheme) |
| 310 | { |
| 311 | ContentSecurityPolicyBypassingSchemes().add(scheme); |
| 312 | } |
| 313 | |
| 314 | void SchemeRegistry::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(const String& scheme) |
| 315 | { |
| 316 | ContentSecurityPolicyBypassingSchemes().remove(scheme); |
| 317 | } |
| 318 | |
| 319 | bool SchemeRegistry::schemeShouldBypassContentSecurityPolicy(const String& scheme) |
| 320 | { |
| 321 | if (scheme.isEmpty()) |
| 322 | return false; |
| 323 | return ContentSecurityPolicyBypassingSchemes().contains(scheme); |
| 324 | } |
| 325 | |
aestes@apple.com | d90a51a | 2013-05-16 02:54:06 +0000 | [diff] [blame] | 326 | bool SchemeRegistry::shouldCacheResponsesFromURLSchemeIndefinitely(const String& scheme) |
| 327 | { |
mitz@apple.com | 1a8d7d3 | 2014-02-07 23:37:54 +0000 | [diff] [blame] | 328 | #if PLATFORM(COCOA) |
aestes@apple.com | d90a51a | 2013-05-16 02:54:06 +0000 | [diff] [blame] | 329 | if (equalIgnoringCase(scheme, "applewebdata")) |
| 330 | return true; |
| 331 | #endif |
aestes@apple.com | 40add75 | 2013-05-16 21:32:31 +0000 | [diff] [blame] | 332 | return equalIgnoringCase(scheme, "data"); |
aestes@apple.com | d90a51a | 2013-05-16 02:54:06 +0000 | [diff] [blame] | 333 | } |
| 334 | |
jpfau@apple.com | 39bf85f | 2014-01-30 23:02:39 +0000 | [diff] [blame] | 335 | #if ENABLE(CACHE_PARTITIONING) |
| 336 | void SchemeRegistry::registerURLSchemeAsCachePartitioned(const String& scheme) |
| 337 | { |
| 338 | cachePartitioningSchemes().add(scheme); |
| 339 | } |
| 340 | |
| 341 | bool SchemeRegistry::shouldPartitionCacheForURLScheme(const String& scheme) |
| 342 | { |
| 343 | if (scheme.isEmpty()) |
| 344 | return false; |
| 345 | return cachePartitioningSchemes().contains(scheme); |
| 346 | } |
| 347 | #endif |
| 348 | |
abarth@webkit.org | 617ecad | 2012-01-06 00:39:16 +0000 | [diff] [blame] | 349 | } // namespace WebCore |