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  blob_worker_crash_iframe.html

  Sprache: HTML
 

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


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

<html>
<head>
  <title>Indexed Database Test</title>

  <script type="text/javascript">
  function report(result) {
    var message = { source"iframe" };
    message.result = result;
    window.parent.postMessage(message, "*");
  }

  function runIndexedDBTest() {
    var db = null;

    // Create the data-store
    function createDatastore() {
      try {
        var request = indexedDB.open(window.location.pathname, 1);
        request.onupgradeneeded = function(event) {
          event.target.result.createObjectStore("foo");
        };
        request.onsuccess = function(event) {
          db = event.target.result;
          createAndStoreBlob();
        };
      }
      catch (e) {
dump("EXCEPTION IN CREATION: " + e + "\n " + e.stack + "\n");
        report(false);
      }
    }

    function createAndStoreBlob() {
      const BLOB_DATA = ["fun ""times ""all ""around!"];
      var blob = new Blob(BLOB_DATA, { type: "text/plain" });
      var objectStore = db.transaction("foo""readwrite").objectStore("foo");
      objectStore.add({ blob }, 42).onsuccess = refetchBlob;
    }

    function refetchBlob() {
      var foo = db.transaction("foo").objectStore("foo");
      foo.get(42).onsuccess = fetchedBlobCreateWorkerAndSendBlob;
    }

    function fetchedBlobCreateWorkerAndSendBlob(event) {
      var idbBlob = event.target.result.blob;
      var compositeBlob = new Blob(["I like the following blob: ", idbBlob],
                                   { type: "text/fancy" });

      function workerScript() {
        onmessage = function(event) {
          // Save the Blob to the worker's global scope.
          self.holdOntoBlob = event.data;
          // Send any message so we can serialize and keep our runtime behaviour
          // consistent.
          postMessage("kung fu death grip established");
        };
      }

      var url =
        URL.createObjectURL(new Blob(["(", workerScript.toString(), ")()"]));

      // Keep a reference to the worker on the window.
      var worker = window.worker = new Worker(url);
      worker.postMessage(compositeBlob);
      worker.onmessage = workerLatchedBlobDeleteFromDB;
    }

    function workerLatchedBlobDeleteFromDB() {
      // Delete the reference to the Blob from the database leaving the worker
      // thread reference as the only live reference once a GC has cleaned
      // out our references that we sent to the worker.  The page that owns
      // us triggers a GC just for that reason.
      var objectStore = db.transaction("foo""readwrite").objectStore("foo");
      objectStore.delete(42).onsuccess = closeDBTellOwningThread;
    }

    function closeDBTellOwningThread() {
      // Now that worker has latched the blob, clean up the database.
      db.close();
      db = null;
      report("ready");
    }

    createDatastore();
  }
  </script>

</head>

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

</html>

Messung V0.5 in Prozent
C=87 H=100 G=93

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