Bug 621056 - Prevent the timer to be eaten alive by the GC. r=bz a=tests

This commit is contained in:
Mounir Lamouri 2011-03-10 17:03:39 +01:00
Родитель bb984d1400
Коммит 1e706f35e0
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,6 @@
// timer has to be alive so it can't be eaten by the GC.
var timer;
function handleRequest(request, response)
{
response.setHeader("Cache-Control", "no-cache", false);
@ -5,7 +8,7 @@ function handleRequest(request, response)
// The "stray" open comment at the end of the write is important!
response.write("document.write(\"<script charset='utf-8' src='script-2_bug597345.js'></script><!--\")");
response.processAsync();
var timer = Components.classes["@mozilla.org/timer;1"]
timer = Components.classes["@mozilla.org/timer;1"]
.createInstance(Components.interfaces.nsITimer);
timer.initWithCallback(function() {
response.finish();