xml-trickle-1.sjs (649B)
1 var timer; // Place timer in global scope to avoid it getting GC'ed prematurely 2 3 function handleRequest(request, response) 4 { 5 response.setHeader("Cache-Control", "no-cache", false); 6 response.setHeader("Content-Type", "application/xml", false); 7 response.write("<"); 8 response.bodyOutputStream.flush(); 9 response.processAsync(); 10 timer = Components.classes["@mozilla.org/timer;1"] 11 .createInstance(Components.interfaces.nsITimer); 12 timer.initWithCallback(function() { 13 response.write("?xml version='1.0' encoding='windows-1251'?><root>\u00E6</root>\n"); 14 response.finish(); 15 }, 10, Components.interfaces.nsITimer.TYPE_ONE_SHOT); 16 } 17