summaryrefslogtreecommitdiffstats
path: root/toolkit/components/thumbnails/test/thumbnails_background.sjs
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-25 15:07:00 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:55:19 +0200
commiteb70e6e3d0bff11c25f14b1196025791bf2308fb (patch)
tree5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/components/thumbnails/test/thumbnails_background.sjs
parent32ead795290b3399d56b4708fc75b77d296f6a1a (diff)
downloadUXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/components/thumbnails/test/thumbnails_background.sjs')
-rw-r--r--toolkit/components/thumbnails/test/thumbnails_background.sjs79
1 files changed, 0 insertions, 79 deletions
diff --git a/toolkit/components/thumbnails/test/thumbnails_background.sjs b/toolkit/components/thumbnails/test/thumbnails_background.sjs
deleted file mode 100644
index f1cce96a0..000000000
--- a/toolkit/components/thumbnails/test/thumbnails_background.sjs
+++ /dev/null
@@ -1,79 +0,0 @@
-/* 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 = '<script>document.cookie="red";</script>';
- }
-
- if (opts.setGreenCookie) {
- resp.setHeader("Set-Cookie", "green", false);
- setCookieScript = '<script>document.cookie="green";</script>';
- }
-
- if (opts.iframe) {
- setCookieScript += '<iframe src="' + opts.iframe + '" />';
- }
-
- if (opts.xhr) {
- setCookieScript += `
- <script>
- var req = new XMLHttpRequest();
- req.open("GET", "${opts.xhr}", true);
- req.send();
- </script>
- `;
- }
-
- if (req.hasHeader("Cookie") &&
- req.getHeader("Cookie").split(";").indexOf("red") >= 0) {
- resp.write('<html style="background: #f00;">' + setCookieScript + '</html>');
- resp.finish();
- return;
- }
-
- if (req.hasHeader("Cookie") &&
- req.getHeader("Cookie").split(";").indexOf("green") >= 0) {
- resp.write('<html style="background: #0f0;">' + setCookieScript + '</html>');
- resp.finish();
- return;
- }
-
- if (opts.redirect) {
- resp.setHeader("Location", opts.redirect);
- resp.setStatusLine(null, 303, null);
- resp.finish();
- return;
- }
-
- if (opts.wait) {
- resp.write("Waiting " + opts.wait + " ms... ");
- timer = Components.classes["@mozilla.org/timer;1"].
- createInstance(Components.interfaces.nsITimer);
- timer.init(function ding() {
- resp.write("OK!");
- resp.finish();
- }, opts.wait, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
- return;
- }
-
- resp.write("<pre>" + JSON.stringify(opts, undefined, 2) + "</pre>" + setCookieScript);
- resp.finish();
-}