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

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

Issue 298273008: Improve scheme validation check in NavigatorContentUtils (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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/fast/dom/navigatorcontentutils/unregister-protocol-handler.html ('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 b0384923791a4bd42c6956d96f9ef662d7b9a0c8..b536c23b2e08a8e872464deefd1930c3d1b1d82c 100644
--- a/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
+++ b/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
@@ -113,6 +113,13 @@ static bool verifyProtocolHandlerScheme(const String& scheme, const String& meth
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.");
+ 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+'.");
« no previous file with comments | « LayoutTests/fast/dom/navigatorcontentutils/unregister-protocol-handler.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698