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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/navigatorcontentutils/unregister-protocol-handler.html

Issue 2378773003: Add version control URI schemes to registerProtocolHandler safelist
Patch Set: Created 4 years, 2 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="/js-test-resources/js-test.js"></script> 3 <script src="/js-test-resources/js-test.js"></script>
4 </head> 4 </head>
5 <body> 5 <body>
6 <p>This test makes sure that navigator.unregisterProtocolHandler throws the prop er exceptions and has no-op default implementation.</p> 6 <p>This test makes sure that navigator.unregisterProtocolHandler throws the prop er 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.internals) 9 if (window.internals)
10 internals.setNavigatorContentUtilsClientMock(document); 10 internals.setNavigatorContentUtilsClientMock(document);
(...skipping 12 matching lines...) Expand all
23 succeeded = 'SecurityError' == e.name; 23 succeeded = 'SecurityError' == e.name;
24 errorMessage = e.message; 24 errorMessage = e.message;
25 } 25 }
26 26
27 if (succeeded) 27 if (succeeded)
28 debug('PASS Invalid scheme "' + scheme + '" threw SecurityError exceptio n: "' + errorMessage + '".'); 28 debug('PASS Invalid scheme "' + scheme + '" threw SecurityError exceptio n: "' + errorMessage + '".');
29 else 29 else
30 debug('FAIL Invalid scheme "' + scheme + '" allowed.'); 30 debug('FAIL Invalid scheme "' + scheme + '" allowed.');
31 }); 31 });
32 32
33 var valid_schemes = ['bitcoin', 'BitcoIn', 'geo', 'im', 'irc', 'Irc', 'ircs', 'm agnet', 'MagneT', 'mailto', 'mms', 'news', 'nntp', 'openpgp4fpr', 'sip', 'sms', 'smsto', 'SmsTo', 'ssh', 'tel', 'urn', 'webcal', 'WebCAL', 'wtai', 'WTAI', 'xmpp ']; 33 var valid_schemes = ['bitcoin', 'BitcoIn', 'geo', 'git', 'git+http', 'git+https' , 'git+ssh', 'im', 'irc', 'Irc', 'ircs', 'magnet', 'MagneT', 'mailto', 'mms', 'n ews', 'nntp', 'openpgp4fpr', 'sip', 'sms', 'smsto', 'SmsTo', 'ssh', 'tel', 'urn' , 'webcal', 'WebCAL', 'wtai', 'WTAI', 'xmpp'];
34 valid_schemes.forEach(function (scheme) { 34 valid_schemes.forEach(function (scheme) {
35 var succeeded = false; 35 var succeeded = false;
36 try { 36 try {
37 window.navigator.unregisterProtocolHandler(scheme, "valid scheme %s", "t itle"); 37 window.navigator.unregisterProtocolHandler(scheme, "valid scheme %s", "t itle");
38 succeeded = true; 38 succeeded = true;
39 } catch (e) { 39 } catch (e) {
40 succeeded = false; 40 succeeded = false;
41 } 41 }
42 42
43 if (succeeded) 43 if (succeeded)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 else if (state == "declined") 129 else if (state == "declined")
130 debug("FAIL window.navigator.isProtocolHandlerRegistered returns 'declin ed' state. Fail to unregister 'bitcoin' scheme."); 130 debug("FAIL window.navigator.isProtocolHandlerRegistered returns 'declin ed' state. Fail to unregister 'bitcoin' scheme.");
131 } catch (e) { 131 } catch (e) {
132 debug('FAIL window.navigator.isProtocolHandlerRegistered call is failed: "' + e.message + '".'); 132 debug('FAIL window.navigator.isProtocolHandlerRegistered call is failed: "' + e.message + '".');
133 } 133 }
134 debug("\n"); 134 debug("\n");
135 135
136 </script> 136 </script>
137 </body> 137 </body>
138 </html> 138 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698