closure-library
closure-library copied to clipboard
goog.debug.ErrorHandler.prototype.protectWindowFunctionsHelper_ ignores variable-number arguments for timer functions
protectWindowFunctionsHelper_
is used to protect setTimeout
, setInterval
, but does not behave as a transparent wrapper. setTimeout
and setInterval
, are supposed to take a callback, timeout, as well as a variable number of arguments to be passed into the callback[1]. Only the first two arguments are taken by the wrapper function[2]. As a result, the additional arguments are undefined when the function is called.
It's possible to work around this issue by binding the arguments to the callback before passing it into the timer functions, but it's best to match the original signature to avoid unexpected behaviour from breaking code.
[1] http://www.w3.org/TR/2011/WD-html5-20110525/timers.html#timers [2] https://github.com/google/closure-library/blob/master/closure/goog/debug/errorhandler.js#L279
PR?
Sorry, I'm not sure what you're asking.
PR = Pull Request
I don't have a pull request for you; I'm just reporting a bug.