OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <script> |
| 8 description("Accessing SpeechRecognition on a detached window should not crash."
); |
| 9 |
| 10 window.jsTestIsAsync = true; |
| 11 |
| 12 if (window.testRunner) { |
| 13 testRunner.dumpAsText(); |
| 14 testRunner.waitUntilDone(); |
| 15 testRunner.setCanOpenWindows(); |
| 16 } |
| 17 |
| 18 var w; |
| 19 var recognition; |
| 20 var constructor; |
| 21 |
| 22 function processMessage(event) { |
| 23 if (event.data == "opened") { |
| 24 constructor = w.webkitSpeechRecognition; |
| 25 recognition = new constructor(); |
| 26 w.close(); |
| 27 } else if (event.data == "closed") { |
| 28 shouldBeUndefined("recognition.start()"); |
| 29 shouldBeUndefined("recognition.stop()"); |
| 30 shouldBeUndefined("recognition.abort()"); |
| 31 // Create SpeechRecognition for a page-detached window/document. |
| 32 shouldNotThrow("recognition = new constructor()"); |
| 33 shouldBeUndefined("recognition.start()"); |
| 34 shouldBeUndefined("recognition.stop()"); |
| 35 shouldBeUndefined("recognition.abort()"); |
| 36 finishJSTest(); |
| 37 } |
| 38 } |
| 39 |
| 40 w = window.open('../../../resources/window-postmessage-open-close.html'); |
| 41 window.addEventListener("message", processMessage, false); |
| 42 </script> |
| 43 </body> |
| 44 </html> |
OLD | NEW |