This repository was archived by the owner on Jul 9, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
content/media/webspeech/recognition/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ function EventManager(sr) {
4343 "audioend" : "audiostart"
4444 } ;
4545
46+ var isDone = false ;
47+
4648 // AUDIO_DATA events are asynchronous,
4749 // so we queue events requested while they are being
4850 // issued to make them seem synchronous
@@ -59,7 +61,10 @@ function EventManager(sr) {
5961 }
6062
6163 ok ( false , message ) ;
62- if ( self . done ) self . done ( ) ;
64+ if ( self . doneFunc && ! isDone ) {
65+ isDone = true ;
66+ self . doneFunc ( ) ;
67+ }
6368 } ;
6469 } ) ( allEvents [ i ] ) ;
6570 }
@@ -78,8 +83,10 @@ function EventManager(sr) {
7883 }
7984
8085 cb && cb ( evt , sr ) ;
81- if ( self . done && nEventsExpected === self . eventsReceived . length ) {
82- self . done ( ) ;
86+ if ( self . doneFunc && ! isDone &&
87+ nEventsExpected === self . eventsReceived . length ) {
88+ isDone = true ;
89+ self . doneFunc ( ) ;
8390 }
8491 }
8592 }
@@ -150,7 +157,7 @@ function performTest(options) {
150157 em . expect ( eventName , cb ) ;
151158 }
152159
153- em . done = function ( ) {
160+ em . doneFunc = function ( ) {
154161 em . requestTestEnd ( ) ;
155162 options . doneFunc ( ) ;
156163 }
You can’t perform that action at this time.
0 commit comments