WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
162963
Rename CachedResourceRequest as FetchedResourceRequest
https://bugs.webkit.org/show_bug.cgi?id=162963
Summary
Rename CachedResourceRequest as FetchedResourceRequest
youenn fablet
Reported
2016-10-05 03:08:11 PDT
This would help readability.
Attachments
Patch
(104.73 KB, patch)
2016-10-05 03:54 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(103.46 KB, patch)
2016-10-05 04:11 PDT
,
youenn fablet
beidson
: review-
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
youenn fablet
Comment 1
2016-10-05 03:54:37 PDT
Created
attachment 290703
[details]
Patch
youenn fablet
Comment 2
2016-10-05 03:58:09 PDT
The name FetchedResourceRequest is pretty long though. Here are some other alternatives: - Request (but maybe too short...) - FetchResourceRequest - FetchRequest (but we would need to rename FetchRequest to something like FetchAPIRequest)
youenn fablet
Comment 3
2016-10-05 04:11:22 PDT
Created
attachment 290705
[details]
Patch
Brady Eidson
Comment 4
2016-10-05 10:15:08 PDT
Are CachedResourceRequests still used in the MemoryCache?
youenn fablet
Comment 5
2016-10-05 12:27:25 PDT
(In reply to
comment #4
)
> Are CachedResourceRequests still used in the MemoryCache?
They are currently passed to CachedResource constructor to initialise it, in particular moving the ResourceRequest. The idea behind this patch is that CachedResourceLoader is the entry point of the fetch algorithm. That is probably where we would like to intercept requests and forward them to the service worker, should we implement it. MemoryCache is only a part of CachedResourceLoader duty, which also handles all the fetch options to generate the exact request. CachedResourceLoader should therefore take a FetchRequest as input, return a FetchResource and be renamed to something like ResourceFetcher. The idea would also be to rename most of the CachedXX classes. If we can rename FetchRequest to Request (Request is the name by which it is exposed on JS scripts), we could contemplate renaming FetchedResourceRequest to the simpler FetchRequest.
Brady Eidson
Comment 6
2016-10-05 16:34:28 PDT
I think renaming the entire set of Cached* classes to be prefixed by Fetch hurts readability and clarity in the code base. I don't necessarily think "CachedResourceRequest" is a great name, but I'm certain FetchedResourceRequest is a bad one as long as it serves duty for a mechanism that is not the Fetch API. Fetch is an exception to how resources are loaded and stored in memory/on disk; not the rule.
youenn fablet
Comment 7
2016-10-05 23:23:03 PDT
(In reply to
comment #6
)
> I think renaming the entire set of Cached* classes to be prefixed by Fetch > hurts readability and clarity in the code base.
I agree there is less incentive to do so for CachedResource and relatives. I disagree for CachedResourceLoader and CachedResourceRequest.
> I don't necessarily think "CachedResourceRequest" is a great name, but I'm > certain FetchedResourceRequest is a bad one as long as it serves duty for a > mechanism that is not the Fetch API.
We might be talking of two different fetch then :) The general mechanism is called fetch algorithm. Fetch API is one client amongst others (XHR, HTML...) of the fetch algorithm. FetchOptions was introduced in Source/WebCore/loader for the purpose of the fetch algorithm. This allows clients of CachedResourceLoader to start setting fetch options like defined in HTML specs. Let's take XHR as an example.
https://xhr.spec.whatwg.org/#the-send()-method
step 6 says: Let req be a new request, initialized as follows: ... mode: "cors" credentials mode: If the withCredentials attribute value is true, "include", and "same-origin" otherwise. XMLHttpRequest::createRequest does: options.credentials = m_includeCredentials ? FetchOptions::Credentials::Include : FetchOptions::Credentials::SameOrigin; options.mode = FetchOptions::Mode::Cors;
> Fetch is an exception to how resources are loaded and stored in memory/on > disk; not the rule.
For loader clients and in the HTML specs, the notion of memory/on disk cache is not very relevant. Whenever a resource needs to be loaded, the term coined is "fetch a resource" or "fetch a request". It would help to mirror this in the code. I would like to rename CachedResourceLoader/CachedResourceRequest to something that: - Has Fetch in it - Does not have Cached in it - Does not have Loader in it For CachedResource and relatives, this is less an issue, although I do not see what the Cached prefix brings.
youenn fablet
Comment 8
2016-10-05 23:41:56 PDT
Two additional pointers:
https://fetch.spec.whatwg.org/#requests
maps to CachedResourceRequest
https://fetch.spec.whatwg.org/#request-class
maps to FetchRequest
youenn fablet
Comment 9
2016-10-17 08:18:11 PDT
Can we make progress on this? I am fine renaming CachedResourceRequest to FetchRequest (and then rename FetchRequest to FetchAPIRequest or just Request).
Brady Eidson
Comment 10
2018-02-14 10:34:23 PST
Comment on
attachment 290705
[details]
Patch Patches that have been up for review since 2016 are almost certainly too stale to be relevant to trunk in their current form. If this patch is still important please rebase it and post it for review again.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug