RESOLVED FIXED 191986
Updating a service worker during a navigation load sometimes makes the load fail
https://bugs.webkit.org/show_bug.cgi?id=191986
Summary Updating a service worker during a navigation load sometimes makes the load fail
youenn fablet
Reported 2018-11-26 15:47:32 PST
According https://github.com/PWA-POLICE/pwa-bugs#problem-navigation-to-a-website-has-infinite-loading, updating a service worker during a navigation load sometimes trigger terminating a service worker that serves the content for a page, hence making the load fail.
Attachments
Patch (13.16 KB, patch)
2018-11-28 10:38 PST, youenn fablet
no flags
Archive of layout-test-results from ews123 for ios-simulator-wk2 (17.00 MB, application/zip)
2018-11-28 12:50 PST, EWS Watchlist
no flags
Radar WebKit Bug Importer
Comment 1 2018-11-26 15:49:11 PST
Chris Dumez
Comment 2 2018-11-27 11:41:42 PST
Seems to indicate that our TryActivate implementation is actually activating the newly installed worker even though there is already an active worker with clients. https://w3c.github.io/ServiceWorker/#try-activate
Chris Dumez
Comment 3 2018-11-27 11:43:13 PST
Our tryActivate implementation does: // Invoke Activate with registration if either of the following is true: // - registration's active worker is null. // - The result of running Service Worker Has No Pending Events with registration's active worker is true, // and no service worker client is using registration or registration's waiting worker's skip waiting flag is set. if (!activeWorker() || (!activeWorker()->hasPendingEvents() && (!hasClientsUsingRegistration() || waitingWorker()->isSkipWaitingFlagSet()))) activate(); So somehow, even though there is an active worker and a pending load handled by that worker, we still call activate().
youenn fablet
Comment 4 2018-11-27 13:22:32 PST
We are probably registering the new document too late as a service worker client. Currently we are creating/registering the Document when receiving the first data bytes which is too late. Ideally, we should probably register the document as soon as we send the fetch event to the service worker. Another approach would be to keep track of navigation loads a service worker is responsible for and update the activate logic according that new information.
youenn fablet
Comment 5 2018-11-28 10:38:19 PST
youenn fablet
Comment 6 2018-11-28 10:38:52 PST
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/14286
EWS Watchlist
Comment 7 2018-11-28 12:50:00 PST
Comment on attachment 355889 [details] Patch Attachment 355889 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: https://webkit-queues.webkit.org/results/10185320 New failing tests: imported/w3c/web-platform-tests/webrtc/simplecall-no-ssrcs.https.html media/no-fullscreen-when-hidden.html
EWS Watchlist
Comment 8 2018-11-28 12:50:03 PST
Created attachment 355907 [details] Archive of layout-test-results from ews123 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews123 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.6
youenn fablet
Comment 9 2018-11-28 14:09:16 PST
Comment on attachment 355907 [details] Archive of layout-test-results from ews123 for ios-simulator-wk2 Error is unrelated
WebKit Commit Bot
Comment 10 2018-11-29 12:11:01 PST
Comment on attachment 355889 [details] Patch Clearing flags on attachment: 355889 Committed r238683: <https://trac.webkit.org/changeset/238683>
WebKit Commit Bot
Comment 11 2018-11-29 12:11:03 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.