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

Side by Side Diff: Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp

Issue 22985005: The length of scheme is at least five characters even when the scheme has 'web+' prefix (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/dom/unregister-protocol-handler-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, Google Inc. All rights reserved. 2 * Copyright (C) 2011, Google Inc. All rights reserved.
3 * Copyright (C) 2012, Samsung Electronics. All rights reserved. 3 * Copyright (C) 2012, Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 static bool isProtocolWhitelisted(const String& scheme) 99 static bool isProtocolWhitelisted(const String& scheme)
100 { 100 {
101 if (!protocolWhitelist) 101 if (!protocolWhitelist)
102 initProtocolHandlerWhitelist(); 102 initProtocolHandlerWhitelist();
103 return protocolWhitelist->contains(scheme); 103 return protocolWhitelist->contains(scheme);
104 } 104 }
105 105
106 static bool verifyProtocolHandlerScheme(const String& scheme, ExceptionState& es ) 106 static bool verifyProtocolHandlerScheme(const String& scheme, ExceptionState& es )
107 { 107 {
108 if (scheme.startsWith("web+")) { 108 if (scheme.startsWith("web+")) {
109 if (isValidProtocol(scheme)) 109 // The specification requires that the length of scheme is at least five characteres (including 'web+' prefix).
110 if (scheme.length() >= 5 && isValidProtocol(scheme))
110 return true; 111 return true;
111 es.throwDOMException(SecurityError); 112 es.throwDOMException(SecurityError);
112 return false; 113 return false;
113 } 114 }
114 115
115 if (isProtocolWhitelisted(scheme)) 116 if (isProtocolWhitelisted(scheme))
116 return true; 117 return true;
117 es.throwDOMException(SecurityError); 118 es.throwDOMException(SecurityError);
118 return false; 119 return false;
119 } 120 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 217
217 void provideNavigatorContentUtilsTo(Page* page, NavigatorContentUtilsClient* cli ent) 218 void provideNavigatorContentUtilsTo(Page* page, NavigatorContentUtilsClient* cli ent)
218 { 219 {
219 RefCountedSupplement<Page, NavigatorContentUtils>::provideTo(page, Navigator ContentUtils::supplementName(), NavigatorContentUtils::create(client)); 220 RefCountedSupplement<Page, NavigatorContentUtils>::provideTo(page, Navigator ContentUtils::supplementName(), NavigatorContentUtils::create(client));
220 } 221 }
221 222
222 } // namespace WebCore 223 } // namespace WebCore
223 224
224 #endif // ENABLE(NAVIGATOR_CONTENT_UTILS) 225 #endif // ENABLE(NAVIGATOR_CONTENT_UTILS)
225 226
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/unregister-protocol-handler-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698