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.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 const { classes: Cc, interfaces: Ci } = Components;
6 function handleRequest(request, response) {
7 response.processAsync();
9 let params = request.queryString.split("&");
10 let index = params.filter((s) => s.contains("index="))[0].split("=")[1];
12 let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
13 timer.initWithCallback(() => {
14 // to avoid garbage collection
15 timer = null;
16 response.setStatusLine(request.httpVersion, index == 1 ? 101 : index * 100, "Meh");
17 response.setHeader("Content-Type", "text/" + index, false);
18 response.write(new Array(index * 10).join(index)); // + 0.01 KB
19 response.finish();
20 }, 10, Ci.nsITimer.TYPE_ONE_SHOT); // Make sure this request takes a few ms.
21 }