Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Unified Diff: LayoutTests/fast/speech/scripted/speechrecognition-detached-no-crash.html

Issue 960223002: Detach SpeechRecognitionController upon page detach. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Allow controller-detached creation of SpeechRecognition objects Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/speech/scripted/speechrecognition-detached-no-crash.html
diff --git a/LayoutTests/fast/speech/scripted/speechrecognition-detached-no-crash.html b/LayoutTests/fast/speech/scripted/speechrecognition-detached-no-crash.html
new file mode 100644
index 0000000000000000000000000000000000000000..709fb6674b682ff94d0ca34f5517f6a8b210a9e4
--- /dev/null
+++ b/LayoutTests/fast/speech/scripted/speechrecognition-detached-no-crash.html
@@ -0,0 +1,44 @@
+<!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>

Powered by Google App Engine
This is Rietveld 408576698