summaryrefslogtreecommitdiffstats
path: root/parser/htmlparser/tests/mochitest/file_async_bug1104732.sjs
blob: 5e83e5051093011505baadf7ec4e52a0c7d6a77d (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
  );
}