You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



Who's Listening?

Gecko provides a few different callback mechanisms to support embedding level, content related, notifications. There are many observer/notification models used in Gecko. Those specific to content negotiation, handling and load progress are discussed here.

Below are two general listener categories: Content and Progress.

Content

Content listeners provide the ability to intercept/override, and block URI loads.

nsIURIContentListener
Provides the ability for content loading interception and re-direction. Registration is done via nsIWebBrowser::ParentURIContentListener()


Progress

Progress listeners provide feedback about URI loading. These listeners can be further broken out into two categories: broadcast and per-call.

broadcast

Broadcast listeners are registered once, per top-level window, and they receive callbacks for the lifetime of the window they register with. This registration is done via nsIWebBrowser::AddWebBrowserListener().

nsIWebProgressListener
Provides detailed progress information about a load (including any inline loading that occurs; img src= for example). This listener can be used to present "throbber" status, progress bar status, number of items downloaded status, etc.

nsISHistoryListener
Provides callbacks for session (per window url loads) history management.


per-call

Per-call listeners are registered once, per method call, and they receive more focused callbacks that pertain only to the action the caller initiated, for the duration of that "load."

nsIWebProgressListener
Provides detailed progress information about a load which includes any inline loads that occur as a result of the top-level load.
registration method: nsIHelperAppLauncher::SetWebProgressListener()

nsIWebBrowserPersistProgress
Provides the progress of a "save-as" operation.
registration method: nsIWebBrowserPersist::SetProgressListener()

nsIPrintListener
Provides the progress of a "print" operation.
registration method: nsIWebBrowserPrint::Print()