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

Side by Side Diff: LayoutTests/navigatorcontentutils/register-protocol-handler.html

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 unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../resources/js-test.js"></script> 3 <script src="../resources/js-test.js"></script>
4 </head> 4 </head>
5 <body> 5 <body>
6 <p>This test makes sure that navigator.registerProtocolHandler throws the proper exceptions and has no-op default implementation.</p> 6 <p>This test makes sure that navigator.registerProtocolHandler throws the proper exceptions and has no-op default implementation.</p>
7 <pre id="console"></pre> 7 <pre id="console"></pre>
8 <script> 8 <script>
9 if (window.testRunner) 9 if (window.testRunner)
10 testRunner.dumpAsText(); 10 testRunner.dumpAsText();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 else 49 else
50 debug('FAIL Valid protocol "' + protocol + '" failed.'); 50 debug('FAIL Valid protocol "' + protocol + '" failed.');
51 }); 51 });
52 52
53 var invalid_schemes = ['mailto:', 'ssh:/', 'magnet:+', 'tel:sip']; 53 var invalid_schemes = ['mailto:', 'ssh:/', 'magnet:+', 'tel:sip'];
54 invalid_schemes.forEach(function (scheme) { 54 invalid_schemes.forEach(function (scheme) {
55 var succeeded = false; 55 var succeeded = false;
56 try { 56 try {
57 window.navigator.registerProtocolHandler(scheme, 'invalid scheme uri=%s' , 'title'); 57 window.navigator.registerProtocolHandler(scheme, 'invalid scheme uri=%s' , 'title');
58 } catch (e) { 58 } catch (e) {
59 succeeded = 'SyntaxError' == e.name; 59 succeeded = 'SecurityError' == e.name;
60 errorMessage = e.message; 60 errorMessage = e.message;
61 } 61 }
62 62
63 if (succeeded) 63 if (succeeded)
64 debug('PASS Invalid scheme "' + scheme + '" falied.'); 64 debug('PASS Invalid scheme "' + scheme + '" falied.');
65 else 65 else
66 debug('Fail: Invalid scheme "' + scheme + '" allowed. Threw exception: " ' + errorMessage + '".'); 66 debug('Fail: Invalid scheme "' + scheme + '" allowed. Threw exception: " ' + errorMessage + '".');
67 }); 67 });
68 68
69 var invalid_urls = ["", "%S"]; 69 var invalid_urls = ["", "%S"];
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 else if (state == "declined") 110 else if (state == "declined")
111 debug("FAIL window.navigator.isProtocolHandlerRegistered returns 'declin ed' state. Fail to register 'bitcoin' protocol"); 111 debug("FAIL window.navigator.isProtocolHandlerRegistered returns 'declin ed' state. Fail to register 'bitcoin' protocol");
112 } catch (e) { 112 } catch (e) {
113 debug('FAIL window.navigator.isProtocolHandlerRegistered call is failed: "' + e.message + '".'); 113 debug('FAIL window.navigator.isProtocolHandlerRegistered call is failed: "' + e.message + '".');
114 } 114 }
115 debug("\n"); 115 debug("\n");
116 116
117 </script> 117 </script>
118 </body> 118 </body>
119 </html> 119 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698