summaryrefslogtreecommitdiffstats
path: root/browser/components/search/test/browser/slow_loading_page_with_ads.sjs
blob: 7a6382d1cb42564f9e86e2deb2ee72284bee23da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

function handleRequest(request, response) {
  const DELAY_MS = 2000;
  response.processAsync();

  response.setHeader("Cache-Control", "no-cache", false);
  response.setHeader("Content-Type", "image/png", false);
  response.write("Start loading image");

  let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
  timer.init(
    () => {
      response.write("Finish loading image");
      response.finish();
    },
    DELAY_MS,
    Ci.nsITimer.TYPE_ONE_SHOT
  );
}