chromium/third_party/blink/web_tests/http/tests/serviceworker/resources/slow-fetch-and-stop-worker-iframe.html

<!DOCTYPE html>
<script>
addEventListener('message', e => {
    fetch('./slow-response.php')
      .then(async response => {
          await internals.terminateServiceWorker(navigator.serviceWorker.controller);
          return response.text();
        })
      .then(() => {
          e.source.postMessage(
            'Ugr.. Canceled respondWith resolves the promise somehow.',
            e.origin);
        })
      .catch(() => {
          e.source.postMessage('Rejected successfully', e.origin);
        });
  });
</script>