[Greasemonkey] "Invalid document, could not get global object" error?

Aaron Boodman zboogs at gmail.com
Sun Aug 28 18:21:31 EDT 2005

Awesome. Send me a patch when you're comfortable with it (or if you
don't have the tools to patch, just mail with the changed code) and
I'll integrate it.

Thanks for your help.


On 8/28/05, Michael Kraft <mjk4984 at yahoo.com> wrote:
> --- Aaron Boodman <zboogs at gmail.com> wrote:
> > Hah! You're right. I think that I was listening to onStateChange at
> > one point, then changed it to onProgressChange but forgot to change
> > the parameter list. Luckily, I don't use anything except the first
> > two, which are the same for both methods.
> >
> > Thanks. It should definitely be onProgressChange though.
> >
> Ok I think I found a fix for the problem I'm having based on the parameters
> being passed in.  From my experiments with logging the the fourth parameter
> (PRInt32 maxSelfProgress) in the onProgessChange callback in GM_DocHandler I
> found that it is always -1.  The only time I've found it to be not -1 is when I
> hit that error (it was 622) which seems to occur if the page hasn't unloaded.
> This seems to make sense since the maxSelfProgress wouldn't be known unless the
> page has already finished loading (-1 means unknown).
> I added a check to make sure the maxSelfProgress is -1 when it checks to see if
> the DomWindow is the unsafeContentWin at the top of the function.  I then
> logged the maxSelfProgress and the url to see what happened when it wasn't -1.
> Well it showed up as 622 a couple of times and then went to -1 and the script
> worked as normal.
> I haven't played with it long enough to see if it won't break anything else,
> but as far as I can tell it won't.  In fact it might fix some pages that are
> slow to load.
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey

More information about the Greasemonkey mailing list