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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 else | 47 else |
48 debug('Fail: Valid protocol "' + protocol + '" failed.'); | 48 debug('Fail: Valid protocol "' + protocol + '" failed.'); |
49 }); | 49 }); |
50 | 50 |
51 var invalid_urls = ["", "%S"]; | 51 var invalid_urls = ["", "%S"]; |
52 invalid_urls.forEach(function (url) { | 52 invalid_urls.forEach(function (url) { |
53 var succeeded = false; | 53 var succeeded = false; |
54 try { | 54 try { |
55 window.navigator.unregisterProtocolHandler('web+myprotocol', url, 'title
'); | 55 window.navigator.unregisterProtocolHandler('web+myprotocol', url, 'title
'); |
56 } catch (e) { | 56 } catch (e) { |
57 succeeded = 'SYNTAX_ERR' == e.name; | 57 succeeded = 'SyntaxError' == e.name; |
58 } | 58 } |
59 | 59 |
60 if (succeeded) | 60 if (succeeded) |
61 debug('Pass: Invalid url "' + url + '" threw SYNTAX_ERR exception.'); | 61 debug('Pass: Invalid url "' + url + '" threw SyntaxError exception.'); |
62 else | 62 else |
63 debug('Fail: Invalid url "' + url + '" allowed.'); | 63 debug('Fail: Invalid url "' + url + '" allowed.'); |
64 }); | 64 }); |
65 | 65 |
66 // Test that the API has default no-op implementation. | 66 // Test that the API has default no-op implementation. |
67 var succeeded = true; | 67 var succeeded = true; |
68 try { | 68 try { |
69 window.navigator.unregisterProtocolHandler('web+myprotocol', "%s", "title"); | 69 window.navigator.unregisterProtocolHandler('web+myprotocol', "%s", "title"); |
70 } catch (e) { | 70 } catch (e) { |
71 succeeded = false; | 71 succeeded = false; |
72 } | 72 } |
73 | 73 |
74 if (succeeded) | 74 if (succeeded) |
75 debug('Pass: Valid call succeeded.'); | 75 debug('Pass: Valid call succeeded.'); |
76 else | 76 else |
77 debug('Fail: Invalid call did not succeed.'); | 77 debug('Fail: Invalid call did not succeed.'); |
78 </script> | 78 </script> |
79 </body> | 79 </body> |
80 </html> | 80 </html> |
OLD | NEW |