Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | const { classes: Cc, interfaces: Ci } = Components; |
michael@0 | 5 | |
michael@0 | 6 | function handleRequest(request, response) { |
michael@0 | 7 | response.processAsync(); |
michael@0 | 8 | |
michael@0 | 9 | let params = request.queryString.split("&"); |
michael@0 | 10 | let index = params.filter((s) => s.contains("index="))[0].split("=")[1]; |
michael@0 | 11 | |
michael@0 | 12 | let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); |
michael@0 | 13 | timer.initWithCallback(() => { |
michael@0 | 14 | // to avoid garbage collection |
michael@0 | 15 | timer = null; |
michael@0 | 16 | response.setStatusLine(request.httpVersion, index == 1 ? 101 : index * 100, "Meh"); |
michael@0 | 17 | response.setHeader("Content-Type", "text/" + index, false); |
michael@0 | 18 | response.write(new Array(index * 10).join(index)); // + 0.01 KB |
michael@0 | 19 | response.finish(); |
michael@0 | 20 | }, 10, Ci.nsITimer.TYPE_ONE_SHOT); // Make sure this request takes a few ms. |
michael@0 | 21 | } |