Open
Bug 1436017
Opened 6 years ago
Updated 2 years ago
fetch() a relative chrome: url results in error "x is not a valid URL"
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
UNCONFIRMED
People
(Reporter: duanyao.ustc, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0 Build ID: 20180128191252 Steps to reproduce: Navigate to chrome://devtools/content/framework/connect/connect.xhtml , , open devtools, and run this code `fetch('connect.xhtml')`. Actual results: A "TypeError: connect.xhtml is not a valid URL". Expected results: fetch() shoud succeed.
Updated•6 years ago
|
Component: Networking → DOM
Comment 1•6 years ago
|
||
We require absolute URLs in chrome script. Since chrome script does not always have a window its unclear where we should be getting a base URL from automatically. This would be the case even if we fix bug 1432481.
Comment 2•6 years ago
|
||
We could use the window base URL if the global is a window, even if it's system... I agree that for a JSM or something that's more complicated.
(In reply to Ben Kelly [:bkelly] from comment #1) > We require absolute URLs in chrome script. Since chrome script does not > always have a window its unclear where we should be getting a base URL from > automatically. This would be the case even if we fix bug 1432481. However, XHR works fine with the same url: var xhr = new XMLHttpRequest(); xhr.open('GET','connect.xhtml'); xhr.send();
Comment 5•6 years ago
|
||
Andrea, do you know how XHR does relative chrome script URL resolution? Do you have any bandwidth to fix this in fetch()?
Flags: needinfo?(amarchesini)
Comment 6•6 years ago
|
||
Actually, following the STR, fetch("connect.xhtml") works fine because there is a chrome window.
But if I run this code in a JSM:
> var xhr = new XMLHttpRequest();
> xhr.open('GET','connect.xhtml');
> xhr.send();
it fails as fetch() does: SyntaxError: The URI is malformed.
Flags: needinfo?(amarchesini)
Assignee | ||
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•