Is it possible to access the previously-logged output of Firebug programmatically?
For example:
console.log('a');
console.log('b');
console.log('c');
for (var i = 0; i < console.output.length; ++i) {
alert(console.output[i]); // "a", "b", "c"
}
Paul Irish created a wrapper for console.log that should solve your problem, have a look here
Without wrapping window.console
yourself, I don't believe this is possible. Looking at the source, it seems that when a Firebug's console
method (running within the main document and therefore having no special privileges) is called, it leaves some objects lying around in the main document and then raises a custom event. A Firebug listener running in privileged-plug-in-land picks up the event, gobbles up the objects left in the document and adds appropriate things to the console panel, which is part of the browser chrome and therefore inaccessible to JavaScript running in the main window.
I could be wrong about the details of this because I've only taken a cursory look at the Firebug source and done very little Firefox plug-in development, but I think this is broadly correct.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With