OLD | NEW |
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 16 matching lines...) Expand all Loading... |
27 succeeded = 'SecurityError' == e.name; | 27 succeeded = 'SecurityError' == e.name; |
28 errorMessage = e.message; | 28 errorMessage = e.message; |
29 } | 29 } |
30 | 30 |
31 if (succeeded) { | 31 if (succeeded) { |
32 debug('PASS Invalid protocol "' + protocol + '" threw SecurityError exce
ption: "' + errorMessage + '".'); | 32 debug('PASS Invalid protocol "' + protocol + '" threw SecurityError exce
ption: "' + errorMessage + '".'); |
33 }else | 33 }else |
34 debug('FAIL Invalid protocol "' + protocol + '" allowed.'); | 34 debug('FAIL Invalid protocol "' + protocol + '" allowed.'); |
35 }); | 35 }); |
36 | 36 |
37 var valid_protocols = ['bitcoin', 'geo', 'im', 'irc', 'ircs', 'magnet', 'mailto'
, 'mms', 'news', 'nntp', 'sip', 'sms', 'smsto', 'ssh', 'tel', 'urn', 'webcal', '
wtai', 'xmpp']; | 37 var valid_protocols = ['bitcoin', 'BitcoIn', 'geo', 'im', 'irc', 'Irc', 'ircs',
'magnet', 'MagneT', 'mailto', 'mms', 'news', 'nntp', 'sip', 'sms', 'smsto', 'Sms
To', 'ssh', 'tel', 'urn', 'webcal', 'WebCAL', 'wtai', 'WTAI', 'xmpp']; |
38 valid_protocols.forEach(function (protocol) { | 38 valid_protocols.forEach(function (protocol) { |
39 var succeeded = false; | 39 var succeeded = false; |
40 try { | 40 try { |
41 window.navigator.registerProtocolHandler(protocol, "valid protocol %s",
"title"); | 41 window.navigator.registerProtocolHandler(protocol, "valid protocol %s",
"title"); |
42 succeeded = true; | 42 succeeded = true; |
43 } catch (e) { | 43 } catch (e) { |
44 succeeded = false; | 44 succeeded = false; |
45 } | 45 } |
46 | 46 |
47 if (succeeded) | 47 if (succeeded) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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> |
OLD | NEW |