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 --- .../test/referrer/file_referrer_testserver.sjs | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 browser/base/content/test/referrer/file_referrer_testserver.sjs (limited to 'browser/base/content/test/referrer/file_referrer_testserver.sjs') diff --git a/browser/base/content/test/referrer/file_referrer_testserver.sjs b/browser/base/content/test/referrer/file_referrer_testserver.sjs new file mode 100644 index 0000000000..3dac7811b1 --- /dev/null +++ b/browser/base/content/test/referrer/file_referrer_testserver.sjs @@ -0,0 +1,30 @@ +/** + * Renders the HTTP Referer header up to the second path slash. + * Used in browser_referrer_*.js, bug 1113431. + */ +function handleRequest(request, response) { + let referrer = ""; + try { + referrer = request.getHeader("referer"); + } catch (e) { + referrer = ""; + } + + // Strip it past the first path slash. Makes tests easier to read. + referrer = referrer.split("/").slice(0, 4).join("/"); + + let html = ` + + + + Test referrer + + +
${referrer}
+ + `; + + response.setHeader("Cache-Control", "no-cache", false); + response.setHeader("Content-Type", "text/html", false); + response.write(html); +} -- cgit v1.2.3