Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

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, 03 * 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 in Prozent
C=95 H=93 G=93

¤ Dauer der Verarbeitung: 0.11 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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik