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

This commit is contained in:
Dmitry Gozman 2020-02-05 16:08:28 -08:00 committed by GitHub
parent a4c40fff82
commit 28c4a1697c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;