Francis Brosnan Blazquez wrote:
Hi John,

The basic strategy is to add a div element to the web page and a script tag. The script adds window.console.log() functions. These functions place strings on the div as attributes then raise an event on the div. Firebug attached an event listener when it injected the div. The listener peels off the strings to decide what to print in the Console tab of Firebug. In that last step you have to be careful to ensure that you don't run arbitrary code from the page.

Firebug's actually implementation is regrettably less concise. Rarely, the div injection can interfere with layout. And of course any object you add will collide with identical names used by pages.

It's a pitty. I'll try to check this anyway. I'm concerned about the
performance of these solution (listen for events), knowing that all
messages sent to console.{log|error|warn} are showed extremely slow on
firebug tab.
Do you think this is a problem of the event listener model or firebug is
doing some additional task that slows down console log?

No one else has complained about the Firebug console log performance. Firebug certainly does more work depending on the arguments. You could hack Firebug to time the two parts. The event-passing solution involves a fair bit of code but CPU is so fast now it hardly matters. Any I/O or memory allocation will be the bottleneck.

jjb
_______________________________________________
dev-tech-network mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-network

Reply via email to