slow_broken_sheet.sjs (534B)
1 // Make sure our timer stays alive. 2 let gTimer; 3 4 function handleRequest(request, response) { 5 response.setHeader("Content-Type", "text/html", false); 6 response.setStatusLine("1.1", 404, "Not Found"); 7 response.processAsync(); 8 9 gTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); 10 // Wait for 1s before responding; this should usually make sure this load comes in last. 11 gTimer.init( 12 () => { 13 response.write("<h1>Hello</h1>"); 14 response.finish(); 15 }, 16 1000, 17 Ci.nsITimer.TYPE_ONE_SHOT 18 ); 19 }