Extension Points

From FirebugWiki

Firebug provides number of ways how to append new features by developing a new extension. This document is intended to summarize and describe purpose of all these extension points. This document isn’t intended as a tutorial how to write an extension for Firefox.

The TabWatcher monitors Firefox tabs/windows. TabWatcher events primarily go to Firebug for redispatch to modules. This object could also be called ContextFactory, it creates instances of tabContext and maintains the mapping from window to contexts.

shouldCreateContext(win,uri): return true to force a URI to be debugged (new in 1.4, was acceptContext)

shouldNotCreateContext(win, uri): return true to prevent a URI from being debugged (new in 1.4, was declineContext)

initContext

showContext(browser, context): This is re-dispatched to modules, so TabWatchers get it first.

One of the first things the developer needs to do when building a new FB extension is creation of a new module. Each Module is represented by an object that’s usually derived from one of the predefined Module object.

Each panel in Firebug (like Console, Script, Net, etc.) is represented by an object that is derived from one of the predefined Panel objects. In order to create a new Panel a new object must be created.

Every panel in Firebug can utilize an Options menu that is displayed at the most right side of Firebug's tab bar. This menu is intended for panel's options (if any) and it's content is provided by current panel object. In order to populate the menu with some items, the panel object must override a getOptionsMenuItems method.

Infotips are used in Firebug UI for displaying additional information. Infotips are similar to tooltips but providing richer content. The content doesn't have to be only a text but any HTML. The content is usually generated using Domplate.

The info tip is usually displayed by panels. See the following example that shows how to override/implement showInfoTip method within a custom panel.

Each entry within Net panel represents a network request made by a given page. If this entry is expanded, several tabs are displayed to the user (like, Headers, Response, etc.) showing detailed info. Following code shows how a new tab can be created.

If you need to create a link within Firebug‘s UI that points to a specific network request within Net panel, use NetFileLink object.

// Navigation by URL
context.chrome.select(new FBL.NetFileLink("http://..."));// Navigation by request object (in case there can be more requests// with the same URI in the Net panel).
context.chrome.select(new FBL.NetFileLink(null, request));// Selection by file object (the object that is used to represent// a request in the Net panel).
context.chrome.select(file.getFileLink());