parser/htmlparser/tests/mochitest/file_bug534293-slow.sjs
author Henri Sivonen <hsivonen@iki.fi>
Tue, 17 May 2011 10:15:48 +0300
changeset 69593 5ae6761e175bcffa4428335fe515081cba0afdf7
parent 48404 e278b19aa8cad518c842729c4a0bb7bde035a3e6
child 596002 7c08aa0278932bb1239bdf3ca7960640ac792197
permissions -rw-r--r--
Bug 656881 - Make timer in file_bug534293-slow.sjs not suspectible to early GC. r=jwalden.

var timer;

function handleRequest(request, response)
{
  response.setHeader("Cache-Control", "no-cache", false);
  response.setHeader("Content-Type", "text/javascript", false);
  response.write("ok(true, 'Slow script ran.');");
  response.processAsync();
  timer = Components.classes["@mozilla.org/timer;1"]
    .createInstance(Components.interfaces.nsITimer);
  timer.initWithCallback(function() {
      response.finish();
    }, 500, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
}