| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <p>This test makes sure that navigator.isProtocolHandlerRegistered throws the pr
oper exceptions and returns the default state of handler.</p> | 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> | 8 <pre id="console"></pre> |
| 9 <script> | 9 <script> |
| 10 if (window.testRunner) | 10 if (window.testRunner) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 debug('PASS Invalid url "' + invalidUrl + '" threw SyntaxError exception.'); | 30 debug('PASS Invalid url "' + invalidUrl + '" threw SyntaxError exception.'); |
| 31 else | 31 else |
| 32 debug('FAIL Invalid url "' + invalidUrl + '" allowed.'); | 32 debug('FAIL Invalid url "' + invalidUrl + '" allowed.'); |
| 33 | 33 |
| 34 var invalid_schemes = ['mailto:', 'ssh:/', 'magnet:+', 'tel:sip']; | 34 var invalid_schemes = ['mailto:', 'ssh:/', 'magnet:+', 'tel:sip']; |
| 35 invalid_schemes.forEach(function (scheme) { | 35 invalid_schemes.forEach(function (scheme) { |
| 36 var succeeded = false; | 36 var succeeded = false; |
| 37 try { | 37 try { |
| 38 window.navigator.isProtocolHandlerRegistered(scheme, 'invalid scheme uri
=%s'); | 38 window.navigator.isProtocolHandlerRegistered(scheme, 'invalid scheme uri
=%s'); |
| 39 } catch (e) { | 39 } catch (e) { |
| 40 succeeded = 'SyntaxError' == e.name; | 40 succeeded = 'SecurityError' == e.name; |
| 41 errorMessage = e.message; | 41 errorMessage = e.message; |
| 42 } | 42 } |
| 43 | 43 |
| 44 if (succeeded) | 44 if (succeeded) |
| 45 debug('PASS Invalid scheme "' + scheme + '" falied.'); | 45 debug('PASS Invalid scheme "' + scheme + '" falied.'); |
| 46 else | 46 else |
| 47 debug('FAIL Invalid scheme "' + scheme + '" allowed. Threw exception: "'
+ errorMessage + '".'); | 47 debug('FAIL Invalid scheme "' + scheme + '" allowed. Threw exception: "'
+ errorMessage + '".'); |
| 48 }); | 48 }); |
| 49 | 49 |
| 50 debug("\nCheck if isProtocolHandlerRegistered() works correctly. If isProtocolHa
ndlerRegistered() returns 'new' state, it works well."); | 50 debug("\nCheck if isProtocolHandlerRegistered() works correctly. If isProtocolHa
ndlerRegistered() returns 'new' state, it works well."); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 61 else if (state == "declined") | 61 else if (state == "declined") |
| 62 debug("FAIL window.navigator.isProtocolHandlerRegistered returns 'declin
ed' state."); | 62 debug("FAIL window.navigator.isProtocolHandlerRegistered returns 'declin
ed' state."); |
| 63 } catch (e) { | 63 } catch (e) { |
| 64 debug('FAIL window.navigator.isProtocolHandlerRegistered call is failed: "'
+ e.message + '".'); | 64 debug('FAIL window.navigator.isProtocolHandlerRegistered call is failed: "'
+ e.message + '".'); |
| 65 } | 65 } |
| 66 debug("\n"); | 66 debug("\n"); |
| 67 | 67 |
| 68 </script> | 68 </script> |
| 69 </body> | 69 </body> |
| 70 </html> | 70 </html> |
| OLD | NEW |