Bug 597286, part 1: fix Util.Timeout bugs [r=mfinkle]
--- a/mobile/chrome/content/Util.js
+++ b/mobile/chrome/content/Util.js
@@ -213,30 +213,30 @@ Util.Timeout.prototype = {
/** Do the callback every aDelay msecs. Cancels other timeouts on this object. */
interval: function interval(aDelay, aCallback) {
return this._start(aDelay, this._timer.TYPE_REPEATING_SLACK, aCallback);
},
/** Clear any pending timeouts. */
clear: function clear() {
- if (this._type !== null) {
+ if (this.isPending()) {
this._timer.cancel();
this._type = null;
}
return this;
},
/** If there is a pending timeout, call it and cancel the timeout. */
flush: function flush() {
- if (this._type) {
+ if (this.isPending()) {
this.notify();
this.clear();
}
return this;
},
/** Return true iff we are waiting for a callback. */
isPending: function isPending() {
- return !!this._type;
+ return this._type !== null;
}
};