From 679120c87f13ce8327cd3b17ff06d5872e24cd55 Mon Sep 17 00:00:00 2001 From: Maksim Sadym Date: Wed, 31 Jan 2024 14:54:01 +0100 Subject: [PATCH] feat: add temp `context` into worker realm for Puppeteer --- src/bidiMapper/domains/script/DedicatedWorkerRealm.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bidiMapper/domains/script/DedicatedWorkerRealm.ts b/src/bidiMapper/domains/script/DedicatedWorkerRealm.ts index 0438a3dabe..e5886723f2 100644 --- a/src/bidiMapper/domains/script/DedicatedWorkerRealm.ts +++ b/src/bidiMapper/domains/script/DedicatedWorkerRealm.ts @@ -63,10 +63,16 @@ export class DedicatedWorkerRealm extends Realm { } override get realmInfo(): Script.DedicatedWorkerRealmInfo { - return { + const realmInfo: Script.DedicatedWorkerRealmInfo = { ...this.baseInfo, type: this.realmType, owners: [this.#ownerRealm.realmId], }; + return { + ...realmInfo, + // This is a hack to make Puppeteer able to track workers. + // TODO: remove after Puppeteer tracks workers by owners. + context: this.associatedBrowsingContexts[0]?.id, + } as Script.DedicatedWorkerRealmInfo; } }