Re: [slightlyoff/ServiceWorker] Handling race conditions - API for accessing pending requests? (#959)

> Would this necessarily be true if the first request hasn't completed yet? At what stage does an object get put in the http cache?

Yes.  Speaking at least for Firefox/Gecko, before thinking about talking to the network, the HTTP channel consults the cache at the same time it creates the entry.  Requests will be coalesced as long as the fetch/request is allowed to be served from cache.  (For example, a fetch cache mode of "no-store" would not be allowed to be served from cache and so could not be coalesced.)

Source-delving, if you look at Gecko's cache2 [CacheStorageService::AddStorageEntry](https://dxr.mozilla.org/mozilla-central/rev/97a52326b06a07930216ebefa5af333271578904/netwerk/cache2/CacheStorageService.cpp#1450), that code looks for an existing cache entry and creates a new handle to it if an entry already exists.  Otherwise, it creates the entry.  (And this is called by [CacheStorage::AsyncOpenURI](https://dxr.mozilla.org/mozilla-central/rev/97a52326b06a07930216ebefa5af333271578904/netwerk/cache2/CacheStorage.cpp#105) which is used by [nsHttpChannel::OpenCacheEntry](https://dxr.mozilla.org/mozilla-central/rev/97a52326b06a07930216ebefa5af333271578904/netwerk/protocol/http/nsHttpChannel.cpp#3403), which you can follow back to its callers, etc.)



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/959#issuecomment-240906941

Received on Friday, 19 August 2016 01:51:13 UTC