summaryrefslogtreecommitdiffstats
path: root/dom/tests/browser/page_localstorage_snapshotting_e10s.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/tests/browser/page_localstorage_snapshotting_e10s.html')
-rw-r--r--dom/tests/browser/page_localstorage_snapshotting_e10s.html55
1 files changed, 55 insertions, 0 deletions
diff --git a/dom/tests/browser/page_localstorage_snapshotting_e10s.html b/dom/tests/browser/page_localstorage_snapshotting_e10s.html
new file mode 100644
index 0000000000..ae8b685d02
--- /dev/null
+++ b/dom/tests/browser/page_localstorage_snapshotting_e10s.html
@@ -0,0 +1,55 @@
+<!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 endExplicitSnapshot() {
+ localStorage.endExplicitSnapshot();
+}
+</script>
+</head>
+<body><h2 id="pageNameH"></h2></body>
+</html>