slow_load.sjs (928B)
1 // Make sure our timer stays alive. 2 let gTimer; 3 4 function handleRequest(request, response) { 5 let isCss = request.queryString.indexOf("css") != -1; 6 7 response.setHeader("Content-Type", isCss ? "text/css" : "text/plain", false); 8 response.setStatusLine("1.1", 200, "OK"); 9 response.processAsync(); 10 11 let time = Date.now(); 12 13 gTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); 14 // Wait for 1s before responding; this should usually make sure this load comes in last. 15 gTimer.init( 16 () => { 17 if (isCss) { 18 // FIXME(emilio): This clamps the date to the 32-bit integer range which 19 // is what we use to store the z-index... We don't seem to store f64s 20 // anywhere in the specified values... 21 time = time % (Math.pow(2, 31) - 1); 22 response.write(":root { z-index: " + time + "}"); 23 } 24 response.finish(); 25 }, 26 1000, 27 Ci.nsITimer.TYPE_ONE_SHOT 28 ); 29 }