Bug 662178 - Ensure Utils.nextTick timers aren't GC'ed prematurely... by not using timers. r=rnewman

This commit is contained in:
Philipp von Weitershausen 2011-06-08 18:12:12 +02:00
Родитель 853997c9a7
Коммит 5070660f44
1 изменённых файлов: 6 добавлений и 2 удалений

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

@ -935,13 +935,17 @@ let Utils = {
/**
* Execute a function on the next event loop tick.
*
* @param callback
* Function to invoke.
* @param thisObj [optional]
* Object to bind the callback to.
*/
nextTick: function nextTick(callback, thisObj) {
if (thisObj) {
callback = callback.bind(thisObj);
}
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
timer.initWithCallback(callback, 0, timer.TYPE_ONE_SHOT);
Services.tm.currentThread.dispatch(callback, Ci.nsIThread.DISPATCH_NORMAL);
},
/**