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

Unified Diff: LayoutTests/fast/dom/navigatorcontentutils/unregister-protocol-handler.html

Issue 292203007: Need to check invalid scheme in navigator content utils (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
Index: LayoutTests/fast/dom/navigatorcontentutils/unregister-protocol-handler.html
diff --git a/LayoutTests/fast/dom/navigatorcontentutils/unregister-protocol-handler.html b/LayoutTests/fast/dom/navigatorcontentutils/unregister-protocol-handler.html
index 301cf59fca7b3ceee19279be6d07351f3b5ad745..c56a2d6eeebaea225cbccb6e5b1310ce97543e2e 100644
--- a/LayoutTests/fast/dom/navigatorcontentutils/unregister-protocol-handler.html
+++ b/LayoutTests/fast/dom/navigatorcontentutils/unregister-protocol-handler.html
@@ -49,6 +49,21 @@ valid_protocols.forEach(function (protocol) {
debug('Fail: Valid protocol "' + protocol + '" failed.');
});
+var invalid_schemes = ['mailto:', 'ssh:/', 'magnet:+', 'tel:sip'];
+invalid_schemes.forEach(function (scheme) {
+ var succeeded = false;
+ try {
+ window.navigator.registerProtocolHandler(scheme, 'invalid scheme uri=%s', 'title');
+ } catch (e) {
+ succeeded = true;
+ }
+
+ if (succeeded)
+ debug('Pass: Invalid scheme "' + scheme + '" falied.');
+ else
+ debug('Fail: Invalid scheme "' + scheme + '" allowed.');
+});
+
var invalid_urls = ["", "%S"];
invalid_urls.forEach(function (url) {
var succeeded = false;

Powered by Google App Engine
This is Rietveld 408576698