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.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.testRunner) | 9 if (window.testRunner) |
10 testRunner.dumpAsText(); | 10 testRunner.dumpAsText(); |
(...skipping 15 matching lines...) Expand all Loading... |
26 succeeded = 'SecurityError' == e.name; | 26 succeeded = 'SecurityError' == e.name; |
27 errorMessage = e.message; | 27 errorMessage = e.message; |
28 } | 28 } |
29 | 29 |
30 if (succeeded) | 30 if (succeeded) |
31 debug('PASS Invalid protocol "' + protocol + '" threw SecurityError exce
ption: "' + errorMessage + '".'); | 31 debug('PASS Invalid protocol "' + protocol + '" threw SecurityError exce
ption: "' + errorMessage + '".'); |
32 else | 32 else |
33 debug('FAIL Invalid protocol "' + protocol + '" allowed.'); | 33 debug('FAIL Invalid protocol "' + protocol + '" allowed.'); |
34 }); | 34 }); |
35 | 35 |
36 var valid_protocols = ['bitcoin', 'geo', 'im', 'irc', 'ircs', 'magnet', 'mailto'
, 'mms', 'news', 'nntp', 'sip', 'sms', 'smsto', 'ssh', 'tel', 'urn', 'webcal', '
wtai', 'xmpp']; | 36 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']; |
37 valid_protocols.forEach(function (protocol) { | 37 valid_protocols.forEach(function (protocol) { |
38 var succeeded = false; | 38 var succeeded = false; |
39 try { | 39 try { |
40 window.navigator.unregisterProtocolHandler(protocol, "valid protocol %s"
, "title"); | 40 window.navigator.unregisterProtocolHandler(protocol, "valid protocol %s"
, "title"); |
41 succeeded = true; | 41 succeeded = true; |
42 } catch (e) { | 42 } catch (e) { |
43 succeeded = false; | 43 succeeded = false; |
44 } | 44 } |
45 | 45 |
46 if (succeeded) | 46 if (succeeded) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 else if (state == "declined") | 117 else if (state == "declined") |
118 debug("FAIL window.navigator.isProtocolHandlerRegistered returns 'declin
ed' state. Fail to unregister 'bitcoin' protocol."); | 118 debug("FAIL window.navigator.isProtocolHandlerRegistered returns 'declin
ed' state. Fail to unregister 'bitcoin' protocol."); |
119 } catch (e) { | 119 } catch (e) { |
120 debug('FAIL window.navigator.isProtocolHandlerRegistered call is failed: "'
+ e.message + '".'); | 120 debug('FAIL window.navigator.isProtocolHandlerRegistered call is failed: "'
+ e.message + '".'); |
121 } | 121 } |
122 debug("\n"); | 122 debug("\n"); |
123 | 123 |
124 </script> | 124 </script> |
125 </body> | 125 </body> |
126 </html> | 126 </html> |
OLD | NEW |