dom/plugins/test/mochitest/neverending.sjs

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 var timer = null; // declare timer outside to prevent premature GC
     2 function handleRequest(request, response)
     3 {
     4   response.processAsync();
     5   response.setHeader("Content-Type", "text/plain", false);
     7   for (var i = 0; i < 1000; ++i)
     8     response.write("Hello... ");
    10   timer = Components.classes["@mozilla.org/timer;1"]
    11     .createInstance(Components.interfaces.nsITimer);
    12   timer.initWithCallback(function() {
    13       response.write("world.\n");
    14       response.finish();
    15     }, 10 * 1000 /* 10 secs */, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
    16 }

mercurial