tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SpeechSynthesis-speak-twice.html (917B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="/resources/testdriver.js"></script>
      5 <script src="/resources/testdriver-vendor.js"></script>
      6 <body>
      7 <script>
      8 // using an utterance twice on the same SpeechSynthesis instance should work
      9 // https://github.com/w3c/speech-api/issues/7
     10 async_test(t => {
     11  test_driver.bless('speechSynthesis.speak', t.step_func(() => {
     12    // the utterance is short to make the test faster
     13    const utter = new SpeechSynthesisUtterance('1');
     14    utter.onerror = t.unreached_func('error event');
     15    speechSynthesis.speak(utter);
     16    utter.onend = t.step_func(() => {
     17      speechSynthesis.speak(utter);
     18      // pass if the utterance finishes a second time
     19      utter.onend = t.step_func_done();
     20    });
     21  }));
     22 }, 'Using the same SpeechSynthesisUtterance twice for speechSynthesis.speak()');
     23 </script>