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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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']; | 52 var invalid_schemes = ['mailto:', 'ssh:/', 'magnet:+', 'tel:sip']; |
53 invalid_schemes.forEach(function (scheme) { | 53 invalid_schemes.forEach(function (scheme) { |
54 var succeeded = false; | 54 var succeeded = false; |
55 try { | 55 try { |
56 window.navigator.unregisterProtocolHandler(scheme, 'invalid scheme uri=%
s', 'title'); | 56 window.navigator.unregisterProtocolHandler(scheme, 'invalid scheme uri=%
s', 'title'); |
57 } catch (e) { | 57 } catch (e) { |
58 succeeded = 'SyntaxError' == e.name; | 58 succeeded = 'SecurityError' == e.name; |
59 errorMessage = e.message; | 59 errorMessage = e.message; |
60 } | 60 } |
61 | 61 |
62 if (succeeded) | 62 if (succeeded) |
63 debug('PASS Invalid scheme "' + scheme + '" falied.'); | 63 debug('PASS Invalid scheme "' + scheme + '" falied.'); |
64 else | 64 else |
65 debug('Fail: Invalid scheme "' + scheme + '" allowed. Threw exception: "
' + errorMessage + '".'); | 65 debug('Fail: Invalid scheme "' + scheme + '" allowed. Threw exception: "
' + errorMessage + '".'); |
66 }); | 66 }); |
67 | 67 |
68 var invalid_urls = ["", "%S"]; | 68 var invalid_urls = ["", "%S"]; |
(...skipping 48 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 |