serversideup / webext-bridge

💬 Messaging in Web Extensions made easy. Batteries included.
https://serversideup.net/open-source/webext-bridge
MIT License
547 stars 50 forks source link

No tabId when receiving message in background from content-script #87

Closed bogomazov closed 6 months ago

bogomazov commented 6 months ago

Version

^6.0.1

Current Behavior

sender in background onMessage has no tabId and frameId

Screenshot 2024-05-15 at 13 06 37

Expected Behavior

tabId and frameId to be present

Steps To Reproduce

on Chrome. Create onMessage in background script and await sendMessage(destination, data, "background") from content script

Anything else?

No response

bogomazov commented 6 months ago

now its working, idk why it was null at a time

bogomazov commented 5 months ago

turned out its there, just don't log the object itself (it erases these values afterwards so it shows null in the console)

On Thu, Jun 20, 2024 at 12:07 PM Leo Ukraincik @.***> wrote:

How was this fixed, I'm still having this issue

— Reply to this email directly, view it on GitHub https://github.com/serversideup/webext-bridge/issues/87#issuecomment-2180302894, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSRRWC46NVPXNEEPADGUG3ZIKSUJAVCNFSM6AAAAABHX56O5GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBQGMYDEOBZGQ . You are receiving this because you modified the open/close state.Message ID: @.***>

seahindeniz commented 5 months ago

I just faced the same issue. I have freeze the sender object via Object.freeze and traced back to the source. @bogomazov maybe it is fine to re-open the issue. https://github.com/serversideup/webext-bridge/blob/main/src/background.ts#L160-L162

I'm not sure why is it being overriden though. @zikaari maybe you can share some insights?