| OLD | NEW |
| 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 { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } catch (e) { | 42 } catch (e) { |
| 43 succeeded = false; | 43 succeeded = false; |
| 44 } | 44 } |
| 45 | 45 |
| 46 if (succeeded) | 46 if (succeeded) |
| 47 debug('Pass: Valid protocol "' + protocol + '" allowed.'); | 47 debug('Pass: Valid protocol "' + protocol + '" allowed.'); |
| 48 else | 48 else |
| 49 debug('Fail: Valid protocol "' + protocol + '" failed.'); | 49 debug('Fail: Valid protocol "' + protocol + '" failed.'); |
| 50 }); | 50 }); |
| 51 | 51 |
| 52 var invalid_schemes = ['mailto:', 'ssh:/', 'magnet:+', 'tel:sip']; |
| 53 invalid_schemes.forEach(function (scheme) { |
| 54 var succeeded = false; |
| 55 try { |
| 56 window.navigator.registerProtocolHandler(scheme, 'invalid scheme uri=%s'
, 'title'); |
| 57 } catch (e) { |
| 58 succeeded = true; |
| 59 } |
| 60 |
| 61 if (succeeded) |
| 62 debug('Pass: Invalid scheme "' + scheme + '" falied.'); |
| 63 else |
| 64 debug('Fail: Invalid scheme "' + scheme + '" allowed.'); |
| 65 }); |
| 66 |
| 52 var invalid_urls = ["", "%S"]; | 67 var invalid_urls = ["", "%S"]; |
| 53 invalid_urls.forEach(function (url) { | 68 invalid_urls.forEach(function (url) { |
| 54 var succeeded = false; | 69 var succeeded = false; |
| 55 try { | 70 try { |
| 56 window.navigator.unregisterProtocolHandler('web+myprotocol', url, 'title
'); | 71 window.navigator.unregisterProtocolHandler('web+myprotocol', url, 'title
'); |
| 57 } catch (e) { | 72 } catch (e) { |
| 58 succeeded = 'SyntaxError' == e.name; | 73 succeeded = 'SyntaxError' == e.name; |
| 59 errorMessage = e.message; | 74 errorMessage = e.message; |
| 60 } | 75 } |
| 61 | 76 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 73 succeeded = false; | 88 succeeded = false; |
| 74 } | 89 } |
| 75 | 90 |
| 76 if (succeeded) | 91 if (succeeded) |
| 77 debug('Pass: Valid call succeeded.'); | 92 debug('Pass: Valid call succeeded.'); |
| 78 else | 93 else |
| 79 debug('Fail: Invalid call did not succeed.'); | 94 debug('Fail: Invalid call did not succeed.'); |
| 80 </script> | 95 </script> |
| 81 </body> | 96 </body> |
| 82 </html> | 97 </html> |
| OLD | NEW |