summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/SchemeRegistry.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-13 16:23:25 +0100
committerBen Murdoch <benm@google.com>2011-05-16 11:35:02 +0100
commit65f03d4f644ce73618e5f4f50dd694b26f55ae12 (patch)
treef478babb801e720de7bfaee23443ffe029f58731 /Source/WebCore/platform/SchemeRegistry.cpp
parent47de4a2fb7262c7ebdb9cd133ad2c54c187454d0 (diff)
downloadexternal_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.zip
external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.gz
external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.bz2
Merge WebKit at r75993: Initial merge by git.
Change-Id: I602bbdc3974787a3b0450456a30a7868286921c3
Diffstat (limited to 'Source/WebCore/platform/SchemeRegistry.cpp')
-rw-r--r--Source/WebCore/platform/SchemeRegistry.cpp57
1 files changed, 21 insertions, 36 deletions
diff --git a/Source/WebCore/platform/SchemeRegistry.cpp b/Source/WebCore/platform/SchemeRegistry.cpp
index 58df51a..71697cb 100644
--- a/Source/WebCore/platform/SchemeRegistry.cpp
+++ b/Source/WebCore/platform/SchemeRegistry.cpp
@@ -45,6 +45,12 @@ static URLSchemesMap& localURLSchemes()
return localSchemes;
}
+static URLSchemesMap& displayIsolatedURLSchemes()
+{
+ DEFINE_STATIC_LOCAL(URLSchemesMap, displayIsolatedSchemes, ());
+ return displayIsolatedSchemes;
+}
+
static URLSchemesMap& secureSchemes()
{
DEFINE_STATIC_LOCAL(URLSchemesMap, secureSchemes, ());
@@ -82,7 +88,7 @@ static URLSchemesMap& emptyDocumentSchemes()
void SchemeRegistry::registerURLSchemeAsLocal(const String& scheme)
{
- WebCore::localURLSchemes().add(scheme);
+ localURLSchemes().add(scheme);
}
void SchemeRegistry::removeURLSchemeRegisteredAsLocal(const String& scheme)
@@ -93,50 +99,19 @@ void SchemeRegistry::removeURLSchemeRegisteredAsLocal(const String& scheme)
if (scheme == "applewebdata")
return;
#endif
- WebCore::localURLSchemes().remove(scheme);
-}
-
-const URLSchemesMap& SchemeRegistry::localURLSchemes()
-{
- return WebCore::localURLSchemes();
+ localURLSchemes().remove(scheme);
}
-bool SchemeRegistry::shouldTreatURLAsLocal(const String& url)
+const URLSchemesMap& SchemeRegistry::localSchemes()
{
- // This avoids an allocation of another String and the HashSet contains()
- // call for the file: and http: schemes.
- if (url.length() >= 5) {
- const UChar* s = url.characters();
- if (s[0] == 'h' && s[1] == 't' && s[2] == 't' && s[3] == 'p' && s[4] == ':')
- return false;
- if (s[0] == 'f' && s[1] == 'i' && s[2] == 'l' && s[3] == 'e' && s[4] == ':')
- return true;
- }
-
- size_t loc = url.find(':');
- if (loc == notFound)
- return false;
-
- String scheme = url.left(loc);
- return WebCore::localURLSchemes().contains(scheme);
+ return localURLSchemes();
}
bool SchemeRegistry::shouldTreatURLSchemeAsLocal(const String& scheme)
{
- // This avoids an allocation of another String and the HashSet contains()
- // call for the file: and http: schemes.
- if (scheme.length() == 4) {
- const UChar* s = scheme.characters();
- if (s[0] == 'h' && s[1] == 't' && s[2] == 't' && s[3] == 'p')
- return false;
- if (s[0] == 'f' && s[1] == 'i' && s[2] == 'l' && s[3] == 'e')
- return true;
- }
-
if (scheme.isEmpty())
return false;
-
- return WebCore::localURLSchemes().contains(scheme);
+ return localURLSchemes().contains(scheme);
}
void SchemeRegistry::registerURLSchemeAsNoAccess(const String& scheme)
@@ -149,6 +124,16 @@ bool SchemeRegistry::shouldTreatURLSchemeAsNoAccess(const String& scheme)
return schemesWithUniqueOrigins().contains(scheme);
}
+void SchemeRegistry::registerURLSchemeAsDisplayIsolated(const String& scheme)
+{
+ displayIsolatedURLSchemes().add(scheme);
+}
+
+bool SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated(const String& scheme)
+{
+ return displayIsolatedURLSchemes().contains(scheme);
+}
+
void SchemeRegistry::registerURLSchemeAsSecure(const String& scheme)
{
secureSchemes().add(scheme);