growthbook / devtools

GrowthBook DevTools extension for Chrome
MIT License
5 stars 5 forks source link

Send message to specific tab being inspected #44

Closed CameronDowner closed 11 months ago

CameronDowner commented 12 months ago

This change sends a message to the specific tab being inspected by the Chrome devtools currently being used.

fixes #42, fixes #39

bttf commented 12 months ago

Hi @CameronDowner, so far so good, however this doesn't quite fix #42 as it stands. You'll need to do a similar check for the tab ID when listening for messages as well.

In the message handler callback on line 29, we need to compare the tab ID of the sender (provided as a 2nd arg to the callback) with the inspected window tab ID, and return early if it does not match.

https://github.com/CameronDowner/devtools/blob/3cbc1e3ca32c12313f3972e5b06afee2da277ca8/src/devtools/controller.ts#L30C1-L30C1

CameronDowner commented 11 months ago

Hi @bttf,

I've updated the PR to include tabId conditional check in the message listener.

bttf commented 11 months ago

Thanks @CameronDowner This LGTM. CI is failing due to a dependency being out of date - I will merge this and folow up with a separate commit to its versioning.