[Webkit-unassigned] [Bug 205294] New: import.meta.url: baseURL for a module script should be response URL, not request URL
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Dec 16 12:30:09 PST 2019
https://bugs.webkit.org/show_bug.cgi?id=205294
Bug ID: 205294
Summary: import.meta.url: baseURL for a module script should be
response URL, not request URL
Product: WebKit
Version: Safari 13
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: New Bugs
Assignee: webkit-unassigned at lists.webkit.org
Reporter: justinfagnani at google.com
According to: https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts:creating-a-module-script-2
The base URL for a module script should be the response URL, post any redirects. Currently Webkit is using the request URL.
This causes significant problems (and incompatibility with Firefox and Chrome) when there are redirects in the response for a module.
Imagine you are using something like `new URL('./foo.jpg', import.meta.url).href` to get the URL for an image relative to the main module of an NPM package. A CDN like unpkg.com will perform a redirect from `unpkg.com/foo` to the main module, ie: `unpkg.com/foo/index.js`. This causes there to be a difference in the image's URL depending on whether `import.meta.url` uses response or request URL. Response URL will give `unpkg.com/foo/foo.jpg` while request URL will give `unpkg.com/foo.jpg`.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20191216/f0c044ef/attachment.htm>
More information about the webkit-unassigned
mailing list