Stacks for console.error stacks don't link to original locations
Categories
(DevTools :: Console, defect, P2)
Tracking
(firefox71 verified)
Tracking | Status | |
---|---|---|
firefox71 | --- | verified |
People
(Reporter: Harald, Assigned: nchevobbe)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
STR:
- Cause error on https://simple-webpack.glitch.me/
- Expand error in console
- Click
app.jsx
entry
AR: Opens bundle.js
in Debugger
ER: Open app.jsx
Assignee | ||
Comment 1•6 years ago
•
|
||
The sourcemap service does not pass the sourceId
of the mapped source when calling the subscribe
callback, which means we are re-using the one from the original frame (and then the debugger open the source for that sourceId
, i.e. the bundle).
The following patch seems to make it work:
diff --git a/devtools/client/framework/source-map-url-service.js b/devtools/client/framework/source-map-url-service.js
--- a/devtools/client/framework/source-map-url-service.js
+++ b/devtools/client/framework/source-map-url-service.js
@@ -321,10 +321,10 @@ SourceMapURLService.prototype._callOneCa
const resolvedLocation = await subscriptionEntry.promise;
if (resolvedLocation) {
- const { line, column, sourceUrl } = resolvedLocation;
+ const { line, column, sourceUrl, sourceId } = resolvedLocation;
// In case we're racing a pref change, pass the current value
// here, not plain "true".
- callback(this._prefValue, sourceUrl, line, column);
+ callback(this._prefValue, sourceUrl, line, column, sourceId);
}
};
diff --git a/devtools/client/shared/components/SmartTrace.js b/devtools/client/shared/components/SmartTrace.js
--- a/devtools/client/shared/components/SmartTrace.js
+++ b/devtools/client/shared/components/SmartTrace.js
@@ -73,12 +73,19 @@ class SmartTrace extends Component {
new Promise(resolve => {
const { lineNumber, columnNumber, filename } = frame;
const source = filename.split(" -> ").pop();
- const subscribeCallback = (isSourceMapped, url, line, column) => {
+ const subscribeCallback = (
+ isSourceMapped,
+ url,
+ line,
+ column,
+ sourceId
+ ) => {
this.onSourceMapServiceChange(
isSourceMapped,
url,
line,
column,
+ sourceId,
index
);
resolve();
@@ -171,6 +178,7 @@ class SmartTrace extends Component {
filename,
lineNumber,
columnNumber,
+ sourceId,
index
) {
if (isSourceMapped) {
@@ -180,7 +188,7 @@ class SmartTrace extends Component {
this.setState(state => {
const stacktrace = (state && state.stacktrace) || this.props.stacktrace;
@@ -189,6 +197,7 @@ class SmartTrace extends Component {
filename,
lineNumber,
columnNumber,
+ sourceId,
})
.concat(stacktrace.slice(index + 1));
We probably need to update all the callbacks through the toolbox to make sure we pass the sourceId around.
What's strange is the sourceId doesn't seem to be used. So far as I've seen, viewSourceInDebugger doesn't find an actor with the mapped source ID, and falls back to https://searchfox.org/mozilla-central/source/devtools/client/shared/view-source.js#80. But any other non-existent sourceId works equally well.
Assignee | ||
Comment 3•6 years ago
|
||
The sourceId is then used in the various places where we call the sourcemap service.
A test is added in the console to make sure that we do navigate to the mapped
location in the debugger.
Comment 5•6 years ago
|
||
bugherder |
Updated•6 years ago
|
Assignee | ||
Comment 6•6 years ago
|
||
This revert the changes made in Bug 1587839, except the added test.
The safer fix to be uplifted is to only fix the original issue
in the SmartTrace component, where we remove any sourceId we might
have when creating the new mapped frame.
We also modify the browser_dbg-pretty-print-console test to ensure
clicking on a prettified location in the console does open the
debugger with the expected location.
Comment 8•6 years ago
|
||
bugherder |
Assignee | ||
Comment 9•6 years ago
|
||
It just occured to me that this was meant to be the patch for Bug 1589346 :/
Is there anything we can do to correct that? (the new patch need to be uplifted, and I'm afraid the bug number will be confusing?)
Comment 10•6 years ago
|
||
Backed out changeset fac6219649be (Bug 1587839) on request by nchevobbe, per comment 9
Comment 11•6 years ago
|
||
Comment 12•6 years ago
|
||
Comment on attachment 9103471 [details]
Bug 1587839 - Fix navigation to debugger from console on prettified sources. r=loganfsmyth.
Revision D50173 was moved to bug 1589346. Setting attachment 9103471 [details] to obsolete.
![]() |
||
Comment 13•6 years ago
|
||
Backout merged: https://hg.mozilla.org/mozilla-central/rev/b211b2e4f378
Updated•6 years ago
|
Comment 14•6 years ago
|
||
I have managed to reproduce the issue using Ubuntu 18.04 LTS x64 on Fx nightly 71.0a1 (2019-10-17), I can confirm that the issue is fixed on all OS platforms using the latest beta version.
Description
•