Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=650295
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 650295 -- Call abort from inside handlers</title>
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11 <script type="application/javascript" src="head.js"></script>
12 </head>
13 <body>
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=650295">Mozilla Bug 650295</a>
15 <p id="display"></p>
16 <div id="content" style="display: none">
18 </div>
19 <pre id="test">
20 <script type="text/javascript">
21 SimpleTest.waitForExplicitFinish();
23 // Abort inside event handlers, should't get a
24 // result after that
26 var nextEventIdx = 0;
27 var eventsToAbortOn = [
28 "start",
29 "audiostart",
30 "speechstart",
31 "speechend",
32 "audioend"
33 ];
35 function doNextTest() {
36 var nextEvent = eventsToAbortOn[nextEventIdx];
37 var expectedEvents = {
38 "start": null,
39 "audiostart": null,
40 "audioend": null,
41 "end": null
42 };
44 if (nextEventIdx >= eventsToAbortOn.indexOf("speechstart")) {
45 expectedEvents["speechstart"] = null;
46 }
48 if (nextEventIdx >= eventsToAbortOn.indexOf("speechend")) {
49 expectedEvents["speechend"] = null;
50 }
52 info("Aborting on " + nextEvent);
53 expectedEvents[nextEvent] = function(evt, sr) {
54 sr.abort();
55 };
57 nextEventIdx++;
59 performTest({
60 eventsToRequest: ["EVENT_START", "EVENT_AUDIO_DATA"],
61 expectedEvents: expectedEvents,
62 doneFunc: (nextEventIdx < eventsToAbortOn.length) ? doNextTest : SimpleTest.finish,
63 prefs: [["media.webspeech.test.fake_fsm_events", true], ["media.webspeech.test.fake_recognition_service", true]]
64 });
65 }
67 doNextTest();
68 </script>
69 </pre>
70 </body>
71 </html>