Scheme of content utils should be compared in an ASCII case-insensitive manner

Scheme has been compared in case-sensitive manner. However, according to spec, scheme must be compared in an ASCII case-insensitive manner by user agents.

Merge from WebKit : http://trac.webkit.org/changeset/169670

BUG=none

Review URL: https://codereview.chromium.org/323493003

git-svn-id: svn://svn.chromium.org/blink/trunk@175771 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 4b8f10fc
...@@ -6,11 +6,14 @@ PASS Invalid protocol "https" threw SecurityError exception: "Failed to execute ...@@ -6,11 +6,14 @@ PASS Invalid protocol "https" threw SecurityError exception: "Failed to execute
PASS Invalid protocol "file" threw SecurityError exception: "Failed to execute 'registerProtocolHandler' on 'Navigator': The scheme 'file' doesn't belong to the protocol whitelist. Please prefix non-whitelisted schemes with the string 'web+'.". PASS Invalid protocol "file" threw SecurityError exception: "Failed to execute 'registerProtocolHandler' on 'Navigator': The scheme 'file' doesn't belong to the protocol whitelist. Please prefix non-whitelisted schemes with the string 'web+'.".
PASS Invalid protocol "web+" threw SecurityError exception: "Failed to execute 'registerProtocolHandler' on 'Navigator': The scheme 'web+' is less than five characters long.". PASS Invalid protocol "web+" threw SecurityError exception: "Failed to execute 'registerProtocolHandler' on 'Navigator': The scheme 'web+' is less than five characters long.".
PASS Valid protocol "bitcoin" allowed. PASS Valid protocol "bitcoin" allowed.
PASS Valid protocol "BitcoIn" allowed.
PASS Valid protocol "geo" allowed. PASS Valid protocol "geo" allowed.
PASS Valid protocol "im" allowed. PASS Valid protocol "im" allowed.
PASS Valid protocol "irc" allowed. PASS Valid protocol "irc" allowed.
PASS Valid protocol "Irc" allowed.
PASS Valid protocol "ircs" allowed. PASS Valid protocol "ircs" allowed.
PASS Valid protocol "magnet" allowed. PASS Valid protocol "magnet" allowed.
PASS Valid protocol "MagneT" allowed.
PASS Valid protocol "mailto" allowed. PASS Valid protocol "mailto" allowed.
PASS Valid protocol "mms" allowed. PASS Valid protocol "mms" allowed.
PASS Valid protocol "news" allowed. PASS Valid protocol "news" allowed.
...@@ -18,11 +21,14 @@ PASS Valid protocol "nntp" allowed. ...@@ -18,11 +21,14 @@ PASS Valid protocol "nntp" allowed.
PASS Valid protocol "sip" allowed. PASS Valid protocol "sip" allowed.
PASS Valid protocol "sms" allowed. PASS Valid protocol "sms" allowed.
PASS Valid protocol "smsto" allowed. PASS Valid protocol "smsto" allowed.
PASS Valid protocol "SmsTo" allowed.
PASS Valid protocol "ssh" allowed. PASS Valid protocol "ssh" allowed.
PASS Valid protocol "tel" allowed. PASS Valid protocol "tel" allowed.
PASS Valid protocol "urn" allowed. PASS Valid protocol "urn" allowed.
PASS Valid protocol "webcal" allowed. PASS Valid protocol "webcal" allowed.
PASS Valid protocol "WebCAL" allowed.
PASS Valid protocol "wtai" allowed. PASS Valid protocol "wtai" allowed.
PASS Valid protocol "WTAI" allowed.
PASS Valid protocol "xmpp" allowed. PASS Valid protocol "xmpp" allowed.
PASS Invalid scheme "mailto:" falied. PASS Invalid scheme "mailto:" falied.
PASS Invalid scheme "ssh:/" falied. PASS Invalid scheme "ssh:/" falied.
......
...@@ -34,7 +34,7 @@ invalid_protocols.forEach(function (protocol) { ...@@ -34,7 +34,7 @@ invalid_protocols.forEach(function (protocol) {
debug('FAIL Invalid protocol "' + protocol + '" allowed.'); debug('FAIL Invalid protocol "' + protocol + '" allowed.');
}); });
var valid_protocols = ['bitcoin', 'geo', 'im', 'irc', 'ircs', 'magnet', 'mailto', 'mms', 'news', 'nntp', 'sip', 'sms', 'smsto', 'ssh', 'tel', 'urn', 'webcal', 'wtai', 'xmpp']; var valid_protocols = ['bitcoin', 'BitcoIn', 'geo', 'im', 'irc', 'Irc', 'ircs', 'magnet', 'MagneT', 'mailto', 'mms', 'news', 'nntp', 'sip', 'sms', 'smsto', 'SmsTo', 'ssh', 'tel', 'urn', 'webcal', 'WebCAL', 'wtai', 'WTAI', 'xmpp'];
valid_protocols.forEach(function (protocol) { valid_protocols.forEach(function (protocol) {
var succeeded = false; var succeeded = false;
try { try {
......
...@@ -6,11 +6,14 @@ PASS Invalid protocol "https" threw SecurityError exception: "Failed to execute ...@@ -6,11 +6,14 @@ PASS Invalid protocol "https" threw SecurityError exception: "Failed to execute
PASS Invalid protocol "file" threw SecurityError exception: "Failed to execute 'unregisterProtocolHandler' on 'Navigator': The scheme 'file' doesn't belong to the protocol whitelist. Please prefix non-whitelisted schemes with the string 'web+'.". PASS Invalid protocol "file" threw SecurityError exception: "Failed to execute 'unregisterProtocolHandler' on 'Navigator': The scheme 'file' doesn't belong to the protocol whitelist. Please prefix non-whitelisted schemes with the string 'web+'.".
PASS Invalid protocol "web+" threw SecurityError exception: "Failed to execute 'unregisterProtocolHandler' on 'Navigator': The scheme 'web+' is less than five characters long.". PASS Invalid protocol "web+" threw SecurityError exception: "Failed to execute 'unregisterProtocolHandler' on 'Navigator': The scheme 'web+' is less than five characters long.".
PASS Valid protocol "bitcoin" allowed. PASS Valid protocol "bitcoin" allowed.
PASS Valid protocol "BitcoIn" allowed.
PASS Valid protocol "geo" allowed. PASS Valid protocol "geo" allowed.
PASS Valid protocol "im" allowed. PASS Valid protocol "im" allowed.
PASS Valid protocol "irc" allowed. PASS Valid protocol "irc" allowed.
PASS Valid protocol "Irc" allowed.
PASS Valid protocol "ircs" allowed. PASS Valid protocol "ircs" allowed.
PASS Valid protocol "magnet" allowed. PASS Valid protocol "magnet" allowed.
PASS Valid protocol "MagneT" allowed.
PASS Valid protocol "mailto" allowed. PASS Valid protocol "mailto" allowed.
PASS Valid protocol "mms" allowed. PASS Valid protocol "mms" allowed.
PASS Valid protocol "news" allowed. PASS Valid protocol "news" allowed.
...@@ -18,11 +21,14 @@ PASS Valid protocol "nntp" allowed. ...@@ -18,11 +21,14 @@ PASS Valid protocol "nntp" allowed.
PASS Valid protocol "sip" allowed. PASS Valid protocol "sip" allowed.
PASS Valid protocol "sms" allowed. PASS Valid protocol "sms" allowed.
PASS Valid protocol "smsto" allowed. PASS Valid protocol "smsto" allowed.
PASS Valid protocol "SmsTo" allowed.
PASS Valid protocol "ssh" allowed. PASS Valid protocol "ssh" allowed.
PASS Valid protocol "tel" allowed. PASS Valid protocol "tel" allowed.
PASS Valid protocol "urn" allowed. PASS Valid protocol "urn" allowed.
PASS Valid protocol "webcal" allowed. PASS Valid protocol "webcal" allowed.
PASS Valid protocol "WebCAL" allowed.
PASS Valid protocol "wtai" allowed. PASS Valid protocol "wtai" allowed.
PASS Valid protocol "WTAI" allowed.
PASS Valid protocol "xmpp" allowed. PASS Valid protocol "xmpp" allowed.
PASS Invalid scheme "mailto:" falied. PASS Invalid scheme "mailto:" falied.
PASS Invalid scheme "ssh:/" falied. PASS Invalid scheme "ssh:/" falied.
......
...@@ -33,7 +33,7 @@ invalid_protocols.forEach(function (protocol) { ...@@ -33,7 +33,7 @@ invalid_protocols.forEach(function (protocol) {
debug('FAIL Invalid protocol "' + protocol + '" allowed.'); debug('FAIL Invalid protocol "' + protocol + '" allowed.');
}); });
var valid_protocols = ['bitcoin', 'geo', 'im', 'irc', 'ircs', 'magnet', 'mailto', 'mms', 'news', 'nntp', 'sip', 'sms', 'smsto', 'ssh', 'tel', 'urn', 'webcal', 'wtai', 'xmpp']; var valid_protocols = ['bitcoin', 'BitcoIn', 'geo', 'im', 'irc', 'Irc', 'ircs', 'magnet', 'MagneT', 'mailto', 'mms', 'news', 'nntp', 'sip', 'sms', 'smsto', 'SmsTo', 'ssh', 'tel', 'urn', 'webcal', 'WebCAL', 'wtai', 'WTAI', 'xmpp'];
valid_protocols.forEach(function (protocol) { valid_protocols.forEach(function (protocol) {
var succeeded = false; var succeeded = false;
try { try {
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "core/frame/Navigator.h" #include "core/frame/Navigator.h"
#include "core/page/Page.h" #include "core/page/Page.h"
#include "wtf/HashSet.h" #include "wtf/HashSet.h"
#include "wtf/text/StringBuilder.h"
namespace WebCore { namespace WebCore {
...@@ -97,7 +98,13 @@ static bool isProtocolWhitelisted(const String& scheme) ...@@ -97,7 +98,13 @@ static bool isProtocolWhitelisted(const String& scheme)
{ {
if (!protocolWhitelist) if (!protocolWhitelist)
initProtocolHandlerWhitelist(); initProtocolHandlerWhitelist();
return protocolWhitelist->contains(scheme);
StringBuilder builder;
unsigned length = scheme.length();
for (unsigned i = 0; i < length; ++i)
builder.append(toASCIILower(scheme[i]));
return protocolWhitelist->contains(builder.toString());
} }
static bool verifyProtocolHandlerScheme(const String& scheme, const String& method, ExceptionState& exceptionState) static bool verifyProtocolHandlerScheme(const String& scheme, const String& method, ExceptionState& exceptionState)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment