setTimeout does not pass additional parameters correctly #1553

Closed
Ventero opened this Issue May 10, 2012 · 0 comments

2 participants

@Ventero

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   ventero.de
// @include     *
// @version     1
// ==/UserScript==

setTimeout(function(a, b){alert(a.foo + "//" + 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".

@arantius arantius added a commit to arantius/greasemonkey that referenced this issue May 11, 2012
@arantius arantius Revert "Inject a custom setTimeout method into the sandbox."
This reverts commit 7eccacb.

Fixes #1549, #1552, #1553
Refs #1209
88b9019
@arantius arantius closed this May 11, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment