Bug 1032878 - Fix for test_call_start_from_end_handler.html. r=slin
☠☠ backed out by 8db38d415e20 ☠ ☠
authorMartijn Wargers <mwargers@mozilla.com>
Sun, 10 Aug 2014 20:14:03 -0700
changeset 198968 0cfcc44660a87f43b0632e884674c5fa51c111a7
parent 198967 991f8d5da382b1710952675f8a5793e588982d1d
child 198969 780c948d79f3ddc9a6910e08e477e13f6db23ffe
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersslin
bugs1032878
milestone34.0a1
Bug 1032878 - Fix for test_call_start_from_end_handler.html. r=slin
content/media/webspeech/recognition/test/test_call_start_from_end_handler.html
--- a/content/media/webspeech/recognition/test/test_call_start_from_end_handler.html
+++ b/content/media/webspeech/recognition/test/test_call_start_from_end_handler.html
@@ -15,18 +15,19 @@ https://bugzilla.mozilla.org/show_bug.cg
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script type="text/javascript">
   SimpleTest.waitForExplicitFinish();
 
+  var audioTag;
   function createAudioStream() {
-    var audioTag = document.createElement("audio");
+    audioTag = document.createElement("audio");
     audioTag.src = DEFAULT_AUDIO_SAMPLE_FILE;
 
     var stream = audioTag.mozCaptureStreamUntilEnded();
     audioTag.play();
 
     return stream;
   }
 
@@ -59,16 +60,21 @@ https://bugzilla.mozilla.org/show_bug.cg
       'start': expectExceptionHandler,
       'audiostart': expectExceptionHandler,
       'speechstart': expectExceptionHandler,
       'speechend': expectExceptionHandler,
       'audioend': expectExceptionHandler,
       'result': buildResultCallback("Mock final result"),
       'end': endHandler,
     },
-    doneFunc: SimpleTest.finish,
+    doneFunc: function() {
+      //Pause the audio element, before unloading the document, otherwise
+      //it will cause more results to fire after SimpleTest.finish
+      audioTag.pause();
+      SimpleTest.finish();
+    },
     prefs: [["media.webspeech.test.fake_fsm_events", true], ["media.webspeech.test.fake_recognition_service", true]]
   });
 
 </script>
 </pre>
 </body>
 </html>