OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <p>This test makes sure that navigator.isProtocolHandlerRegistered throws the pr
oper exceptions and returns the default state of handler.</p> |
| 8 <pre id="console"></pre> |
| 9 <script> |
| 10 if (window.testRunner) |
| 11 testRunner.dumpAsText(); |
| 12 |
| 13 if (window.navigator.isProtocolHandlerRegistered) |
| 14 debug('PASS window.navigator.isProtocolHandlerRegistered is defined.'); |
| 15 else |
| 16 debug('FAIL window.navigator.isProtocolHandlerRegistered is not defined.'); |
| 17 |
| 18 var invalidUrl = "%S"; |
| 19 var succeeded = false; |
| 20 try { |
| 21 window.navigator.isProtocolHandlerRegistered(protocol, invalidUrl); |
| 22 succeeded = false; |
| 23 } catch (e) { |
| 24 succeeded = true; |
| 25 } |
| 26 if (succeeded) |
| 27 debug('PASS Invalid url "' + invalidUrl + '" threw SyntaxError exception.'); |
| 28 else |
| 29 debug('FAIL Invalid url "' + invalidUrl + '" allowed.'); |
| 30 |
| 31 // FIXME: Need to check if this function can return 'registered' and 'declined'
states as well. |
| 32 try { |
| 33 var state = window.navigator.isProtocolHandlerRegistered("bitcoin", "valid p
rotocol %s"); |
| 34 if (state == "new") |
| 35 debug('PASS window.navigator.isProtocolHandlerRegistered returns "new" s
tate'); |
| 36 else |
| 37 debug("FAIL window.navigator.isProtocolHandlerRegistered doesn't return
the default state."); |
| 38 } catch (e) { |
| 39 debug('FAIL window.navigator.isProtocolHandlerRegistered call is failed: "'
+ e.message + '".'); |
| 40 } |
| 41 </script> |
| 42 </body> |
| 43 </html> |
OLD | NEW |