| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"> |
| description('Test getting an exception when calling start() in the Speech JavaScript API'); |
| |
| function run() { |
| // Check availability of constructors. |
| shouldBeTrue("'webkitSpeechRecognition' in self"); |
| shouldBeFalse("webkitSpeechRecognition == null"); |
| |
| doubleStart(); |
| } |
| |
| function doubleStart() { |
| debug('\ndoubleStart():'); |
| evalAndLog("window.r = new webkitSpeechRecognition()"); |
| |
| // Set default handlers. |
| for (var prop in r) { |
| if (prop.match('^on')) { |
| r[prop] = function() { |
| debug('on' + event.type); |
| |
| if (event.type === 'end') { |
| shouldNotThrow("r.start()"); |
| evalAndLog("r.abort()"); |
| |
| r.onend = function() { |
| debug('onend'); |
| finishJSTest(); |
| } |
| } else { |
| shouldThrow("r.start()", '"Error: InvalidStateError: DOM Exception 11"'); |
| } |
| } |
| } |
| } |
| |
| shouldNotThrow("r.start()"); |
| shouldThrow("r.start()", '"Error: InvalidStateError: DOM Exception 11"'); |
| } |
| |
| window.onload = run; |
| window.jsTestIsAsync = true; |
| </script> |
| <script src="../../../resources/js-test-post.js"></script> |
| </body> |
| </html> |
| |