playwright/tests/assets/shared-worker/shared-worker.js
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

5 lines
117 B
JavaScript

onconnect = event => {
const port = event.ports[0];
port.onmessage = e => port.postMessage('echo:' + e.data);
};