Closed
Bug 1130924
Opened 10 years ago
Closed 9 years ago
Add method of chrome only settings to fetch API
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: marcosc, Assigned: marcosc)
References
Details
Attachments
(2 files)
3.26 KB,
patch
|
Details | Diff | Splinter Review | |
5.12 KB,
patch
|
Details | Diff | Splinter Review |
> I think it might be easier to add a 3-arg form of fetch(), where the 3rd arg is a dictionary of chrome only settings. Then make the 3-arg form [ChromeOnly]. That way fetch could directly override some settings of Request.
Assignee | ||
Updated•10 years ago
|
Comment 1•10 years ago
|
||
You can't have different exposure settings on different overloads, unfortunately. That is, you can't mark one overload as [ChromeOnly]. Which is good, because doing it that way would mean that the chrome-only version constrained the way the API can evolve, no? We may want a [ChromeOnly] function with a different name that takes the settings dictionary in question....
Assignee | ||
Comment 2•10 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #1) > You can't have different exposure settings on different overloads, > unfortunately. That is, you can't mark one overload as [ChromeOnly]. > > Which is good, because doing it that way would mean that the chrome-only > version constrained the way the API can evolve, no? Yeah, I was thinking the same. > We may want a [ChromeOnly] function with a different name that takes the > settings dictionary in question.... Sounds good. Will do that.
Assignee | ||
Updated•10 years ago
|
Summary: Add dictionary of chrome only settings to fetch API → Add method of chrome only settings to fetch API
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → mcaceres
Assignee | ||
Comment 3•9 years ago
|
||
So I've managed to implement the method, but I think nsCORSListenerProxy is intervening (blocking requests explicitly marked as "no-cors"). It FailWithNetworkError() on line 620 in the "OnStartRequest" method. Any guidance on how to proceed would be appreciated.
Flags: needinfo?(nsm.nikhil)
Assignee | ||
Comment 4•9 years ago
|
||
Also, I was thinking we can then also dump `setContext()` before anyone it in favor of this more extensbile solution.
Comment on attachment 8566384 [details] [diff] [review] 0001-Bug-1130924-Add-method-of-chrome-only-settings-to-fe.patch Review of attachment 8566384 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/fetch/FetchDriver.cpp @@ +278,5 @@ > + bool corsFlag = true; > + if (mRequest->Mode() == RequestMode::No_cors){ > + corsFlag = false; > + } > + return HttpFetch(corsFlag); Why did you change this block? As in, I don't understand the intent.
Could you describe the situation or add a small test case where the fetch failed? What was the request, from which page/chrome was it called?
Flags: needinfo?(nsm.nikhil)
Assignee | ||
Comment 7•9 years ago
|
||
(In reply to Nikhil Marathe [:nsm] (needinfo? please) from comment #5) > Comment on attachment 8566384 [details] [diff] [review] > 0001-Bug-1130924-Add-method-of-chrome-only-settings-to-fe.patch > > Review of attachment 8566384 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: dom/fetch/FetchDriver.cpp > @@ +278,5 @@ > > + bool corsFlag = true; > > + if (mRequest->Mode() == RequestMode::No_cors){ > > + corsFlag = false; > > + } > > + return HttpFetch(corsFlag); > > Why did you change this block? As in, I don't understand the intent. IIRC, you had it set to always be "true". That would mean that overriding with "no-cors" would do nothing.
Assignee | ||
Comment 8•9 years ago
|
||
(In reply to Nikhil Marathe [:nsm] (needinfo? please) from comment #6) > Could you describe the situation or add a small test case where the fetch > failed? What was the request, from which page/chrome was it called? Will send a patch with the tests in a bit (in the middle of building :)), but it's basically this: ``` var url = "http://test1.example.org:80/tests/dom/tests/mochitest/fetch/fetch_chrome_helper.html"; var r = new w.Request(url); r.overrideSettings({mode: "no-cors"}); w.fetch(r).then(res=> console.log(res), (err)=> console.log(err)); ``` That gives shows me a "blocked by CORS" error in the JS console.
Assignee | ||
Comment 9•9 years ago
|
||
These are the tests thus far...
Assignee | ||
Comment 10•9 years ago
|
||
Might not need this particular functionality after all (as we might just force CORS by default)... I'll reopen depending on what happens with the web manifest spec.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•