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

Side by Side Diff: LayoutTests/fast/dom/unregister-protocol-handler.html

Issue 18234004: Add new schemes to content utils (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add a trailing Created 7 years, 5 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 <body> 2 <body>
3 <p>This test makes sure that navigator.unregisterProtocolHandler throws the prop er exceptions and has no-op default implementation.</p> 3 <p>This test makes sure that navigator.unregisterProtocolHandler throws the prop er exceptions and has no-op default implementation.</p>
4 <pre id="console"></pre> 4 <pre id="console"></pre>
5 <script> 5 <script>
6 if (window.testRunner) 6 if (window.testRunner)
7 testRunner.dumpAsText(); 7 testRunner.dumpAsText();
8 8
9 function debug(str) 9 function debug(str)
10 { 10 {
11 var c = document.getElementById('console') 11 var c = document.getElementById('console')
12 c.appendChild(document.createTextNode(str + '\n')); 12 c.appendChild(document.createTextNode(str + '\n'));
13 } 13 }
14 14
15 if (window.navigator.unregisterProtocolHandler) 15 if (window.navigator.unregisterProtocolHandler)
16 debug('Pass: window.navigator.unregisterProtocolHandler is defined.'); 16 debug('Pass: window.navigator.unregisterProtocolHandler is defined.');
17 else 17 else
18 debug('Fail: window.navigator.unregisterProtocolHandler is not defined.'); 18 debug('Fail: window.navigator.unregisterProtocolHandler is not defined.');
19 19
20 var invalid_protocols = ['http', 'https', 'file']; 20 var invalid_protocols = ['http', 'https', 'file'];
21 invalid_protocols.forEach(function (protocol) { 21 invalid_protocols.forEach(function (protocol) {
22 var succeeded = false; 22 var succeeded = false;
23 try { 23 try {
24 window.navigator.unregisterProtocolHandler(protocol, "invalid protocol % s", "title"); 24 window.navigator.unregisterProtocolHandler(protocol, "invalid protocol % s", "title");
25 } catch (e) { 25 } catch (e) {
26 succeeded = 'SECURITY_ERR' == e.name; 26 succeeded = 'SecurityError' == e.name;
27 } 27 }
28 28
29 if (succeeded) 29 if (succeeded)
30 debug('Pass: Invalid protocol "' + protocol + '" threw SECURITY_ERR exce ption.'); 30 debug('Pass: Invalid protocol "' + protocol + '" threw SecurityError exc eption.');
31 else 31 else
32 debug('Fail: Invalid protocol "' + protocol + '" allowed.'); 32 debug('Fail: Invalid protocol "' + protocol + '" allowed.');
33 }); 33 });
34 34
35 var valid_protocols = ['bitcoin', 'irc', 'mailto', 'mms', 'news', 'nntp', 'sms', 'smsto', 'tel', 'urn', 'webcal']; 35 var valid_protocols = ['bitcoin', 'irc', 'geo', 'mailto', 'magnet', 'mms', 'news ', 'nntp', 'sip', 'sms', 'smsto', 'ssh', 'tel', 'urn', 'webcal', 'xmpp'];
36 valid_protocols.forEach(function (protocol) { 36 valid_protocols.forEach(function (protocol) {
37 var succeeded = false; 37 var succeeded = false;
38 try { 38 try {
39 window.navigator.unregisterProtocolHandler(protocol, "valid protocol %s" , "title"); 39 window.navigator.unregisterProtocolHandler(protocol, "valid protocol %s" , "title");
40 succeeded = true; 40 succeeded = true;
41 } catch (e) { 41 } catch (e) {
42 succeeded = false; 42 succeeded = false;
43 } 43 }
44 44
45 if (succeeded) 45 if (succeeded)
(...skipping 25 matching lines...) Expand all
71 succeeded = false; 71 succeeded = false;
72 } 72 }
73 73
74 if (succeeded) 74 if (succeeded)
75 debug('Pass: Valid call succeeded.'); 75 debug('Pass: Valid call succeeded.');
76 else 76 else
77 debug('Fail: Invalid call did not succeed.'); 77 debug('Fail: Invalid call did not succeed.');
78 </script> 78 </script>
79 </body> 79 </body>
80 </html> 80 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698