summaryrefslogtreecommitdiffstats
path: root/parser/htmlparser/tests/mochitest/file_async_bug1104732.sjs
blob: 391e004533b1a0eef25780dee937bfdfba27153d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var timer = null;

function handleRequest(request, response) {
  response.processAsync();
  response.setHeader("Content-Type", "application/javascript", false);
  response.write("asyncState = 'mid-async';\n");

  timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
  timer.initWithCallback(
    function() {
      response.write("asyncState = 'loaded';\n");
      response.finish();
    },
    5 * 1000 /* milliseconds */,
    timer.TYPE_ONE_SHOT
  );
}