From cd522dea9eb8e2a192c9871596a18927f3b5b05f Mon Sep 17 00:00:00 2001 From: Guru Prasad Srinivasa Date: Thu, 14 Jul 2022 09:34:24 -0400 Subject: [PATCH 1/2] Fixes bug where messages from frameId 0 weren't having sender.frameId set --- src/internal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/internal.ts b/src/internal.ts index d15a1e5..b713026 100644 --- a/src/internal.ts +++ b/src/internal.ts @@ -109,7 +109,7 @@ function initIntercoms() { const portFrame = incomingPort.sender.frameId - if (portFrame) + if (portFrame !== undefined) portId = `${portId}.${portFrame}` // literal tab id in case of content script, however tab id of inspected page in case of devtools context From 7f758b973f2a13c56fbf540a54b9fb5ceac1bf07 Mon Sep 17 00:00:00 2001 From: Guru Prasad Srinivasa Date: Thu, 14 Jul 2022 19:07:09 -0400 Subject: [PATCH 2/2] Fixes another instance where frameId checks weren't considering frameId of 0 --- src/internal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/internal.ts b/src/internal.ts index b713026..fc65ec7 100644 --- a/src/internal.ts +++ b/src/internal.ts @@ -202,7 +202,7 @@ export function routeMessage(message: IInternalMessage): void | Promise { : (`${(destName === 'window' ? 'content-script' : destName)}@${(destTabId || srcTabId)}`) // Here it is checked if a specific frame needs to receive the message - if (destFrameId) + if (destFrameId !== undefined) resolvedDestination = `${resolvedDestination}.${destFrameId}` const destPort = portMap.get(resolvedDestination)