When I run my add-on using cfx from the command line I expect it to behave the same as it would when running it normally. It was therefore quite unexpected for me that messages I sent using the global 'console' object were not appearing in the Error Console. It was pointed out to me on IRC that this is because the messages go to the command line when Firefox is run from the command line. To make add-ons behave the same as they would when running live, it would seem like the messages sent to the global 'console' object should be sent to the Error Console as well as the command line (a suggestion by myk).
Yup, I absolutely agree. It's great that the messages get sent to the terminal, since that makes it easier for developers to debug their addons, but they should also get sent to the Error Console, so the behavior of the addon within Firefox is the same as it will be when it is being used by a user.
Created attachment 539616 [details] [diff] [review] patch This should do it... The forsaken console dump function, in addition to logging to the console service, also does a standard dump. I ran into a problem with the test harness. It prints everything that goes through nsIConsoleService. Since this patch changes the default print function to log to the console, the result is endless recursion. (It's actually not endless since stack depth is clamped by the JS engine, I think.) So I modified the test harness to print only nsIScriptErrors. That breaks the recursion because the default print function just logs ordinary messages to the console and not nsIScriptErrors. Since ordinary messages ought not indicate error, this seems reasonable anyway. (But note bug 664518.)
(automatic reprioritization of 1.0 bugs)
Comment on attachment 539616 [details] [diff] [review] patch Looks good, seems to work fine, r=myk.