setTimeout does not pass additional parameters correctly #1553

Ventero opened this Issue May 10, 2012 · 0 comments


None yet
2 participants

Ventero commented May 10, 2012

When supplying additional parameters (that is, parameters other than callback and timeout delay) to setTimeout, they are not correctly passed on. Instead, an array of all additional parameters is passed to the callback as first parameter, and a nsITimer instance as second parameter.

Example testcase (direct link to gist):

// ==UserScript==
// @name        Timeout additional parameter test
// @namespace
// @include     *
// @version     1
// ==/UserScript==

setTimeout(function(a, b){alert( + "//" + typeof b)}, 0, {foo:1}, {});

Steps to reproduce: Refresh any website
Expected output: An alert showing "1//object".
Observed output: An alert showing "undefined//object".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment