firefox-devtools / extension-examples

DevTools extension examples
Mozilla Public License 2.0
27 stars 7 forks source link

Fix and prevent some messaging logged errors #8

Closed rpl closed 7 years ago

rpl commented 7 years ago

This PR contains the following tweaks to the messaging example:

[1]: this change prevents the "No matching message handler for the given recipient" errors logged when the addon is installed and there are already tabs with regular webpage loaded into them (this error happens when the content script is loaded before the background page is ready to receive a connection or a message because is still loading) [2]: this change makes the panel able to send the request to the content script even if there is no port connected from the content script to the background page yet

rpl commented 7 years ago

@janodvarko @sole I took a look in the following issues/scenarios:

and I applied some tweak to fix/prevent the above errors (and some other issues that I notice by looking deeper into the example, e.g. apply some fix to the connections map cleanup).

Let me know how it looks to you!

janodvarko commented 7 years ago

Excellent, thanks Luca!

The content and background scripts are loaded in random order?

Honza