From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../thumbnails/test/thumbnails_background.sjs | 91 ++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 toolkit/components/thumbnails/test/thumbnails_background.sjs (limited to 'toolkit/components/thumbnails/test/thumbnails_background.sjs') diff --git a/toolkit/components/thumbnails/test/thumbnails_background.sjs b/toolkit/components/thumbnails/test/thumbnails_background.sjs new file mode 100644 index 0000000000..f0d00e82da --- /dev/null +++ b/toolkit/components/thumbnails/test/thumbnails_background.sjs @@ -0,0 +1,91 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// The timer never fires if it's not declared and set to this variable outside +// handleRequest, as if it's getting GC'ed when handleRequest's scope goes away. +// Shouldn't the timer thread hold a strong reference to it? +var timer; + +function handleRequest(req, resp) { + resp.processAsync(); + resp.setHeader("Cache-Control", "no-cache, no-store", false); + resp.setHeader("Content-Type", "text/html;charset=utf-8", false); + + let opts = {}; + try { + opts = JSON.parse(decodeURIComponent(req.queryString)); + } catch (err) {} + + let setCookieScript = ""; + if (opts.setRedCookie) { + resp.setHeader("Set-Cookie", "red", false); + setCookieScript = ''; + } + + if (opts.setGreenCookie) { + resp.setHeader("Set-Cookie", "green", false); + setCookieScript = ''; + } + + if (opts.iframe) { + setCookieScript += '