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

Quelle  storage-listings.html   Sprache: HTML

 
 products/sources/formale Sprachen/C/Firefox/devtools/client/storage/test/storage-listings.html


<!DOCTYPE HTML>
<html>
<!--
Storage inspector front end - tests
-->

<head>
  <meta charset="utf-8">
  <title>Storage inspector test for listing hosts and storages</title>
</head>
<body>
<iframe src="http://sectest1.example.org/browser/devtools/client/storage/test/storage-unsecured-iframe.html"></iframe>
<iframe src="https://sectest1.example.org:443/browser/devtools/client/storage/test/storage-secured-iframe.html"></iframe>
<script type="application/javascript">
"use strict";
const partialHostname = location.hostname.match(/^[^.]+(\..*)$/)[1];
const cookieExpiresTime1 = 2000000000000;
const cookieExpiresTime2 = 2000000001000;
// Setting up some cookies to eat.
document.cookie = "c1=foobar; expires=" +
  new Date(cookieExpiresTime1).toGMTString() + "; path=/browser";
document.cookie = "cs2=sessionCookie; path=/; domain=" + partialHostname;
document.cookie = "c3=foobar-2; expires=" +
  new Date(cookieExpiresTime1).toGMTString() + "; path=/";
document.cookie = "c4=foobar-3; expires=" +
  new Date(cookieExpiresTime2).toGMTString() + "; path=/; domain=" +
  partialHostname;
// ... and some local storage items ..
localStorage.setItem("ls1""foobar");
localStorage.setItem("ls2""foobar-2");

// Because localStorage contains key() on the prototype and it can't be iterated
// using object.keys() we check the the value "key" exists.
// See bug 1451991 for details.
localStorage.setItem("key""value1");

// ... and finally some session storage items too
sessionStorage.setItem("ss1""foobar-3");

// Because sessionStorage contains key() on the prototype and it can't be
// iterated using object.keys() we check the the value "key" exists.
// See bug 1451991 for details.
sessionStorage.setItem("key""value2");

dump("added cookies and storage from main page\n");

const idbGenerator = async function () {
  let request = indexedDB.open("idb1", 1);
  request.onerror = function() {
    throw new Error("error opening db connection");
  };
  const db = await new Promise(done => {
    request.onupgradeneeded = event => {
      const _db = event.target.result;
      const store1 = _db.createObjectStore("obj1", { keyPath: "id" });
      store1.createIndex("name""name", { unique: false });
      store1.createIndex("email""email", { unique: true });
      _db.createObjectStore("obj2", { keyPath: "id2" }); // eslint-disable-line no-unused-vars
      store1.transaction.oncomplete = () => {
        done(_db);
      };
    };
  });

  // Prevents AbortError
  await new Promise(done => {
    request.onsuccess = done;
  });

  const transaction = db.transaction(["obj1""obj2"], "readwrite");
  const store1 = transaction.objectStore("obj1");
  const store2 = transaction.objectStore("obj2");
  store1.add({id: 1, name: "foo", email: "foo@bar.com"});
  store1.add({id: 2, name: "foo2", email: "foo2@bar.com"});
  store1.add({id: 3, name: "foo2", email: "foo3@bar.com"});
  store2.add({
    id2: 1,
    name: "foo",
    email: "foo@bar.com",
    extra: "baz"
  });
  // Prevents AbortError during close()
  await new Promise(success => {
    transaction.oncomplete = success;
  });

  db.close();

  request = indexedDB.open("idb2", 1);
  const db2 = await new Promise(done => {
    request.onupgradeneeded = event => {
      const _db2 = event.target.result;
      const store3 = _db2.createObjectStore("obj3", { keyPath: "id3" });
      store3.createIndex("name2""name2", { unique: true });
      store3.transaction.oncomplete = () => {
        done(_db2);
      }
    };
  });
  // Prevents AbortError during close()
  await new Promise(done => {
    request.onsuccess = done;
  });
  db2.close();

  dump("added indexedDB from main page\n");
};

function deleteDB(dbName) {
  return new Promise(resolve => {
    dump("removing database " + dbName + " from " + document.location + "\n");
    indexedDB.deleteDatabase(dbName).onsuccess = resolve;
  });
}

async function fetchPut(cache, url) {
  const response = await fetch(url);
  await cache.put(url, response);
}

const cacheGenerator = async function () {
  const cache = await caches.open("plop");
  await fetchPut(cache, "404_cached_file.js");
  await fetchPut(cache, "browser_storage_basic.js");
};

window.setup = async function () {
  await idbGenerator();

  if (window.caches) {
    await cacheGenerator();
  }
};

window.clear = async function () {
  await deleteDB("idb1");
  await deleteDB("idb2");

  if (window.caches) {
    await caches.delete("plop");
  }
  dump("removed indexedDB and cache data from " + document.location + "\n");
};
</script>
</body>
</html>

Messung V0.5
C=74 H=93 G=83

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