chromium/chrome/test/data/privacy_budget/two_clients_service_worker.js

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

self.addEventListener("message", async () => {
  const clients = await self.clients.matchAll({
    includeUncontrolled: true,
    type: "all",
  });

  if (clients.length == 2) {
    clients.forEach(client => client.postMessage("Done"));
  }
});