New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 676216 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Last visit 29 days ago
Closed: Dec 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

sourceMappingUrl not resolved relative to script "src" as per v3 spec

Reported by darrellt...@gmail.com, Dec 21 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393

Steps to reproduce the problem:
1. Create a local directory structure like so:

 /index.html
 /foo/bar.js
 /foo/bar.js.map

2. Edit the html file to include the javascript file like so:

<script type="text/javascript" src="/foo/bar.js"></script>

3. Open the js file, and ensure it has a sourceMappingUrl directive, pointing to the map file, but also ensure the purl has a leading / like so:

//# sourceMappingURL=/bar.js.map.

3. Serve the directory up to chrome (browse the index.html page)

What is the expected behavior?
According to the Sourcemap V3 spec:

 When the source mapping URL is not absolute, then it is relative to the generated code’s “source origin”. 

If the generated code is associated with a script element and the script element has a “src” attribute, the “src” attribute of the script element will be the source origin.

This means I would expect chrome to issue a request for the map file on /foo/bar.js.map

What went wrong?
Using fiddler (requests for source map files don't appear to show up on the network tab) chrome makes a request:

GET /bundle.js.map HTTP/1.1

The leading "/" in the sourceMappingUrl appears to make chrome treat the url as relative to the site root and I don't think this behaviour is right.

Did this work before? N/A 

Chrome version: 55.0.2883.87 m (64-bit)  Channel: stable
OS Version: 10.0
Flash Version: Shockwave Flash 24.0 r0
 
Labels: TE-NeedsTriageHelp

Comment 2 by allada@chromium.org, Jan 10 2017

Owner: lushnikov@chromium.org
Status: WontFix (was: Unconfirmed)
> This means I would expect chrome to issue a request for the map file on /foo/bar.js.map

This would be the case if you put a relative URL in the sourceMappingURL. Since you put the absolute path, the "path" part of the origin gets replaced.

This is inline with url resolution rules.

Sign in to add a comment