object-delayed-intrinsic-size.sjs (736B)
1 var timer = null; 2 3 function handleRequest(request, response) { 4 response.processAsync(); 5 6 response.setStatusLine(null, 200, "OK"); 7 response.setHeader("Content-Type", "image/svg+xml", false); 8 9 // We need some body output or else gecko will not do an initial reflow 10 // while waiting for the rest of the document to load: 11 response.bodyOutputStream.write("\n", 1); 12 13 timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); 14 timer.initWithCallback( 15 function () { 16 var body = 17 "<svg xmlns='http://www.w3.org/2000/svg' width='70' height='0'></svg>"; 18 response.bodyOutputStream.write(body, body.length); 19 response.finish(); 20 }, 21 1000 /* milliseconds */, 22 Ci.nsITimer.TYPE_ONE_SHOT 23 ); 24 }