Bug 897221 - Support JS objects and avoid negative delay in nsUpdateTimerManager; r=rstrong

This commit is contained in:
Jim Chen 2013-09-09 15:47:46 -04:00
parent cea88b0387
commit 6371bea45f

View File

@ -222,7 +222,7 @@ TimerManager.prototype = {
Services.prefs.setIntPref(prefLastUpdate, timerData.lastUpdateTime);
}
tryFire(function() {
if (timerData.callback instanceof Ci.nsITimerCallback) {
if (timerData.callback && timerData.callback.notify) {
try {
timerData.callback.notify(timer);
LOG("TimerManager:notify - notified timerID: " + timerID);
@ -272,7 +272,7 @@ TimerManager.prototype = {
this.lastTimerReset = Date.now();
} else {
if (Date.now() + interval < this.lastTimerReset + this._timer.delay)
this._timer.delay = this.lastTimerReset + interval - Date.now();
this._timer.delay = Math.max(this.lastTimerReset + interval - Date.now(), 0);
}
},