Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/media/test/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  test_mixed_principals.html   Sprache: HTML

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


<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=489415
-->

<head>
  <title>Test for Bug 489415</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>
  <style>
    video {
      width: 40%;
      border: solid black 1px;
    }
  </style>
</head>

<body>
  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=489415">Mozilla Bug 489415</a>
  <p id="display"></p>
  <pre id="test">
  <script type="text/javascript">
    SimpleTest.waitForExplicitFinish();

    var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({ set: p });
    var count = 0;

    function canReadBack(video) {
      var c = document.createElement("canvas");
      var ctx = c.getContext("2d");
      ctx.drawImage(video, 0, 0);
      try {
        var data_url = c.toDataURL();
        var empty_canvas = document.createElement("canvas");
        if (empty_canvas.toDataURL() === data_url) {
          info("Readback check returned same data URL as empty canvas.");
        } else {
          info("Readback check returned different data URL than empty canvas.");
        }
        return true;
      } catch (ex) {
        return false;
      }
    }

    function runTest(origin, shouldReadBackOnLoad) {
      return new Promise(function (resolve) {
        // Load will redirect mid-flight, which will be detected and should error,
        // and we should no longer be able to readback.
        var video = document.createElement("video");
        video.preload = "metadata";
        video.controls = true;
        var url = "http://" + origin + "/tests/dom/media/test/midflight-redirect.sjs"
                  + "?resource=pixel_aspect_ratio.mp4&type=video/mp4";
        SimpleTest.info("Loading from " + url);
        video.src = url;
        document.body.appendChild(video);

        once(video"loadeddata", () => {
          is(canReadBack(video), shouldReadBackOnLoad, "Should be able to readback");
          video.play();
        });

        once(video"error", () => {
          if(video.readyState == video.HAVE_METADATA) {
            is(canReadBack(video), true, "Should be able to readback with readyState == HAVE_METADATA");
          } else {
            is(canReadBack(video), false, "Should not be able to readback with readyState != HAVE_METADATA");
          }

          removeNodeAndSource(video);
          resolve();
        });

        once(video"ended", () => {
          ok(false, "Should not be able to playback to end, we should have errored!");
          removeNodeAndSource(video);
          resolve();
        });

      });
    }

    Promise.all([
      runTest("mochi.test:8888", true),
      runTest("example.org", false),
    ]).then(SimpleTest.finish);

  </script>
</pre>
</body>
</html>

Messung V0.5
C=98 H=98 G=97

¤ Dauer der Verarbeitung: 0.2 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.