[Webkit-unassigned] [Bug 254283] New: No fetching of service worker script loaded via importScripts when updateViaCache is none on update()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 22 13:11:31 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=254283

            Bug ID: 254283
           Summary: No fetching of service worker script loaded via
                    importScripts when updateViaCache is none on update()
           Product: WebKit
           Version: Safari 15
          Hardware: Mac (Intel)
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Service Workers
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: dmytro.savochkin at gmail.com

Created attachment 465546

  --> https://bugs.webkit.org/attachment.cgi?id=465546&action=review

comparison of traffic between Safari and Chrome when doing update()

Suppose I have a simple web page that loads service worker with script
```
navigator.serviceWorker.register('sw.js', { scope: './', updateViaCache: 'none' });
```
and file sw.js contains this code
```
importScripts('https://dmytro-savochkin.github.io/debug-no-update-of-sw-in-safari/imported-sw.js');
```
and file imported-sw.js contains some additional code (seems to not matter what code exactly it is).


In this scenario after loading the page and waiting until service worker is installed I later call this code in the browser console (client console, not service worker console):
```
navigator.serviceWorker.ready.then(function(r) { r.update(); });
```
Then I can see in some traffic sniffer (I used Charles) that Safari only makes a single request to fetch sw.js file without making a request to fetch imported-sw.js file.
I was under the assumption that it should make two requests (one for sw.js, one for imported-sw.js) because I specified `updateViaCache: 'none'` during registration of service worker.
For example Chrome in this scenario makes two requests for these two files separately.


I uploaded the code here to check: https://dmytro-savochkin.github.io/debug-no-update-of-sw-in-safari/ 
Also I am attaching an image showing two merged screenshots from traffic sniffer for Safari and Chrome, the screenshots were made after I had called `navigator.serviceWorker.ready.then(function(r) { r.update(); });` five times in browser console.


To reproduce it I used Safari (15.6.1 (15613.3.9.1.16, 15613)), Chrome (111.0.5563.64 (Official Build) (x86_64)), and macOS (10.15.7).
(I haven't try it in newer Safari because it seems it's the newest available for my rather old Mac).

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230322/dcb56e32/attachment.htm>


More information about the webkit-unassigned mailing list