diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-02-13 12:13:05 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-13 12:13:05 -0500 |
commit | 00066e4eb52fbce1af55cbba8b0b73b6f08f7f8c (patch) | |
tree | acbb05565486bac1a33631c907693e613f8d9fb0 | |
parent | edc22b98e361707c827326b714ada6fd821c2bec (diff) |
Fix cross frame communication not exposing sourceTabId properly (#1379)
-rw-r--r-- | ext/bg/js/backend.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index e730912b..3bb23310 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -320,8 +320,8 @@ class Backend { } if (details.name !== 'background-cross-frame-communication-port') { return; } - const tabId = (port.sender && port.sender.tab ? port.sender.tab.id : null); - if (typeof tabId !== 'number') { + const senderTabId = (port.sender && port.sender.tab ? port.sender.tab.id : null); + if (typeof senderTabId !== 'number') { throw new Error('Port does not have an associated tab ID'); } const senderFrameId = port.sender.frameId; @@ -330,11 +330,12 @@ class Backend { } let {targetTabId, targetFrameId} = details; if (typeof targetTabId !== 'number') { - targetTabId = tabId; + targetTabId = senderTabId; } const details2 = { name: 'cross-frame-communication-port', + sourceTabId: senderTabId, sourceFrameId: senderFrameId }; let forwardPort = chrome.tabs.connect(targetTabId, {frameId: targetFrameId, name: JSON.stringify(details2)}); |