diff options
Diffstat (limited to 'toolkit/components/antitracking/bouncetrackingprotection/test/browser/file_bounce.html')
-rw-r--r-- | toolkit/components/antitracking/bouncetrackingprotection/test/browser/file_bounce.html | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/toolkit/components/antitracking/bouncetrackingprotection/test/browser/file_bounce.html b/toolkit/components/antitracking/bouncetrackingprotection/test/browser/file_bounce.html new file mode 100644 index 0000000000..2756555fa5 --- /dev/null +++ b/toolkit/components/antitracking/bouncetrackingprotection/test/browser/file_bounce.html @@ -0,0 +1,59 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> + <title>Bounce!</title> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + </head> + <body> + <p>Nothing to see here...</p> + <script> + // Wrap the entire block so we can run async code. + (async () => { + let url = new URL(location.href); + + let redirectDelay = url.searchParams.get("redirectDelay"); + if(redirectDelay != null) { + redirectDelay = Number.parseInt(redirectDelay); + } else { + redirectDelay = 50; + } + + let setState = url.searchParams.get("setState"); + if (setState) { + let id = Math.random().toString(); + + if (setState == "cookie-client") { + let cookie = document.cookie; + + if (cookie) { + console.info("Received cookie", cookie); + } else { + let newCookie = `id=${id}`; + console.info("Setting new cookie", newCookie); + document.cookie = newCookie; + } + } else if (setState == "localStorage") { + let entry = localStorage.getItem("id"); + + if (entry) { + console.info("Found localStorage entry. id", entry); + } else { + console.info("Setting new localStorage entry. id", id); + localStorage.setItem(id, id); + } + } + } + + let target = url.searchParams.get("target"); + if (target) { + console.info("redirecting to", target); + setTimeout(() => { + location.href = target; + }, redirectDelay); + } + })(); + </script> + </body> +</html> |