/* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ "use strict"; function handleRequest(request, response) { response.processAsync(); const params = new Map( request.queryString .replace("?", "") .split("&") .map(s => s.split("=")) ); const delay = params.has("delay") ? params.get("delay") : 2000; let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); timer.initWithCallback( () => { // to avoid garbage collection timer = null; response.setStatusLine(request.httpVersion, 200, "OK"); response.setHeader("Content-Type", "image/svg+xml", false); // This is the mozilla logo response.write(` `); response.finish(); }, delay, Ci.nsITimer.TYPE_ONE_SHOT ); }