summaryrefslogtreecommitdiffstats
path: root/toolkit/components/antitracking/test/browser/localStorageEvents.html
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/antitracking/test/browser/localStorageEvents.html')
-rw-r--r--toolkit/components/antitracking/test/browser/localStorageEvents.html30
1 files changed, 30 insertions, 0 deletions
diff --git a/toolkit/components/antitracking/test/browser/localStorageEvents.html b/toolkit/components/antitracking/test/browser/localStorageEvents.html
new file mode 100644
index 0000000000..737d1e0cab
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/localStorageEvents.html
@@ -0,0 +1,30 @@
+<script>
+
+let eventCounter = 0;
+
+onmessage = e => {
+ if (e.data == "getValue") {
+ parent.postMessage(localStorage.foo, "*");
+ return;
+ }
+
+ if (e.data == "setValue") {
+ localStorage.foo = "tracker-" + Math.random();
+ return;
+ }
+
+ if (e.data == "getEvents") {
+ parent.postMessage(eventCounter, "*");
+ return;
+ }
+
+ if (e.data == "reload") {
+ window.location.reload();
+ }
+};
+
+addEventListener("storage", _ => {
+ ++eventCounter;
+});
+
+</script>