Closed Bug 885597 Opened 9 years ago Closed 9 years ago

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

Categories

(DevTools :: Debugger, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 24

People

(Reporter: fitzgen, Assigned: fitzgen)

Details

Attachments

(1 file)

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.
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
Attachment #766113 - Flags: review?(dcamp) → review+
https://hg.mozilla.org/mozilla-central/rev/9c3576b13848
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 24
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.