The Devtools navigate to the transformed file but not the source file when in switch statement with sourcemaps

RESOLVED FIXED

Status

defect
P2
normal
RESOLVED FIXED
8 months ago
2 months ago

People

(Reporter: harytfw, Unassigned)

Tracking

(Blocks 1 bug)

64 Branch
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Posted image dt.gif
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0

Steps to reproduce:

I found that when I using debugger to step into the switch statement, the Devtools navigates to the  transformed js file.
Here is a test typescript project: https://github.com/harytfw/devtool-bug



Actual results:

Devtools navigates to the transformed js file.


Expected results:

Devtools should stay in the source file.
Summary: The Devtools navigates to the transformed file but not the source file when in switch statement with sourcemaps → The Devtools navigate to the transformed file but not the source file when in switch statement with sourcemaps
Component: General → Debugger
Looks like the issue is that the column offset we get from Spidermonkey for the `case` state is `0`, which does not have a mapping to an original file. I fixed a bunch of these in https://bugzilla.mozilla.org/show_bug.cgi?id=1472291 bug it looks like we missed this one.
Example:


> var global = newGlobal();
> var dbg = new Debugger(global);
> dbg.onDebuggerStatement = onDebuggerStatement;
> 
> global.eval(`
> debugger;
> var name = {};
> switch (name) {
>     case name:
>         console.log('I like apple');
>         break;
>     default:
>         break;
> }
> `);
> 
> function onDebuggerStatement(frame) {
>     const { script } = frame;
>
>     console.log(JSON.stringify(script.getAllColumnOffsets(), null, 2));
> }

will log

> // ...
> {
>   "lineNumber": 5,
>   "columnNumber": 0,
>   "offset": 29
> },
> // ...

Note how the columnNumber for that `case` should be `4`.
Blocks: js-devtools
Priority: -- → P2

Logan, did we fix column offsets for switches?

Flags: needinfo?(lsmyth)
Blocks: dbg-control
No longer blocks: dbg-stepping

This should be all set now that specificity has landed in Nightly. I've refiled the specific position info issue as https://bugzilla.mozilla.org/show_bug.cgi?id=1533185, but it shouldn't be much of an issue at all now.

Status: UNCONFIRMED → RESOLVED
Closed: 5 months ago
Flags: needinfo?(lsmyth)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.