[webkit-changes] [WebKit/WebKit] fb46eb: SWServerWorker::didFinishActivation is sometimes c...

youennf noreply at github.com
Tue Jun 13 08:41:54 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fb46eb89ed570c6cab4f55ba8d7b7cd432a99e6b
      https://github.com/WebKit/WebKit/commit/fb46eb89ed570c6cab4f55ba8d7b7cd432a99e6b
  Author: Youenn Fablet <youennf at gmail.com>
  Date:   2023-06-13 (Tue, 13 Jun 2023)

  Changed paths:
    M Source/WebCore/workers/service/server/SWServer.cpp
    M Source/WebCore/workers/service/server/SWServerWorker.cpp

  Log Message:
  -----------
  SWServerWorker::didFinishActivation is sometimes called on workers that are not in activating state
https://bugs.webkit.org/show_bug.cgi?id=258021
rdar://110529723

Reviewed by Chris Dumez.

After https://commits.webkit.org/264242@main, activating service workers that are terminating will not send the order to activate immediately.
They will first be stopped, then the service worker will run, and then the order to activate will be sent.
The issue is that, when being stopped, the service worker is automatically moved from Activating to Activated.
When we send the order to activate and receive the didFinishActivation message, we then hit  the SWServerWorker::didFinishActivation assertion,
as the service worker is already in activated state.

To prevent this, we check whether the service worker is activating just before sending the order to activate.
This assertion is sometimes hit in bots so this code path is covered by existing tests (though this is very racy).

We update the assert to display the worker state in case this patch does not fully fix hitting this assert.

* Source/WebCore/workers/service/server/SWServer.cpp:
(WebCore::SWServer::runServiceWorkerAndFireActivateEvent):
* Source/WebCore/workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::didFinishInstall):
(WebCore::SWServerWorker::didFinishActivation):

Canonical link: https://commits.webkit.org/265121@main




More information about the webkit-changes mailing list