playwright/tests/assets/shared-worker/shared-worker.html
Dmitry Gozman 190ed9465f
fix(chromium): detach from shared workers (#18976)
This prevents shared workers from stalling upon restart.

We receive `Inspector.targetCrashed` and
`Inspector.targetReloadedAfterCrash` events that assume
`Runtime.runIfWaitingForDebugger` from any attached client. It is easier
and more stable to just detach from shared workers, because we do not
inspect them.

For service workers, we should actually issue
`Runtime.runIfWaitingForDebugger` in such cases, because we attach to
them.

Fixes #18932.
2022-11-22 15:20:42 -08:00

7 lines
242 B
HTML

<script>
window.sharedWorkerResponsePromise = new Promise(f => {
window.myWorker = new SharedWorker("shared-worker.js");
window.myWorker.port.postMessage('hello');
window.myWorker.port.onmessage = e => f(e.data);
});
</script>