summaryrefslogtreecommitdiffstats
path: root/dom/tests/browser/page_localstorage_snapshotting.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/tests/browser/page_localstorage_snapshotting.html
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/tests/browser/page_localstorage_snapshotting.html')
-rw-r--r--dom/tests/browser/page_localstorage_snapshotting.html68
1 files changed, 68 insertions, 0 deletions
diff --git a/dom/tests/browser/page_localstorage_snapshotting.html b/dom/tests/browser/page_localstorage_snapshotting.html
new file mode 100644
index 0000000000..b64f4b8cab
--- /dev/null
+++ b/dom/tests/browser/page_localstorage_snapshotting.html
@@ -0,0 +1,68 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8">
+<script>
+/**
+ * Helper page used by browser_localStorage_snapshotting.js.
+ *
+ * We expose methods to be invoked by ContentTask.spawn() calls.
+ *
+ **/
+var pageName = document.location.search.substring(1);
+window.addEventListener(
+ "load",
+ () => { document.getElementById("pageNameH").textContent = pageName; });
+
+function applyMutations(mutations) {
+ mutations.forEach(function([key, value]) {
+ if (key !== null) {
+ if (value === null) {
+ localStorage.removeItem(key);
+ } else {
+ localStorage.setItem(key, value);
+ }
+ } else {
+ localStorage.clear();
+ }
+ });
+}
+
+function getState() {
+ let state = {};
+ let length = localStorage.length;
+ for (let index = 0; index < length; index++) {
+ let key = localStorage.key(index);
+ state[key] = localStorage.getItem(key);
+ }
+ return state;
+}
+
+function getKeys() {
+ return Object.keys(localStorage);
+}
+
+function beginExplicitSnapshot() {
+ localStorage.beginExplicitSnapshot();
+}
+
+function checkpointExplicitSnapshot() {
+ localStorage.checkpointExplicitSnapshot();
+}
+
+function endExplicitSnapshot() {
+ localStorage.endExplicitSnapshot();
+}
+
+function getHasSnapshot() {
+ return localStorage.hasSnapshot;
+}
+
+function getSnapshotUsage() {
+ return localStorage.snapshotUsage;
+}
+
+</script>
+</head>
+<body><h2 id="pageNameH"></h2></body>
+</html>