Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/ipc/glue/   (LibreOffice Version 25.8.3.2©)  Datei vom 10.2.2025 mit Größe 6 kB image not shown  

Quelle  test_bug1512958.html

  Sprache: HTML
 

 products/Sources/formale Sprachen/C/Firefox/dom/media/test/test_bug1512958.html


<!DOCTYPE HTML>
<html>
<head>
  <title>Test that pausing and resuming a captured media element with audio doesn't stall</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  <script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<audio id="a"></audio>
<pre id="test">
<script class="testbody" type="text/javascript">
function dumpEvent({target, type}) {
  info(`${target.name} GOT EVENT ${type} currentTime=${target.currentTime} ` +
       `paused=${target.paused} ended=${target.ended} ` +
       `readyState=${target.readyState}`);
}

function wait(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}

const a = document.getElementById('a');

const events = ["timeupdate""seeking""seeked""ended""playing""pause"];
for (let ev of events) {
  a.addEventListener(ev, dumpEvent);
}

(async () => {
  try {
    SimpleTest.waitForExplicitFinish();
    SimpleTest.requestFlakyTimeout("Timeouts for shortcutting test-timeout");

    const test = getPlayableAudio(gTrackTests.filter(t => t.duration > 2));
    if (!test) {
      todo(false, "No playable audio");
      return;
    }

    // Start playing and capture
    a.src = test.name;
    a.name = test.name;
    const ac = new AudioContext();
    ac.createMediaElementSource(a);
    a.play();
    do {
      await new Promise(r => a.ontimeupdate = r);
    } while(a.currentTime == 0)

    // Pause to trigger recreating tracks in DecodedStream
    a.pause();
    await new Promise(r => a.onpause = r);

    // Resuming should now work. Bug 1512958 would cause a stall because the
    // original track wasn't ended and we'd block on it.
    // See https://bugzilla.mozilla.org/show_bug.cgi?id=1512958#c5
    a.play();
    await new Promise(r => a.onplaying = r);
    a.currentTime = test.duration - 1;
    await Promise.race([
      new Promise(res => a.onended = res),
      wait(30000).then(() => Promise.reject(new Error("Timeout"))),
    ]);
  } catch(e) {
    ok(false, e);
  } finally {
    SimpleTest.finish();
  }
})();
</script>
</pre>
</body>
</html>

Messung V0.5 in Prozent
C=96 H=89 G=92

¤ Dauer der Verarbeitung: 0.22 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.