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

Closed
martinmitchell opened this Issue May 10, 2012 · 5 comments

Comments

Projects
None yet
6 participants
@martinmitchell

Affecting:
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(). "

@cn1h

This comment has been minimized.

Show comment
Hide comment
@cn1h

cn1h May 10, 2012

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.

cn1h commented May 10, 2012

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.

@Ventero

This comment has been minimized.

Show comment
Hide comment
@Ventero

Ventero May 10, 2012

Contributor

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

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

Ventero commented May 10, 2012

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

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

This comment has been minimized.

Show comment
Hide comment
@martinmitchell

martinmitchell May 11, 2012

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

if(count>2){ console.log('Delete'); setTimeout('document.getElementById("del").click()',4000); } else { console.log('Next'); setTimeout(function(){window.location.href = 'page.php?id=2'}, 4000); }

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

if(count>2){ console.log('Delete'); setTimeout('document.getElementById("del").click()',4000); } else { console.log('Next'); setTimeout(function(){window.location.href = 'page.php?id=2'}, 4000); }
@mjh563

This comment has been minimized.

Show comment
Hide comment
@mjh563

mjh563 May 11, 2012

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

mjh563 commented May 11, 2012

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

@seanwlx

This comment has been minimized.

Show comment
Hide comment
@seanwlx

seanwlx May 11, 2012

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

seanwlx commented May 11, 2012

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 added a commit to arantius/greasemonkey that referenced this issue May 11, 2012

@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