Closed Bug 1497927 Opened 6 years ago Closed 6 years ago

Firefox does't use source maps for javascript modules loaded with import

Categories

(DevTools :: Console, defect, P1)

62 Branch
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mail.eraserhead, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Attached image chrome_1--Firefox_0.png
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0

Steps to reproduce:

I have a Javascript file "cms_script.js" that imports javascript modules via import. One module is "CMS.js"
Each file has a source map.
I made an error in line 773 of CMS.js.


Actual results:

Firefox only uses the sourcemap of the "parent" javascript file "cms_script.js", but not of the imported module "CMS.js".
It shows the error in line 1:13818


Expected results:

the source map of the module "CMS.js" should be used.
The reported line should be 773.

I've attached a screenshot from Chrome (doing it correctly) and Firefox (doing it wrong).
Component: Untriaged → Debugger
Product: Firefox → DevTools
I'm sorry, looks like the problem only happens when the error occurs inside a try/catch construction - which is tricky to pinpoint.
I guess you can close this report.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Sorry again, I have to reopen this. As I said the source map is not used if the error happens inside a try/catch construction. But this is more annoying than I first thought. E.g. if inside try/catch a new class is instanced and an error happens inside that class Firefox also doesn't use the source map (while Chrome does).
So I guess you have to make sure the source map is always used when available.
Blocks: source-maps
Maybe a dup of bug#1471509.
Component: Debugger → Console
Could you try it again, we recently fixed an issue with sourcemaps in error stacks.
Attached image Firefox 63 vs Chrome 70
I'm afraid it's still not right. Please look at the new screenshot I uploaded.

- the error happens in CMS.sendPost() in line 392;
- CMS.sendPost() is called in a try/catch from cms_script.js
- the catch() is processed in CMS.modalError()

Firefox gives the correct lines for every called function except for the one where the error actually happens. There we only have the location in the compressed file.
If you compare to the Chrome output (I highlighted the important part) you'll see that Chrome got that line, too.

I checked with Firefox 63 and the latest Nightly.
;)
Good to know it's coming!
C.Martin, hello, could you try to reproduce the issue on the latest Firefox Nightly? Thanks!
Flags: needinfo?(mail.eraserhead)
Priority: -- → P1
Hello Nicolas, everything's fine in Nightly! Issue resolved.
Flags: needinfo?(mail.eraserhead)
🎉 Yay!
Thanks for checking :)
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: