зеркало из https://github.com/mozilla/gecko-dev.git
Bug 662178 - Ensure Utils.nextTick timers aren't GC'ed prematurely... by not using timers. r=rnewman
This commit is contained in:
Родитель
853997c9a7
Коммит
5070660f44
|
@ -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);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче