content/base/test/script-1_bug597345.sjs

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/script-1_bug597345.sjs	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,16 @@
     1.4 +// timer has to be alive so it can't be eaten by the GC.
     1.5 +var timer;
     1.6 +
     1.7 +function handleRequest(request, response)
     1.8 +{
     1.9 +  response.setHeader("Cache-Control", "no-cache", false);
    1.10 +  response.setHeader("Content-Type", "text/javascript", false);
    1.11 +  // The "stray" open comment at the end of the write is important!
    1.12 +  response.write("document.write(\"<script charset='utf-8' src='script-2_bug597345.js'></script><!--\")");
    1.13 +  response.processAsync();
    1.14 +  timer = Components.classes["@mozilla.org/timer;1"]
    1.15 +    .createInstance(Components.interfaces.nsITimer);
    1.16 +  timer.initWithCallback(function() {
    1.17 +      response.finish();
    1.18 +    }, 200, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
    1.19 +}

mercurial