From e34a6d53183c3e1f63a375ba6a26bee0dcfcf542 Mon Sep 17 00:00:00 2001 From: Pallav Jha Date: Mon, 12 Apr 2021 13:04:06 +0530 Subject: [PATCH] feat(page): emit the event after removing the Worker (#7080) --- src/common/Page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/Page.ts b/src/common/Page.ts index 17f3b634..38e9f900 100644 --- a/src/common/Page.ts +++ b/src/common/Page.ts @@ -507,8 +507,8 @@ export class Page extends EventEmitter { client.on('Target.detachedFromTarget', (event) => { const worker = this._workers.get(event.sessionId); if (!worker) return; - this.emit(PageEmittedEvents.WorkerDestroyed, worker); this._workers.delete(event.sessionId); + this.emit(PageEmittedEvents.WorkerDestroyed, worker); }); this._frameManager.on(FrameManagerEmittedEvents.FrameAttached, (event) =>