Skip to content

Commit b339758

Browse files
committed
fix(puppet): workers not tracking devtools calls
1 parent 28076c2 commit b339758

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

puppet-chrome/lib/BrowserContext.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ export class BrowserContext
113113
}
114114
}
115115

116-
onWorkerAttached(cdpSession: CDPSession, worker: Worker, pageTargetId: string) {
116+
onWorkerAttached(cdpSession: CDPSession, workerTargetId: string, pageTargetId: string) {
117117
this.subscribeToDevtoolsMessages(cdpSession, {
118118
sessionType: 'worker' as const,
119119
pageTargetId,
120-
workerTargetId: worker.id,
120+
workerTargetId,
121121
});
122122
}
123123

puppet-chrome/lib/Page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,14 +288,14 @@ export class Page extends TypedEventEmitter<IPuppetPageEvents> implements IPuppe
288288
const cdpSession = this.cdpSession.connection.getSession(sessionId);
289289

290290
if (targetInfo.type === 'service_worker' || targetInfo.type === 'worker') {
291+
this.browserContext.onWorkerAttached(cdpSession, targetInfo.targetId, this.targetId);
291292
const worker = new Worker(
292293
this.browserContext,
293294
this.networkManager,
294295
cdpSession,
295296
this.logger,
296297
targetInfo,
297298
);
298-
this.browserContext.onWorkerAttached(cdpSession, worker, this.targetId);
299299
const targetId = targetInfo.targetId;
300300
this.workersById.set(targetId, worker);
301301

0 commit comments

Comments
 (0)