Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(chromium): ensure we resume service worker before detaching from it (#850)

Dmitry Gozman28c4a1697cf7
diff --git a/src/chromium/crPage.ts b/src/chromium/crPage.ts
index 0a2c574ee7..e74687d3b7 100644
--- a/src/chromium/crPage.ts
+++ b/src/chromium/crPage.ts
@@ -218,9 +218,10 @@ export class CRPage implements PageDelegate {
_onAttachedToTarget(event: Protocol.Target.attachedToTargetPayload) {
const session = CRConnection.fromSession(this._client).session(event.sessionId)!;
if (event.targetInfo.type !== 'worker') {
- // Ideally, detaching should resume any target, but there is bug in the backend.
- session.send('Runtime.runIfWaitingForDebugger').catch(debugError);
- this._client.send('Target.detachFromTarget', { sessionId: event.sessionId }).catch(debugError);
+ // Ideally, detaching should resume any target, but there is a bug in the backend.
+ session.send('Runtime.runIfWaitingForDebugger').catch(debugError).then(() => {
+ this._client.send('Target.detachFromTarget', { sessionId: event.sessionId }).catch(debugError);
+ });
return;
}
const url = event.targetInfo.url;