[Greasemonkey] Weird GmScript error message

Aaron Boodman zboogs at gmail.com
Sat Aug 6 22:56:59 EDT 2005

On 8/6/05, Bill Donnelly <donnelly at snowcrest.net> wrote:
>  Does it mean that there really is an error in the script?


>  Is there any way to tell where it's at?

Use GM_log to try and narrow it down. This basically happens when an
event handler or something like that throws an error. In Deer Park,
this will throw an error with the correct line number:

var o = null;
alert(o.foo); // throw error because o is null. line number will be correct.

This won't have a good line number:

button.onclick = function() { alert(o.foo) }

So when you get errors like this you can safely presume it isn't in
any code which is "parse time" -- by which I mean that it gets run
right when the greasemonkey script gets run. The error has to be in
something which happens later, in response to an event of some sort.

In FF 1.0.x, you never get meaningful line numbers, at parse time or otherwise.


More information about the Greasemonkey mailing list