Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/indexedDB/test/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 2 kB image not shown  

Quelle  test_file_structured_clone.html

  Sprache: HTML
 

 products/Sources/formale Sprachen/C/Firefox/dom/indexedDB/test/test_file_structured_clone.html


<!--
  Any copyright is dedicated to the Public Domain.
  http://creativecommons.org/publicdomain/zero/1.0/
-->

<html>
<head>
  <title>Indexed Database Blob Structured Clone Test</title>

  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>

  <script type="text/javascript">
  /**
   * Test that structured cloning a Blob results in distinct backing files when
   * stored in IndexedDB.
   *
   * Currently, IndexedDB deduplicates blobs based on Blob object identity.
   * Structured cloning creates a new Blob instance with a different identity,
   * so the two blobs are treated as distinct and stored separately on disk.
   *
   * This test verifies that behavior by ensuring the cloned Blob receives a
   * different fileId.
   *
   * TODO: Once IndexedDB switches to using BlobImpl for deduplication,
   * structured-cloned blobs that share the same underlying data should be
   * deduplicated and mapped to the same fileId.
   */
  async function testSteps()
  {
    const name = window.location.pathname;

    const objectStoreName = "Blobs";

    const blob = getRandomBlob(10000);
    const clonedBlob = structuredClone(blob);

    const blobData1 = { key: 1, blob, expectedFileId: 1 };
    // TODO: After switching IndexedDB blob deduplication to use BlobImpl
    // instead of Blob identity, this structured-cloned blob should reuse the
    // same underlying file and have expectedFileId = 1.
    const blobData2 = { key: 2, blob: clonedBlob, expectedFileId: 2 };

    await SpecialPowers.pushPrefEnv({ set: [["dom.indexedDB.dataThreshold", -1]] });

    let request = indexedDB.open(name, 1);
    await expectingUpgrade(request);

    let db = request.result;
    db.onerror = errorHandler;

    let objectStore = db.createObjectStore(objectStoreName, {});

    objectStore.add(blobData1.blob, blobData1.key);
    objectStore.add(blobData2.blob, blobData2.key);

    await expectingSuccess(request);

    objectStore = db.transaction([objectStoreName]).objectStore(objectStoreName);

    request = objectStore.get(blobData1.key);
    await requestSucceeded(request);

    await verifyBlobAsync(request.result, blobData1.blob, blobData1.expectedFileId);

    objectStore = db.transaction([objectStoreName]).objectStore(objectStoreName);

    request = objectStore.get(blobData2.key);
    await requestSucceeded(request);

    await verifyBlobAsync(request.result, blobData2.blob, blobData2.expectedFileId);

    is(bufferCache.length, 2"Correct length");
  }
  </script>
  <script type="text/javascript" src="file.js"></script>
  <script type="text/javascript" src="helpers.js"></script>

</head>

<body onload="runTest();"></body>

</html>

Messung V0.5 in Prozent
C=89 H=97 G=93

¤ Dauer der Verarbeitung: 0.25 Sekunden  (vorverarbeitet am  2026-08-25) ¤

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