[w3c/ServiceWorker] safari fetches from memory cache instead of Service worker (#1510)

Question 1 is asked so that Question 2 strange behaviour might be explained or something. 


**Question 1)** Let's say browser requests a `index.js` file . There are different steps involved where this file should be brought from.  So , let's take a look at scenario where browser first goes to check if the file is present there and if not, where it goes next.
 * Memory Cache -> Service Worker -> Disk Cache -> Network

 This is the sequence I think is most valid. Do you agree?

**Question 2)** Now, I found out the following about Safari on MacOS.

I went to the page for the first time, service worker's install event gets called and things get precached from there (I checked and they are precached). Now, I refreshed the page and looking at network tab, requests all get returned from `Service Worker` in transfer column. Now, I refresh Again and it looks like some of those files,  I'd say 80% gets returned from memory cache (that's what network's `transfer size` column says in safari. I am wondering why they get returned from `memory cache` after 2 refreshes? It seems like that now, I get an assumption that i can't full control some requests via service worker.  First, I was thinking maybe `safari` browser's `transfer` column size shows wrong information, but I tried to test it like this: 

I registered `fetch` listener and put `console.log(e.request.url)` there. After I refresh my website 2 times where `transfer` column shows that items get returned from `memory cache`, it seems like `fetch` listener doesn't get called for those urls that get brought from `memory` which makes my point that some of the urls don't get controlled after 2 refreshes and they keep coming back from memory cache. On chrome, this behaviour doesn't happen.  What could be the case?




-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1510

Received on Friday, 3 April 2020 13:01:00 UTC