Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2026)

Unified Diff: Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp

Issue 440833006: Use a consistent scheme name in navigatorcontentutils tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/navigatorcontentutils/unregister-protocol-handler-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
diff --git a/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp b/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
index 78f997f460740a83bfee8c71d53877c4fae8c526..1b86cf25ed48951fe845f704cc3f9ef075c74bcf 100644
--- a/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
+++ b/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
@@ -38,12 +38,12 @@
namespace blink {
-static HashSet<String>* protocolWhitelist;
+static HashSet<String>* schemeWhitelist;
-static void initProtocolHandlerWhitelist()
+static void initCustomSchemeHandlerWhitelist()
{
- protocolWhitelist = new HashSet<String>;
- static const char* const protocols[] = {
+ schemeWhitelist = new HashSet<String>;
+ static const char* const schemes[] = {
"bitcoin",
"geo",
"im",
@@ -64,8 +64,8 @@ static void initProtocolHandlerWhitelist()
"wtai",
"xmpp",
};
- for (size_t i = 0; i < WTF_ARRAY_LENGTH(protocols); ++i)
- protocolWhitelist->add(protocols[i]);
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(schemes); ++i)
+ schemeWhitelist->add(schemes[i]);
}
static bool verifyCustomHandlerURL(const KURL& baseURL, const String& url, ExceptionState& exceptionState)
@@ -94,17 +94,17 @@ static bool verifyCustomHandlerURL(const KURL& baseURL, const String& url, Excep
return true;
}
-static bool isProtocolWhitelisted(const String& scheme)
+static bool isSchemeWhitelisted(const String& scheme)
{
- if (!protocolWhitelist)
- initProtocolHandlerWhitelist();
+ if (!schemeWhitelist)
+ initCustomSchemeHandlerWhitelist();
StringBuilder builder;
unsigned length = scheme.length();
for (unsigned i = 0; i < length; ++i)
builder.append(toASCIILower(scheme[i]));
- return protocolWhitelist->contains(builder.toString());
+ return schemeWhitelist->contains(builder.toString());
}
static bool verifyCustomHandlerScheme(const String& scheme, ExceptionState& exceptionState)
@@ -123,10 +123,10 @@ static bool verifyCustomHandlerScheme(const String& scheme, ExceptionState& exce
return false;
}
- if (isProtocolWhitelisted(scheme))
+ if (isSchemeWhitelisted(scheme))
return true;
- exceptionState.throwSecurityError("The scheme '" + scheme + "' doesn't belong to the protocol whitelist. Please prefix non-whitelisted schemes with the string 'web+'.");
+ exceptionState.throwSecurityError("The scheme '" + scheme + "' doesn't belong to the scheme whitelist. Please prefix non-whitelisted schemes with the string 'web+'.");
return false;
}
« no previous file with comments | « LayoutTests/navigatorcontentutils/unregister-protocol-handler-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698