Skip to content


Error: Invalid arguments to GM_util.hitch() when trying to use setTimeOut() #1552

martinmitchell opened this Issue · 5 comments

6 participants


FF 12.0
GS 0.9.19

Rolling back to 0.9.18 fixes the issue.

When a script is using setTimeOut in the Error Console I see " Error: Invalid arguments to GM_util.hitch(). "


yes, I got the same problem. the same code worked just fine yesterday, and today it doesn't work anymore. I checked the add-ons in FF, it just updated the GM to 0.9.19, and it doesn't work anymore!
btw, the setInterval() works just like before.


Note: This only happens when using a string as first parameter to setTimeout, e.g.

setTimeout("alert(1)", 0);

I had it happening with either of these cases, so maybe when it parses a string?

} else {
setTimeout(function(){window.location.href = 'page.php?id=2'}, 4000);


I didn't think passing a string to setTimeout ever worked. Isn't that one of the "Greasemonkey pitfalls"?


There's two separate issues

1) If you pass a string to setTimeout it fails with "Invalid arguments to GM_util.hitch()". This used to work in 0.9.18.
2) If you use a delay of ~> 2 seconds setTimeout fails silently.

setTimeout(function() { alert('foo1'); }, 1000);  //This works
setTimeout(function() { alert('foo2'); }, 5000);  //This fails silently
setTimeout("alert('foo3')", 2000);  //This fails with GM_util error
@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
@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.