Support formatting the current stack using Log.jsm / Log.stackTrace()
Categories
(Toolkit :: General, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox102 | --- | fixed |
People
(Reporter: Irving, Assigned: sabina.zaripova, Mentored)
References
Details
(Whiteboard: [lang=js])
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
Reporter | ||
Updated•10 years ago
|
Comment 1•10 years ago
|
||
Updated•10 years ago
|
Updated•10 years ago
|
Reporter | ||
Comment 3•10 years ago
|
||
Reporter | ||
Updated•10 years ago
|
Updated•10 years ago
|
Comment 4•3 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.
@markh As far as I understood, we need to consider 2 cases:
Case 1:
Input: 'e' is an nsIStackFrame object
Output: format the stack it represents
? What should be the output in this case? How should it be formatted?
Also the information about nsiStackFrame is no longer available via https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIStackFrame
Case 2:
Input: 'e' has no value (empty)
Output: 'Components.stack.caller' (which returns nsiStackFrame object)
Is it right? Can you please give some direction?
Comment 6•3 years ago
|
||
I'll do my best, but lots has changed in the last 8 years :)
nsIStackFrame is defined in https://searchfox.org/mozilla-central/source/xpcom/base/nsIException.idl - notably, it has a formattedStack
attribute, which is probably all you need to do - there's no value in trying to invent our own formatting here.
Components.stack.caller
does still exist this link shows all existing references to it. So case 2 is, pretty much, the same as case 1, but using Components.stack.caller
instead of the arg.
Specifically, in the browser console you can see something like:
>> Components.stack.caller.formattedStack
"getEvalResult@resource://devtools/server/actors/webconsole/eval-with-debugger.js:243:24
exports.evalWithDebugger@resource://devtools/server/actors/webconsole/eval-with-debugger.js:167:14
evaluateJS@resource://devtools/server/actors/webconsole.js:1118:38
evaluateJSAsync/<@resource://devtools/server/actors/webconsole.js:1010:35
exports.makeInfallible/<@resource://devtools/shared/ThreadSafeDevToolsUtils.js:103:22
"
which looks fine, although you probably want to trim trailing \n chars.
So adding support for these cases here is probably what you want to do - in other words, we would only return the new stack when we'd otherwise be returning "No traceback available"
The other part would be tests, and as usual, these are often the most painful. There are a couple of "test_Log*" files in this directory which might be a good starting point - but I guess you probably want a new file just for this feature, based on test_Log_stackTrace.js
, but named something like test_Log_nsIStackFrame.js
or similar. For the test, it's probably OK to test 2 things - one when Components.stack.caller
is explicitly passed for your case 1, and one when nothing is passed (your case 2) - which would still be using Components.stack.caller
inside the module as described.
Currently, there is a problem with the launch of a browser console, followed by this error:
JavaScript error: resource://devtools/shared/loader/base-loader.js, line 169: Error: Module `devtools/shared/webconsole/messages` is not found at resource://devtools/shared/webconsole/messages.js
Comment 8•3 years ago
|
||
Sorry, I've no idea what could cause that - maybe your build isn't complete?
Updated•3 years ago
|
Updated•2 years ago
|
Comment 10•2 years ago
|
||
Comment 11•2 years ago
|
||
bugherder |
Description
•