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

Quelle  test_large_arraybuffers.html   Sprache: HTML

 
 products/sources/formale Sprachen/C/Firefox/dom/bindings/test/test_large_arraybuffers.html


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

<head>
  <meta charset="utf-8">
  <title>Test for large ArrayBuffers and views</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1688616">Mozilla Bug 1688616</a>
<p id="display"></p>
<div id="content" style="display: none">

</div>
<pre id="test">
</pre>
  <script type="application/javascript">
    /* global TestFunctions */

    SimpleTest.waitForExplicitFinish();
    SpecialPowers.pushPrefEnv({set: [["dom.expose_test_interfaces", true]]}, go);

    function checkThrowsTooLarge(f) {
      let ex;
      try{
        f();
        ok(false, "Should have thrown!");
      } catch (e) {
        ex = e;
      }
      ok(ex.toString().includes("larger than 2 GB"), "Got exception: " + ex);
    }

    function go() {
      let test = new TestFunctions();

      const gb = 1 * 1024 * 1024 * 1024;
      let ab = new ArrayBuffer(5 * gb);
      checkThrowsTooLarge(() => test.testNotAllowShared(ab));
      checkThrowsTooLarge(() => test.testAllowShared(ab));
      checkThrowsTooLarge(() => test.testDictWithAllowShared({arrayBuffer: ab}));
      checkThrowsTooLarge(() => test.testUnionOfBuffferSource(ab));
      checkThrowsTooLarge(() => { test.arrayBuffer = ab; });
      checkThrowsTooLarge(() => { test.allowSharedArrayBuffer = ab; });
      checkThrowsTooLarge(() => { test.sequenceOfArrayBuffer = [ab]; });
      checkThrowsTooLarge(() => { test.sequenceOfAllowSharedArrayBuffer = [ab]; });

      let ta = new Int8Array(ab, 0, 3 * gb);
      checkThrowsTooLarge(() => test.testNotAllowShared(ta));
      checkThrowsTooLarge(() => test.testAllowShared(ta));
      checkThrowsTooLarge(() => test.testDictWithAllowShared({arrayBufferView: ta}));
      checkThrowsTooLarge(() => test.testUnionOfBuffferSource(ta));
      checkThrowsTooLarge(() => { test.arrayBufferView = ta; });
      checkThrowsTooLarge(() => { test.allowSharedArrayBufferView = ta; });
      checkThrowsTooLarge(() => { test.sequenceOfArrayBufferView = [ta]; });
      checkThrowsTooLarge(() => { test.sequenceOfAllowSharedArrayBufferView = [ta]; });

      let dv = new DataView(ab);
      checkThrowsTooLarge(() => test.testNotAllowShared(dv));
      checkThrowsTooLarge(() => test.testAllowShared(dv));
      checkThrowsTooLarge(() => test.testDictWithAllowShared({arrayBufferView: dv}));
      checkThrowsTooLarge(() => test.testUnionOfBuffferSource(dv));
      checkThrowsTooLarge(() => { test.arrayBufferView = dv; });
      checkThrowsTooLarge(() => { test.allowSharedArrayBufferView = dv; });
      checkThrowsTooLarge(() => { test.sequenceOfArrayBufferView = [dv]; });
      checkThrowsTooLarge(() => { test.sequenceOfAllowSharedArrayBufferView = [dv]; });

      if (this.SharedArrayBuffer) {
        let sab = new SharedArrayBuffer(5 * gb);
        checkThrowsTooLarge(() => test.testAllowShared(sab));
        checkThrowsTooLarge(() => test.testDictWithAllowShared({allowSharedArrayBuffer: sab}));
        checkThrowsTooLarge(() => test.testUnionOfAllowSharedBuffferSource(sab));
        checkThrowsTooLarge(() => { test.allowSharedArrayBuffer = sab; });
        checkThrowsTooLarge(() => { test.sequenceOfAllowSharedArrayBuffer = [sab]; });

        let sta = new Int8Array(sab);
        checkThrowsTooLarge(() => test.testAllowShared(sta));
        checkThrowsTooLarge(() => test.testDictWithAllowShared({allowSharedArrayBufferView: sta}));
        checkThrowsTooLarge(() => test.testUnionOfAllowSharedBuffferSource(sta));
        checkThrowsTooLarge(() => { test.allowSharedArrayBufferView = sta; });
        checkThrowsTooLarge(() => { test.sequenceOfAllowSharedArrayBufferView = [sta]; });
      }

      // Small views on large buffers are fine.
      let ta2 = new Int8Array(ab, 4 * gb);
      is(ta2.byteLength, 1 * gb, "Small view on large ArrayBuffer");
      test.testNotAllowShared(ta2);
      test.arrayBufferView = ta2;

      SimpleTest.finish();
    }
  </script>
</body>
</html>

Messung V0.5
C=93 H=89 G=90

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet)  ¤

*© 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.