Closed Bug 1294036 Opened 8 years ago Closed 4 years ago

TypeScript files do not show up in the debugger when relative sourcemap paths are provided

Categories

(DevTools :: Debugger, defect, P3)

49 Branch
defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: mr.rob.smith, Unassigned)

References

(Blocks 2 open bugs)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0
Build ID: 20160808002253

Steps to reproduce:

Create compiled .js files with sourcemap reference
//# sourceMappingURL=dist/listview.js.map

(created by gulp task).

The problem is worked around by editing the gulp task to hack paths and filenames to produce an absolute path, but many people do not see/know this. A quick search on Stackoverflow, etc will turn up questions regarding this. Works fine in Chrome with absolute or relative paths.




Actual results:

.ts files do not show up in the sources list so cannot set breakpoints, etc


Expected results:

.ts files displayed in sources list.
OS: Unspecified → All
Hardware: Unspecified → All
Can you provide a standalone testcase?
QA Whiteboard: [bugday-20160815]
Component: Untriaged → JavaScript Engine
Flags: needinfo?(mr.rob.smith)
Product: Firefox → Core
Flags: needinfo?(mr.rob.smith)
I can confirm that relative URLs within sourcemaps don't seem to work, even without involving TypeScript.

Here's what I'm testing: (works in Chrome)
- A single minified javascript file (all.min.js)
- A sourcemap file (all.min.js.map)
- Source files in the same directory as minified file and sourcemap (a.js)
- HTML file references minified file (all.min.js)

Current outcome:
- Firefox is able to load the sourcemap file (and lists the source files in dev tools)
- Firefox does not resolve the relative paths correctly (to actually load sources)
  - Requests file with incorrect path, server responds with 404

Comment at end of minified file: //# sourceMappingURL=all.min.js.map
Summarized sourcemap file: {"version":3,"sources":["a.js","b.js","c.js"],  ...  ,"file":"all.min.js","sourceRoot":"./"}

URL for html file: http://localhost/app/index.html
URL for minified file: http://localhost/app/all.min.js
URL for sourcemap: http://localhost/app/all.min.js.map
URL for source file: http://localhost/app/a.js

Firefox requests this URL: http://localhost/a.js
(note the missing path entry)
Blocks: source-maps
Component: JavaScript Engine → Developer Tools: Debugger
Priority: -- → P3
Product: Core → Firefox
I tried to reproduce this today, using the greeter sample application from
https://github.com/Microsoft/TypeScriptSamples/

I tried several things.

1. "tsc --sourceMap"
   In this case the map looks like

{"version":3,"file":"greeter.js","sourceRoot":"","sources":["greeter.ts"],"names":[],"mappings":...}

2. Edit the map to have "sourceRoot":"./" (per comment #2)

3. Move the map to a subdirectory, edit the .js file to point to it, and use "sourceRoot":"../".

All of these work.

Do you know how I can modify the files to see the failure?
I'm wondering what the crucial difference is between the cases I tried and yours.
Flags: needinfo?(mr.rob.smith)
Hmmm.... this is going back sometime now. I since dropped FF for development because of this issue and haven't seen the problem again since then. I am not even using the same dev environment for front end work anymore.

Here is the issue being described on Stack Overflow.
http://stackoverflow.com/questions/37390087/firefox-isnt-showing-typescript-ts-source-maps-in-the-debugger/38874167#38874167

and again here
http://stackoverflow.com/questions/36424787/typescript-source-maps-in-firefox-console/38930816#38930816

And you will see that someone left a comment with further links to 
https://bugzilla.mozilla.org/show_bug.cgi?id=1224078
and
https://bugzilla.mozilla.org/show_bug.cgi?id=1223439

It seems perhaps a problem that affects SystemJS users with FF?

The issue has not yet been closed.

My final solution was to move away from SystemJS and use Chrome for development purposes, even though I prefer FF as a browser unfortunately it just doesn't seem to be delivering when it comes to development and debugging.
Flags: needinfo?(mr.rob.smith)
> It seems perhaps a problem that affects SystemJS users with FF?

Ok, yeah.  Investigation in one of the other bugs showed that the way that SystemJS introduces
new scripts hits some cases in the server code that aren't correct.  In the end I think the problem
here is about SystemJS and not typescript or relative URLs.  I'll probably close this as a dup unless
there's some reason to think this theory is incorrect...

Thanks for the links, that was very helpful.
Yup, the links were new to me as well. Saw them for the first time re-reading the old SO posts :) nice when the community joins the dots on automatic! Thanks for paying attention.
Cheers.
I can't recall which other bug this is a dup of - either <script> with sourceURL (bug 1224078)
or <script> with sourceMappingURL (bug 1400856).
Product: Firefox → DevTools

I tried to reproduce this using the description in https://bugzilla.mozilla.org/show_bug.cgi?id=1294036#c2 and it's not at all clear to me what specifically is being described here around SystemJS. I'm happy to re-open if someone can produce a good reproduction example to work with, but otherwise I'm not sure there's currently any way to move this bug forward.

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.