[Greasemonkey] "Invalid document,
could not get global object" error?
Michael Kraft
mjk4984 at yahoo.com
Sun Aug 28 14:34:52 EDT 2005
--- Aaron Boodman <zboogs at gmail.com> wrote:
> In my testing, the first progress change event after document_start
> had the correct document in place already, but it seems like sometimes
> document unload is slower than that :-(.
>
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.
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?
I'm trying to see if the stateFlag can be used somehow. I'm going to look into
that, but wanted to send this out first to see if it should be onProgressChange
or onStateChange.
More information about the Greasemonkey
mailing list