[Greasemonkey] "Invalid document,
could not get global object" error?
zboogs at gmail.com
Sun Aug 28 16:56:41 EDT 2005
On 8/28/05, Michael Kraft <mjk4984 at yahoo.com> wrote:
> Why exactly is that check there? Is there a way to keep it from checking until
> the page finished unloading since that appears to be what the problem is?
The comments say why, but the reason is that Greasemonkey needs to get
an instance of several page methods that it can trust haven't been
tampered with by the content page.
The only way that it can do this in 1.0.x is to grab them before any
content has been processed. So it checks to see how much content has
been received and only processes scripts if no content has been.
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 :-(.
You seem proficient with extension dev. If you can come up with a
patch that does this (Grabs whatever is in new
XPCNativeWrapper(unsafeWindow, "document").document and wait until the
first progresschange that it is different, and fixes your problem, and
doesn't seem to break anything else, I'll add it.
More information about the Greasemonkey