tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bug1180105-waiter.sjs (773B)


      1 /* Any copyright is dedicated to the Public Domain.
      2  * http://creativecommons.org/publicdomain/zero/1.0/
      3  */
      4 
      5 var timer = Cc["@mozilla.org/timer;1"];
      6 var waitTimer = timer.createInstance(Ci.nsITimer);
      7 
      8 function handleRequest(request, response) {
      9   response.setHeader("Content-Type", "text/html", false);
     10   response.setHeader("Cache-Control", "no-cache", false);
     11   response.setStatusLine(request.httpVersion, 200, "OK");
     12   response.processAsync();
     13   waitForFinish(response);
     14 }
     15 
     16 function waitForFinish(response) {
     17   if (getSharedState("all-parts-done") === "1") {
     18     response.write("done");
     19     response.finish();
     20   } else {
     21     waitTimer.initWithCallback(
     22       function () {
     23         waitForFinish(response);
     24       },
     25       10,
     26       Ci.nsITimer.TYPE_ONE_SHOT
     27     );
     28   }
     29 }