gecko-dev/dom/xhr/tests/sync_xhr_unload.sjs

16 строки
490 B
JavaScript

var timer = null;
function handleRequest(request, response)
{
response.processAsync();
timer = Components.classes["@mozilla.org/timer;1"]
.createInstance(Components.interfaces.nsITimer);
timer.initWithCallback(function()
{
response.setStatusLine(null, 200, "OK");
response.setHeader("Content-Type", "text/plain", false);
response.write("hello");
response.finish();
}, 30000 /* milliseconds */, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
}