Introduce a new nsIConsoleService.callFunctionAndLogException helper (to log the full error stack on exception originated from a call to WebExtensions API listeners)
Categories
(WebExtensions :: Developer Tools, enhancement, P2)
Tracking
(firefox115 fixed)
Tracking | Status | |
---|---|---|
firefox115 | --- | fixed |
People
(Reporter: rpl, Assigned: ochameau)
References
(Blocks 1 open bug)
Details
(Whiteboard: [addons-jira])
Attachments
(1 file, 2 obsolete files)
(deleted),
text/x-phabricator-request
|
Details |
In Bug 1792559 we are planning to make the exception raised by WebExtensions API event listener visible again in the AddonDebugging window, by re-creating the error caught internally and log it to the console service with the innerWindowID associated to the extension page that has originated the exception.
Unfortunately by just using the internals we have currently available (nsIScriptError.initWithWindowID + Services.console.logMessage) the resulting error visible in the AddonDebugging window will include only an incomplete error stack (limited to filename, row and column number for the last most recent component of the error's stack) and so we agreed to still proceed with the approach from Bug 1792559's (D166461)[https://phabricator.services.mozilla.com/D166461] so that the AddonDebugging window can at least show to the extension developers that there was an error originated by the call to the API event listener, but to look into introducing the additional changes needed to be able to include the complete error stack.
Reporter | ||
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
Note that it might be complex to pass the stack using existing nsIScriptError pipeline.
There might be creative ways to pass the exception, with its stack directly to DevTools JS code.
JavaScript errors are typically handled by ErrorMessageWatcher:
https://searchfox.org/mozilla-central/rev/d39a17381a14606032f7b8e82789bf281beb1241/devtools/server/actors/resources/error-messages.js#38
which currently uses this nsIConsoleListenerWatcher sub class:
https://searchfox.org/mozilla-central/rev/d39a17381a14606032f7b8e82789bf281beb1241/devtools/server/actors/resources/utils/nsi-console-listener-watcher.js#34-55
itself currently using the nsIConsoleService
to listen and retrieve existing messages.
If you are fine loosing errors that happens before devtools are opened you might notify JS code by some other means JS to JS. (observer service?).
Reporter | ||
Comment 2•2 years ago
|
||
Depends on D166461
Updated•2 years ago
|
Assignee | ||
Comment 3•2 years ago
|
||
Updated•2 years ago
|
Reporter | ||
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Reporter | ||
Comment 4•2 years ago
|
||
Updated•2 years ago
|
Updated•2 years ago
|
Reporter | ||
Updated•2 years ago
|
Comment 6•1 years ago
|
||
Backed out for bustages on nsConsoleService.cpp
Backout link: https://hg.mozilla.org/integration/autoland/rev/1e4431885638b92cae2abdb4f5281af5f03df035
Log link: https://treeherder.mozilla.org/logviewer?job_id=416597485&repo=autoland&lineNumber=81077
Assignee | ||
Updated•1 years ago
|
Comment 9•1 years ago
|
||
Assignee | ||
Comment 10•1 years ago
|
||
Hopefully this last changeset fixes non-unified build:
https://treeherder.mozilla.org/jobs?repo=try&revision=f47581efc03c59e745d707368a78151eb1a418a9
My typicaly try syntax wasn't triggerring non-unified builds.
Comment 11•1 years ago
|
||
Comment 12•1 years ago
|
||
bugherder |
Comment 13•1 years ago
|
||
Comment on attachment 9314608 [details]
Bug 1810582 - Use new helper to call callback and log exception in BaseContext applySafeWithoutClone and adjust test case expectations.
Revision D168138 was moved to bug 1834835. Setting attachment 9314608 [details] to obsolete.
Reporter | ||
Updated•1 years ago
|
Description
•