Bug 227072

Summary: Service worker sometimes inactive after browser start up
Product: WebKit Reporter: marian.schaub
Component: Service WorkersAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: cdumez, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari 14   
Hardware: Mac (Intel)   
OS: macOS 11   

Description marian.schaub 2021-06-16 08:39:15 PDT
We are witnessing a strange behaviour in Safari Desktop regarding service workers when the browser is initially started.

Steps to reproduce:
1. Visit https://sw-lifecycle-test.app.baqend.com/swTest/test.html . The Page will display "No SW Response" and install a simple service worker.
2. Close Safari (command+Q).
3. Open Safari and visit https://sw-lifecycle-test.app.baqend.com/swTest/test.html again.

While repeating steps 2 + 3 we saw different outcomes. Our expectation would be to always see "SW Response" since the installed service worker simply intercepts the html request and delivers a page with that content.
What we found is sometimes the page displayed "SW Response", but often displayed "No SW Response". In these cases we did not see a service worker in Develop -> Service Workers context menu, but navigator.serviceWorker.controller
referenced the correct service worker. Reloading (both soft and hard reload) did not reliably lead to the service worker being activated again.

We were able to reproduce this on serveral Mac Book Pro machines running Safari 14.1.1 (16611.2.7.1.4).

After analyzing our tracking data we estimate about 4% of the Safari page impressions on our customers pages are affected by this.
Comment 1 Chris Dumez 2021-06-17 10:10:07 PDT
I personally haven't been able to reproduce this yet on Safari 15 beta. I see "SW response" every time I relaunch Safari.
Comment 2 Radar WebKit Bug Importer 2021-06-23 08:40:31 PDT
<rdar://problem/79667318>
Comment 3 youenn fablet 2022-03-10 05:18:18 PST
@marian.schaub@baqend.com, can you still reproduce the issue with Safari 15?
Comment 4 marian.schaub 2022-03-10 09:03:47 PST
Hello Youenn, the issue seems to be resolved, we were not able to reproduce it in Safari 15, thanks.