Closed Bug 1237593 Opened 8 years ago Closed 2 years ago

Breakpoints for source maps with sections are not hit

Categories

(DevTools :: Debugger, enhancement, P3)

43 Branch
x86_64
Linux
enhancement

Tracking

(firefox107 fixed)

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: tiddolangerak, Assigned: bomsy)

References

(Blocks 2 open bugs)

Details

Attachments

(3 files, 1 obsolete file)

Attached file sourcemaps_sections.tar.gz (obsolete) —
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
Version: 41 Branch → 43 Branch
Previous one was not the version I posted the sourcemaps for
Attachment #8705105 - Attachment is obsolete: true
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.
Flags: needinfo?(nfitzgerald)
This seems to affect Webpack generated source maps for me, e.g. where multiple files are compiled into one bundle.
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.
Blocks: source-maps
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)
Product: Firefox → DevTools
This is still relevant today.
Status: UNCONFIRMED → NEW
Ever confirmed: true

moving to enhancement because sections is still experimental

Type: defect → enhancement
Assignee: nobody → hmanilla
Attachment #9296782 - Attachment description: Bug 1237593 - [devtools] Testing breakpoints on sources generated from source maps with sections → Bug 1237593 - [devtools] Test breakpoints on sources generated from source map with sections r=ochameau
Status: NEW → ASSIGNED

This seems to be fixed, so lets a test to cover it.

Julien, was that an issue with the profiler codebase?
It is fixed now?

The related issue in the upstream source-map package was:
https://github.com/mozilla/source-map/issues/16

But there is a followup issue, still unresolved:
https://github.com/mozilla/source-map/issues/437

Flags: needinfo?(felash)

I tried to set some breakpoints on the profiler codebase, both with webpack in development mode or in a production build. In both cases the breakpoint worked.
But of course our webpack version is now v5 while it probably was v3 back when I found this issue.

I would still mark it fixed and file a new bug if new problems arise.

Flags: needinfo?(felash)
Pushed by hmanilla@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2ceae3cbc35f
[devtools] Test breakpoints on sources generated from source map with sections r=ochameau
Severity: normal → S3
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: