blob: 709fb6674b682ff94d0ca34f5517f6a8b210a9e4 [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<script>
description("Accessing SpeechRecognition on a detached window should not crash.");
window.jsTestIsAsync = true;
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
testRunner.setCanOpenWindows();
}
var w;
var recognition;
var constructor;
function processMessage(event) {
if (event.data == "opened") {
constructor = w.webkitSpeechRecognition;
recognition = new constructor();
w.close();
} else if (event.data == "closed") {
shouldBeUndefined("recognition.start()");
shouldBeUndefined("recognition.stop()");
shouldBeUndefined("recognition.abort()");
// Create SpeechRecognition for a page-detached window/document.
shouldNotThrow("recognition = new constructor()");
shouldBeUndefined("recognition.start()");
shouldBeUndefined("recognition.stop()");
shouldBeUndefined("recognition.abort()");
finishJSTest();
}
}
w = window.open('../../../resources/window-postmessage-open-close.html');
window.addEventListener("message", processMessage, false);
</script>
</body>
</html>