Breakpoints for source maps with sections are not hit

NEW
Unassigned

Status

P3
normal
3 years ago
7 days ago

People

(Reporter: tiddolangerak, Unassigned)

Tracking

(Blocks: 2 bugs)

43 Branch
x86_64
Linux
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

1.13 KB, application/x-gzip
Details
6.75 KB, application/javascript
Details
(Reporter)

Description

3 years ago
Created attachment 8705105 [details]
sourcemaps_sections.tar.gz

User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0
Build ID: 20151210112415

Steps to reproduce:

1. I created a javascript file with sourcemaps, where the actual mappings are put in the `sections` field of the source map
2. I placed a breakpoint in the file with the dev tools
3. Dev tools did not stop on the breakpoint

Additional info:
- The breakpoint was hit in the dev tools for Chrome, which make me believe the sourcemap is correct.
- A functionally identical sourcemap without sections does work properly in Firefox.
- Firefox did seem to parse the sourcemap correctly: checking "Pause on Exceptions" does cause the dev tool to halt on the correct line with thrown exceptions. 

Attached is a tar with 4 files: 
- index_sections.js: a javascript file with the sourcemap mappings in the sections field. This script contains a small loop that logs a line and throws an exception. On this file breakpoints do not work.
- index_nosections.js: identical to `index_sections.js`, but now with sourcemaps without the sections field. On this file breakpoints do work
- sections.html: HTML file that loads the index_sections.js
- nosections.html: HTML file that loads the index_nosections.js


The sourcemaps in both files are inlined. Their decoded versions are as followed:

With sections:
```
{
  "version": 3,
  "file": "out/index.js",
  "sections": [
    {
      "offset": {
        "line": 0,
        "column": 0
      },
      "map": {
        "version": 3,
        "sources": [
          "index.js"
        ],
        "names": [],
        "mappings": ";;AAAA,WAAW,CAAC,YAAK;AAChB,QAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAC9B,OAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;CACzB,EAAE,IAAI,CAAC,CAAC",
        "file": "out/index.js",
        "sourceRoot": "src",
        "sourcesContent": [
          "setInterval(() =>{\n\tconsole.log(\"about to throw\");\n\tthrow new Error('error');\n}, 1000);\n"
        ]
      }
    }
  ]
}

```

Without sections:
```
{
  "version": 3,
  "sources": [
    "index.js"
  ],
  "names": [],
  "mappings": ";;AAAA,WAAW,CAAC,YAAK;AAChB,QAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAC9B,OAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;CACzB,EAAE,IAAI,CAAC,CAAC",
  "file": "out/index.js",
  "sourceRoot": "src",
  "sourcesContent": [
    "setInterval(() =>{\n\tconsole.log(\"about to throw\");\n\tthrow new Error('error');\n}, 1000);\n"
  ]
}
```


Actual results:

Debugger did not pause on the breakpoint


Expected results:

Debugger should have paused on the breakpoint
(Reporter)

Updated

3 years ago
Version: 41 Branch → 43 Branch
(Reporter)

Comment 1

3 years ago
Created attachment 8705106 [details]
sourcemaps_sections.tar.gz

Previous one was not the version I posted the sourcemaps for
Attachment #8705105 - Attachment is obsolete: true
(Reporter)

Updated

3 years ago
OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Component: Untriaged → Developer Tools: Debugger
:fitzgen, any idea if this is a known issue?
Flags: needinfo?(nfitzgerald)
AFAIK, we don't have any other bugs on file for this.
Blocks: 771597
Flags: needinfo?(nfitzgerald)
This seems to affect Webpack generated source maps for me, e.g. where multiple files are compiled into one bundle.

Comment 5

2 years ago
I wrote a tool to merge sourcemaps in concatenated javascript files and I've noticed in Firefox 50 (Fedora 25) that I simply cannot set breakpoints in the debugger, while chrome/chromium has no issues with it. The file has an inline sourcemap instead of referencing an external file, I'll go ahead and attach it as an example.

Comment 6

2 years ago
Created attachment 8824793 [details]
broken-sourcemap-sections.js
See https://github.com/mozilla/source-map/issues/16 for the upstream bug.

Updated

2 years ago
Duplicate of this bug: 1056988

Updated

2 years ago
Blocks: 1339970
Priority: -- → P3
The original test case works for me with a recent build.

Stefan, I don't know what to do with the code you attached.
What would be most helpful would be a simple, complete test showing the problem.
One way is a tar or zip file like the original test case, that is, including
a .html file and whatever built files are needed.
Flags: needinfo?(stefan)
Looking upstream again, I think the remaining bug here is that the "url"
style of indexed source map does not work.  The source-maps library never
implemented the proposed API for fetching this data.
Flags: needinfo?(stefan)

Updated

6 months ago
Product: Firefox → DevTools
This is still relevant today.
Status: UNCONFIRMED → NEW
Ever confirmed: true
You need to log in before you can comment on or make changes to this bug.