Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / speech / scripted / speechrecognition-detached-no-crash.html
blob709fb6674b682ff94d0ca34f5517f6a8b210a9e4
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.");
10 window.jsTestIsAsync = true;
12 if (window.testRunner) {
13 testRunner.dumpAsText();
14 testRunner.waitUntilDone();
15 testRunner.setCanOpenWindows();
18 var w;
19 var recognition;
20 var constructor;
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();
40 w = window.open('../../../resources/window-postmessage-open-close.html');
41 window.addEventListener("message", processMessage, false);
42 </script>
43 </body>
44 </html>