| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Apple 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 if (scheme == "file") | 118 if (scheme == "file") |
| 119 return; | 119 return; |
| 120 localURLSchemes().remove(scheme); | 120 localURLSchemes().remove(scheme); |
| 121 } | 121 } |
| 122 | 122 |
| 123 const URLSchemesMap& SchemeRegistry::localSchemes() | 123 const URLSchemesMap& SchemeRegistry::localSchemes() |
| 124 { | 124 { |
| 125 return localURLSchemes(); | 125 return localURLSchemes(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 static URLSchemesMap& schemesAllowingLocalStorageAccessInPrivateBrowsing() | |
| 129 { | |
| 130 DEFINE_STATIC_LOCAL(URLSchemesMap, schemesAllowingLocalStorageAccessInPrivat
eBrowsing, ()); | |
| 131 return schemesAllowingLocalStorageAccessInPrivateBrowsing; | |
| 132 } | |
| 133 | |
| 134 static URLSchemesMap& schemesAllowingDatabaseAccessInPrivateBrowsing() | |
| 135 { | |
| 136 DEFINE_STATIC_LOCAL(URLSchemesMap, schemesAllowingDatabaseAccessInPrivateBro
wsing, ()); | |
| 137 return schemesAllowingDatabaseAccessInPrivateBrowsing; | |
| 138 } | |
| 139 | |
| 140 static URLSchemesMap& CORSEnabledSchemes() | 128 static URLSchemesMap& CORSEnabledSchemes() |
| 141 { | 129 { |
| 142 // FIXME: http://bugs.webkit.org/show_bug.cgi?id=77160 | 130 // FIXME: http://bugs.webkit.org/show_bug.cgi?id=77160 |
| 143 DEFINE_STATIC_LOCAL(URLSchemesMap, CORSEnabledSchemes, ()); | 131 DEFINE_STATIC_LOCAL(URLSchemesMap, CORSEnabledSchemes, ()); |
| 144 | 132 |
| 145 if (CORSEnabledSchemes.isEmpty()) { | 133 if (CORSEnabledSchemes.isEmpty()) { |
| 146 CORSEnabledSchemes.add("http"); | 134 CORSEnabledSchemes.add("http"); |
| 147 CORSEnabledSchemes.add("https"); | 135 CORSEnabledSchemes.add("https"); |
| 148 } | 136 } |
| 149 | 137 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 notAllowingJavascriptURLsSchemes().add(scheme); | 234 notAllowingJavascriptURLsSchemes().add(scheme); |
| 247 } | 235 } |
| 248 | 236 |
| 249 bool SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs(const Strin
g& scheme) | 237 bool SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs(const Strin
g& scheme) |
| 250 { | 238 { |
| 251 if (scheme.isEmpty()) | 239 if (scheme.isEmpty()) |
| 252 return false; | 240 return false; |
| 253 return notAllowingJavascriptURLsSchemes().contains(scheme); | 241 return notAllowingJavascriptURLsSchemes().contains(scheme); |
| 254 } | 242 } |
| 255 | 243 |
| 256 void SchemeRegistry::registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrows
ing(const String& scheme) | |
| 257 { | |
| 258 schemesAllowingLocalStorageAccessInPrivateBrowsing().add(scheme); | |
| 259 } | |
| 260 | |
| 261 bool SchemeRegistry::allowsLocalStorageAccessInPrivateBrowsing(const String& sch
eme) | |
| 262 { | |
| 263 if (scheme.isEmpty()) | |
| 264 return false; | |
| 265 return schemesAllowingLocalStorageAccessInPrivateBrowsing().contains(scheme)
; | |
| 266 } | |
| 267 | |
| 268 void SchemeRegistry::registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing(
const String& scheme) | |
| 269 { | |
| 270 schemesAllowingDatabaseAccessInPrivateBrowsing().add(scheme); | |
| 271 } | |
| 272 | |
| 273 bool SchemeRegistry::allowsDatabaseAccessInPrivateBrowsing(const String& scheme) | |
| 274 { | |
| 275 if (scheme.isEmpty()) | |
| 276 return false; | |
| 277 return schemesAllowingDatabaseAccessInPrivateBrowsing().contains(scheme); | |
| 278 } | |
| 279 | |
| 280 void SchemeRegistry::registerURLSchemeAsCORSEnabled(const String& scheme) | 244 void SchemeRegistry::registerURLSchemeAsCORSEnabled(const String& scheme) |
| 281 { | 245 { |
| 282 CORSEnabledSchemes().add(scheme); | 246 CORSEnabledSchemes().add(scheme); |
| 283 } | 247 } |
| 284 | 248 |
| 285 bool SchemeRegistry::shouldTreatURLSchemeAsCORSEnabled(const String& scheme) | 249 bool SchemeRegistry::shouldTreatURLSchemeAsCORSEnabled(const String& scheme) |
| 286 { | 250 { |
| 287 if (scheme.isEmpty()) | 251 if (scheme.isEmpty()) |
| 288 return false; | 252 return false; |
| 289 return CORSEnabledSchemes().contains(scheme); | 253 return CORSEnabledSchemes().contains(scheme); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 300 } | 264 } |
| 301 | 265 |
| 302 bool SchemeRegistry::schemeShouldBypassContentSecurityPolicy(const String& schem
e) | 266 bool SchemeRegistry::schemeShouldBypassContentSecurityPolicy(const String& schem
e) |
| 303 { | 267 { |
| 304 if (scheme.isEmpty()) | 268 if (scheme.isEmpty()) |
| 305 return false; | 269 return false; |
| 306 return ContentSecurityPolicyBypassingSchemes().contains(scheme); | 270 return ContentSecurityPolicyBypassingSchemes().contains(scheme); |
| 307 } | 271 } |
| 308 | 272 |
| 309 } // namespace WebCore | 273 } // namespace WebCore |
| OLD | NEW |