absolute urls not working with sourcesContent and source maps in file:// urls

RESOLVED FIXED in Firefox 24

Status

RESOLVED FIXED
6 years ago
5 months ago

People

(Reporter: fitzgen, Assigned: fitzgen)

Tracking

unspecified
Firefox 24
x86
Mac OS X

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Test case here: https://gist.github.com/int3/5769221

debugger should display "foo", not "nothing here".
Works when I serve the directory via `python -m SimpleHTTPServer`, seems to only be failing for file:// urls.
Summary: absolute urls not working with sourcesContent and source maps still → absolute urls not working with sourcesContent and source maps in file:// urls
So after looking into this more, I believe we have the correct behavior.

If our root is "file:///Users/fitzgen/scratch/int3/" then there is no hostname (file URIs don't have them) and the path is "/Users/fitzgen/scratch/int3/". Resolving the absolute path "/a" to our root, we replace the existing path with our new one and get "file:///a".

This is maybe confusing for people who think that if they load "file:///Users/fitzgen/scratch/int3/foo.html" then "/foo.html" is the path, and "/Users/fitzgen/scratch/int3" is the hostname. But that isn't how file:// URIs work.

However, when I open the same file URI in Chrome, it does source map the contents. Funny enough, it still names the source "file:///a".

We could possibly fix this by not setting sourceRoot when we fetch the source map, and then we can special case this code if we want.

Comment 5

6 years ago
Is this what chrome is doing in that case?
(In reply to Dave Camp (:dcamp) from comment #5)
> Is this what chrome is doing in that case?

Yes

Updated

6 years ago
Attachment #766113 - Flags: review?(dcamp) → review+
https://hg.mozilla.org/mozilla-central/rev/9c3576b13848
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 24

Updated

5 months ago
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.