tshaddix/webext-redux

Firefox Error in wrapStore.js

alexelisenko opened this issue · 4 comments

I have a web extension that uses wrapStore in the background. As soon as the extension is added, the debug console shows the following error:

Unchecked lastError value: Error: Could not establish connection. Receiving end does not exist.

This is coming from wrapStore.js line 204

which seems realted to:

browserAPI.tabs.sendMessage(tab.id, {
    action: 'storeReady'
});

Has anyone come across this issue? Any insight would be greatly appreciated.

After some more debugging, I see that this error is related to not having any onMessage listeners registered in any content scripts. The extension im working on does not need any content scripts when first initialized, and this error is thrown before the popup is ever created. My workaround was to comment out the storeReady messages to all tabs in the wrapStore method.

Could this be made into configuration option perhaps?

Hey @alexelisenko - ah - makes sense. Because we are connecting directly to the tab it wants to make sure we know no-one is listening on the other side.

Perhaps we can simply "check" the error and that should take care of the warning via the response callback param (https://developer.chrome.com/extensions/tabs#method-sendMessage). I can submit a PR for that.

That looks like it would also work. Thanks.

Released in 2.1.1