Bug 597286, part 1: fix Util.Timeout bugs [r=mfinkle]
authorBenjamin Stover <bstover@mozilla.com>
Wed, 22 Sep 2010 15:03:48 -0700
changeset 66680 631fc543b06fb965fc3e5e962f2b66b60ba1392b
parent 66679 955a75a5ba25b0858e1c992df36fca037ca923c7
child 66681 f34d494e99b2bbf1bab640155e8b0278a1fd3930
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs597286
Bug 597286, part 1: fix Util.Timeout bugs [r=mfinkle]
mobile/chrome/content/Util.js
--- 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;
   }
 };