If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

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

RESOLVED FIXED in 1.1

Status

Add-on SDK
General
P2
normal
RESOLVED FIXED
7 years ago
6 years ago

People

(Reporter: jwatt, Assigned: adw)

Tracking

unspecified

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

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
(Assignee)

Comment 2

6 years ago
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.)
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)

Comment 5

6 years ago
https://github.com/mozilla/addon-sdk/commit/c2ccedaddb576a776dc5d41c8da69a8af89db2a9
Assignee: nobody → adw
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.