Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1461a3c528f189bf4c971fe393a1940b1a0fb991
      
https://github.com/WebKit/WebKit/commit/1461a3c528f189bf4c971fe393a1940b1a0fb991
  Author: Sihui Liu <[email protected]>
  Date:   2025-04-08 (Tue, 08 Apr 2025)

  Changed paths:
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm

  Log Message:
  -----------
  [ MacOS ] TestWebKitAPI.ServiceWorkers.SuspendAndTerminateWorker is a 
constant failure
https://bugs.webkit.org/show_bug.cgi?id=291233
rdar://148552518

Reviewed by Chris Dumez.

290386@main changed the timing of website data deletion (i.e. website data 
deletion can be delayed for a few seconds to
ensure pending data tasks can finish) and this caused the test to fail, because 
the test has a bug: it does not actually
wait until website data deletion to finish before moving on to next steps. The 
test expects completion handler of
`removeDataOfTypes` sets `done` flag to true and wait on the flag to be true 
before continuing. However,
`SWMessageHandler` can also set the flag on receiving message and message is 
received when Service Worker is launched.
To fix the issue, the patch makes sure the test waits for the launch message 
before deleting data.

After the fix, the test still fails because it has two other problems:
1. In existsing implementation, Service Worker in unresponsive process is 
forcibly terminated after 10s by default (see
`SWServerWorker::startTermination`), and the test only waits for 2s before 
checking the termination status. This patch
fixes that by disabling `ServiceWorkerProcessTerminationDelayEnabled`, which 
would reduce the delay to 1s.
2. The test uses `SWMessageHandler` to receive message, and `SWMessageHandler` 
only expects to receive one specific
message (the Service Worker launch message). However, the test also invokes 
JavaScript function `log`, which would send
a different message. This patch fixes that by replacing `SWMessageHandler` with 
`SWMessageHandlerWithExpectedMessage`.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
((ServiceWorkers, SuspendAndTerminateWorker)):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to