This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Service Workers to run for a little longer in case of functiona…
…l events https://bugs.webkit.org/show_bug.cgi?id=240454 Patch by Youenn Fablet <firstname.lastname@example.org> on 2022-05-17 Reviewed by Chris Dumez. Functional events should usually trigger opening a new web page on the same origin as the service worker. There are good chances that the service worker will control the new web page, it is thus potentially useful to keep the service worker around for a bit, to not pay the cost of stopping and restarting it. To do so, we introduce a timer in SWServerWorker that handles the termination in case of functional events/debugger. Covered by updated API test. * Tools/TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm: * Source/WebCore/workers/service/server/SWServerWorker.cpp: (WebCore::SWServerWorker::startTermination): (WebCore::SWServerWorker::shouldBeTerminated const): (WebCore::SWServerWorker::terminateIfPossible): (WebCore::SWServerWorker::terminationIfPossibleTimerFired): * Source/WebCore/workers/service/server/SWServerWorker.h: Canonical link: https://commits.webkit.org/250635@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing 3 changed files with 39 additions and 1 deletion.