Closed Bug 641670 Opened 14 years ago Closed 14 years ago

Make the global 'console' object send messages to both the command line and Error Console

Categories

(Add-on SDK Graveyard :: General, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jwatt, Assigned: adw)

Details

Attachments

(1 file)

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.
Priority: -- → P3
Target Milestone: --- → 1.0
Attached patch patchSplinter Review
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.)
Attachment #539616 - Flags: review?(myk)
(automatic reprioritization of 1.0 bugs)
Priority: P3 → P2
Target Milestone: 1.0 → 1.1
Comment on attachment 539616 [details] [diff] [review] patch Looks good, seems to work fine, r=myk.
Attachment #539616 - Flags: review?(myk) → review+
Assignee: nobody → adw
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: