Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

setTimeout does not pass additional parameters correctly #1553

Closed
Ventero opened this Issue · 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".

@Ventero Ventero referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@arantius arantius referenced this issue from a commit in arantius/greasemonkey
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.