Closed
Bug 851231
Opened 12 years ago
Closed 12 years ago
Output console.jsm API calls to the browser console
Categories
(DevTools :: General, defect)
DevTools
General
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 23
People
(Reporter: msucan, Assigned: msucan)
References
Details
(Keywords: dev-doc-needed)
Attachments
(1 file, 2 obsolete files)
26.17 KB,
patch
|
Details | Diff | Splinter Review |
With the new Browser Console landing soon we want to better interact with the Console.jsm messages. We should output all calls to the browser console, in addition to dumping into the terminal as plaintext.
Assignee | ||
Comment 1•12 years ago
|
||
Changes for Console.jsm to make it output to the Browser Console. I also added support for the time() and timeEnd() methods.
Remaining things to do:
- add comments.
- do we have Console.jsm tests?
- potentially use ConsoleAPIStorage.jsm to keep API calls in memory, so they don't get lost if the Browser Console is not open. My worry is that we currently group console API calls by window IDs, and jsm's have no window ID, and I need to check when we can purge objects from the storage. Should we do it in this patch?
Thoughts?
Attachment #725052 -
Flags: review?(jwalker)
Comment 2•12 years ago
|
||
(In reply to Mihai Sucan [:msucan] from comment #1)
> Created attachment 725052 [details] [diff] [review]
> first cut
>
> Changes for Console.jsm to make it output to the Browser Console. I also
> added support for the time() and timeEnd() methods.
>
> Remaining things to do:
>
> - add comments.
> - do we have Console.jsm tests?
No, it started as a quick hack and has never been done properly.
> - potentially use ConsoleAPIStorage.jsm to keep API calls in memory, so they
> don't get lost if the Browser Console is not open. My worry is that we
> currently group console API calls by window IDs, and jsm's have no window
> ID, and I need to check when we can purge objects from the storage. Should
> we do it in this patch?
I'd be happy to do it as a followup
Comment 3•12 years ago
|
||
Comment on attachment 725052 [details] [diff] [review]
first cut
Review of attachment 725052 [details] [diff] [review]:
-----------------------------------------------------------------
Looks great so far
Attachment #725052 -
Flags: review?(jwalker) → review+
Assignee | ||
Comment 4•12 years ago
|
||
Cleaned-up the patch, added comments, made some bug fixes and added a test.
The test uses the new waitForMessages() helper, which I still add features to. Trying to keep actual tests as simple as possible. Suggestions are welcome.
Caching in ConsoleAPIStorage.jsm should be a follow up. I will open a bug report about that.
Thank you!
Attachment #725052 -
Attachment is obsolete: true
Attachment #736896 -
Flags: review?(jwalker)
Assignee | ||
Comment 5•12 years ago
|
||
Comment 6•12 years ago
|
||
Comment on attachment 736896 [details] [diff] [review]
proposed patch
Review of attachment 736896 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/devtools/Console.jsm
@@ +317,5 @@
> + * An array of {filename, lineNumber, functionName, language} objects.
> + * These objects follow the same format as other console-api-log-event
> + * messages.
> + */
> +function getStackForConsoleAPI(aFrame, aMaxDepth = 0) {
I don't think we need both getStackForConsoleAPI and getStack do we? Can't we make callers of getStack use the data structure returned by getStackForConsoleAPI ?
Attachment #736896 -
Flags: review?(jwalker) → review+
Assignee | ||
Comment 7•12 years ago
|
||
Thanks for the review. Yes, it makes sense to remove the old getStack(). I actually renamed getStackForConsoleAPI() into getStack(), since we don't keep both.
Landed in fx-team:
https://hg.mozilla.org/integration/fx-team/rev/2cecd940c219
(try push was green)
Attachment #736896 -
Attachment is obsolete: true
Assignee | ||
Comment 8•12 years ago
|
||
It would be nice if there would be some MDN page where devs are told about this Console.jsm and that extension authors can Cu.import it. Using the console API with the Browser Console is much nicer than alert() or dump().
Keywords: dev-doc-needed
Comment 9•12 years ago
|
||
For devtools bugs marked dev-doc-needed we should also cc Will Bamberg just to make the bug a little more visible for him.
Comment 10•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 23
Updated•7 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•