Bug 157650 - REGRESSION: Web Inspector: Fails to load sourceMappingURL with relative URL
Summary: REGRESSION: Web Inspector: Fails to load sourceMappingURL with relative URL
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
: 159066 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-05-12 17:43 PDT by Joseph Pecoraro
Modified: 2016-06-23 13:02 PDT (History)
9 users (show)

See Also:


Attachments
[TEST] Test Case (3.45 KB, application/zip)
2016-05-12 17:43 PDT, Joseph Pecoraro
no flags Details
[PATCH] Proposed Fix (2.27 KB, patch)
2016-05-12 17:52 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2016-05-12 17:43:27 PDT
Created attachment 278789 [details]
[TEST] Test Case

* SUMMARY
Fails to load sourceMappingURL with relative URL.

* TEST
- index.html
  - assets/
    - style.css
    - style.css.map

Inside: style.css
/*# sourceMappingURL=assets/style.css.map */

* STEPS TO REPRODUCE
1. Inspect index.html
2. Show Resources
3. Reload
  => Source Map failed to load
  => Error shows wrong URL "/style.css.map" instead of "/assets/style.css.map"

* NOTES
Spec says the sourceMappingURL should be resolved relative to the resource it is in:
<https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit>

> When the source mapping URL is not absolute, then it is relative to the generated
> code’s “source origin”. The source origin is determined by one of the following cases:

>   If the generated source is not associated with a script element that has a “src” attribute
>   and there exists a //# sourceURL comment in the generated code, that comment should be used
>   to determine the source origin. Note: Previously, this was “//@ sourceURL”, as with
>   “//@ sourceMappingURL”, it is reasonable to accept both but //# is preferred.
>   
>   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.
>   
>   If the generated code is associated with a script element and the script element does
>   not have a “src” attribute, then the source origin will be the page’s origin.
>   
>   If the generated code is being evaluated as a string with the eval() function or via
>   new Function(), then the source origin will be the page’s origin.
Comment 1 Joseph Pecoraro 2016-05-12 17:43:46 PDT
<rdar://problem/26133763>
Comment 2 Joseph Pecoraro 2016-05-12 17:52:05 PDT
Created attachment 278791 [details]
[PATCH] Proposed Fix
Comment 3 WebKit Commit Bot 2016-05-12 18:23:59 PDT
Comment on attachment 278791 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 278791

Committed r200806: <http://trac.webkit.org/changeset/200806>
Comment 4 WebKit Commit Bot 2016-05-12 18:24:02 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Joseph Pecoraro 2016-06-23 13:02:25 PDT
*** Bug 159066 has been marked as a duplicate of this bug. ***