4 <script src=
"../../../resources/js-test.js"></script>
8 description("Accessing SpeechRecognition on a detached window should not crash.");
10 window
.jsTestIsAsync
= true;
12 if (window
.testRunner
) {
13 testRunner
.dumpAsText();
14 testRunner
.waitUntilDone();
15 testRunner
.setCanOpenWindows();
22 function processMessage(event
) {
23 if (event
.data
== "opened") {
24 constructor = w
.webkitSpeechRecognition
;
25 recognition
= new constructor();
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()");
40 w
= window
.open('../../../resources/window-postmessage-open-close.html');
41 window
.addEventListener("message", processMessage
, false);