Development Blog

Firebug Internals: ShowContext gets called twice?

I’m going to try to mention tidbits of info about Firebug implementation in this blog, under the category Firebug Internals.  They won’t make any sense unless you are looking at the Firebug source.

I was talking with Mike Collins about Firebug events and he was puzzled about the “ShowContext” event. Firebug modules (common logic units) get this event twice for every page load. Why?

ShowContext is intended to signal that the Firebug UI is now going to be shown to the user. When should that be? Well as soon as possible is mostly the answer. Certainly you want the Firebug UI to come up before the onLoad event for the page in case the developer needs to debug things that happen before that. Thus one ShowContext is sent as early as possible after initContext. But Firebug also wants to update the UI later and it uses ShowContext again at that point.

Firebug extensions then need to use ShowContext to refresh their view based on any data that may have changed. Roughly speaking a module will see initContext, showContext, loadedContext, and showContext as the page loads.  We’re hoping to make this more certain when we get support for document load started events.

Comments are closed.