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