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

Messaging from window to devtools isn't working #31

Closed BlueFyre closed 2 years ago

BlueFyre commented 2 years ago

Hi, I'm using code from the next branch due to https://github.com/zikaari/webext-bridge/issues/7 In the window code: sendMessage("foo", "bar", "devtools"); In the devtools code: onMessage("foo", ({ data }) => console.log(data)); I'd expect this to log to the console when the sendMessage happens

What I've observed happening is that inside background.js the portMap doesn't seem to contain devtools@1833977967 destination but rather there's only devtools@1833977967.118 which seems like the onConnect always adds the frameId

Is this a bug or is there a problem in my usage?

zikaari commented 2 years ago

This commit should fix it.

Can you pull the branch locally, build it, yarn link it and test if it works?

BlueFyre commented 2 years ago

Thanks for the quick turnaround. I've tested the fix and the issue is resolved

zikaari commented 2 years ago

This revision can now be installed as webext-bridge@6.0.0-rc2.

Subscribe to #32 to be notified of further changes to 6.0.0 including when the final version is released.