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

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

Issue 349193002: Call isValidProtocol() function first in order to remove duplicated protocol checking in NavigatorC… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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 | « no previous file | 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 9e7be6809d34fedd8bc9ff27eedcd7c969133cf2..b8d4566f9d92df208a7995b034f0ad7f3f251308 100644
--- a/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
+++ b/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
@@ -109,21 +109,17 @@ static bool isProtocolWhitelisted(const String& scheme)
static bool verifyProtocolHandlerScheme(const String& scheme, const String& method, ExceptionState& exceptionState)
{
+ if (!isValidProtocol(scheme)) {
+ exceptionState.throwDOMException(SyntaxError, "The scheme '" + scheme + "' is not valid protocol");
haraken 2014/06/23 13:47:16 Shouldn't this be a SecurityError instead of a DOM
gyuyoung-inactive 2014/06/24 05:09:56 Yes, SecurityError looks proper in this exception.
+ 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.");
haraken 2014/06/23 13:47:16 After this CL, this exception is merged with the S
gyuyoung-inactive 2014/06/24 05:09:56 Yes, I already added a test for this in r175104. I
+ exceptionState.throwSecurityError("The scheme '" + scheme + "' is less than five characters long.");
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698