[Greasemonkey] Gm and browser loaded images

Bill Donnelly donnelly at snowcrest.net
Tue Jul 12 21:41:41 EDT 2005

Something is occurring for images loaded in browser windows.
I get the following logged messages:

   > GM_BrowserUI.onLocationChange
   * no handler registered for this content doc, exiting

which are in the function below. (GM_BrowserUI.onLocationChange)

The difference between an image and an HTML document is the
value of the document object and content type.

document == [object ImageDocument]      // versus [object HTMLDocument]
document.contentType == "image/png"     // or /gif, /jpg, /jpeg, etc.

I don't think GM_BrowserUI.contentLoad() is being called because
the DOMContentLoaded event probably isn't being signaled. (?)
I suppose it's possible that GM_BrowserUI.chromeLoad() isn't being
called, either. (?)

The image toolbar extension use the following in imagetoolbarOverlay.xul
to get called whether the browser loads a document or image or anything:

  <script type="application/x-javascript">
    window.addEventListener("load", imageToolbarInit, true);

Altho, maybe Gm does the equivalent using browser.js. (?)

 * The browser's location has changed. Usually, we don't care. But in 
the case
 * of tab switching we need to change the list of commands displayed in the
 * User Script Commands submenu.
GM_BrowserUI.onLocationChange = function(a,b,c) {
  GM_log("> GM_BrowserUI.onLocationChange");

  if (this.currentHandler != null) {
    this.currentHandler = null;

  this.currentHandler = this.getHandler(this.tabBrowser.selectedBrowser.
  if (!this.currentHandler) {
    GM_log("* no handler registered for this content doc, exiting")

  GM_log("< GM_BrowserUI.onLocationChange");

Jack the Ripper may have been quite insane,
but he had beautiful penmanship.
btw -- Don't look back!
The lemmings are gaining on you.

More information about the Greasemonkey mailing list