Index: Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp |
diff --git a/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp b/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp |
index 9e7be6809d34fedd8bc9ff27eedcd7c969133cf2..fd82c34827ec94a8132f4f296d3c02f3278455e9 100644 |
--- a/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp |
+++ b/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp |
@@ -109,26 +109,23 @@ static bool isProtocolWhitelisted(const String& scheme) |
static bool verifyProtocolHandlerScheme(const String& scheme, const String& method, ExceptionState& exceptionState) |
{ |
+ if (!isValidProtocol(scheme)) { |
+ exceptionState.throwSecurityError("The scheme '" + scheme + "' is not valid protocol"); |
+ return false; |
+ } |
+ |
if (scheme.startsWith("web+")) { |
// The specification requires that the length of scheme is at least five characteres (including 'web+' prefix). |
- if (scheme.length() >= 5 && isValidProtocol(scheme)) |
+ if (scheme.length() >= 5) |
return true; |
- if (!isValidProtocol(scheme)) |
- exceptionState.throwSecurityError("The scheme '" + scheme + "' is not a valid protocol."); |
- else |
- exceptionState.throwSecurityError("The scheme '" + scheme + "' is less than five characters long."); |
- return false; |
- } |
- // The specification requires that schemes don't contain colons. |
- size_t index = scheme.find(':'); |
- if (index != kNotFound) { |
- exceptionState.throwDOMException(SyntaxError, "The scheme '" + scheme + "' contains colon."); |
+ exceptionState.throwSecurityError("The scheme '" + scheme + "' is less than five characters long."); |
return false; |
} |
if (isProtocolWhitelisted(scheme)) |
return true; |
+ |
exceptionState.throwSecurityError("The scheme '" + scheme + "' doesn't belong to the protocol whitelist. Please prefix non-whitelisted schemes with the string 'web+'."); |
return false; |
} |