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

Aaron Boodman zboogs at gmail.com
Sun Aug 28 17:42:52 EDT 2005


On 8/28/05, Michael Kraft <mjk4984 at yahoo.com> wrote:
> One other idea.  The call at the end of
> GM_DocHandler.prototype.onProgressChange that removes the the listener executes
> all the time (even if the doc content is found to be invalid).  It would seem
> better to only unregister if the valid doc content was found since it must show
> up eventually.
> 
> The only possible downside I could see to this is if GM somehow misses the
> first real change in the document and never removes the listener.  I don't know
> if it is even possible to miss the first change, but it could be removed later
> if needed.

Yeah that's a good point, I'll look into it.

> One other thing I noticed while looking at the code.  I noticed a discrepency
> between the nsIWebProgressListener reference at
> http://www.xulplanet.com/references/xpcomref/ifaces/nsIWebProgressListener.html#method_onProgressChange
> and how GM is using it in the code.  GM listens for the onProgressChange event,
> but the arguments that it listens for don't match up with the onProgessChange
> function as defined.  It does match up with the onStateChange function.  Is
> that what what GM meant to use?

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.

-- 
Aaron


More information about the Greasemonkey mailing list