Permalink
Browse files

Change goog.Timer to look for timer methods on goog.global instead of…

… goog.global['window'].

Using goog.global['window'] throws an exception if the domain is escalated after the window reference is saved. 

R=nicksantos
DELTA=15 (0 added, 0 deleted, 15 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=6084


git-svn-id: http://closure-library.googlecode.com/svn/trunk@2418 0b95b8e8-c90f-11de-9d4f-f947ee5921c8
  • Loading branch information...
1 parent 8559bee commit 05ae3d3df581a2cdec7a841dacc47786105af22f asweintraub@google.com committed Jan 6, 2013
Showing with 14 additions and 14 deletions.
  1. +14 −14 closure/goog/timer/timer.js
@@ -62,14 +62,14 @@ goog.Timer = function(opt_interval, opt_timerObject) {
*/
this.boundTick_ = goog.bind(this.tick_, this);
- /**
- * Firefox browser often fires the timer event sooner
- * (sometimes MUCH sooner) than the requested timeout. So we
- * compare the time to when the event was last fired, and
- * reschedule if appropriate. See also goog.Timer.intervalScale
- * @type {number}
- * @private
- */
+ /**
+ * Firefox browser often fires the timer event sooner
+ * (sometimes MUCH sooner) than the requested timeout. So we
+ * compare the time to when the event was last fired, and
+ * reschedule if appropriate. See also goog.Timer.intervalScale
+ * @type {number}
+ * @private
+ */
this.last_ = goog.now();
};
goog.inherits(goog.Timer, goog.events.EventTarget);
@@ -99,13 +99,13 @@ goog.Timer.prototype.enabled = false;
/**
* An object that implements setTimout, setInterval, clearTimeout and
- * clearInterval. We default to the window object. Changing this on
- * goog.Timer.prototype changes the object for all timer instances which can be
- * useful if your environment has some other implementation of timers than the
- * window object.
+ * clearInterval. We default to the global object. Changing
+ * goog.Timer.defaultTimerObject changes the object for all timer instances
+ * which can be useful if your environment has some other implementation of
+ * timers you'd like to use.
* @type {Object}
*/
-goog.Timer.defaultTimerObject = goog.global['window'];
+goog.Timer.defaultTimerObject = goog.global;
/**
@@ -259,7 +259,7 @@ goog.Timer.callOnce = function(listener, opt_delay, opt_handler) {
// using typeof to prevent strict js warning
listener = goog.bind(listener.handleEvent, listener);
} else {
- throw Error('Invalid listener argument');
+ throw Error('Invalid listener argument');
}
if (opt_delay > goog.Timer.MAX_TIMEOUT_) {

0 comments on commit 05ae3d3

Please sign in to comment.