Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firefox Error in wrapStore.js #209

Closed
alexelisenko opened this issue May 24, 2019 · 4 comments · Fixed by #210
Closed

Firefox Error in wrapStore.js #209

alexelisenko opened this issue May 24, 2019 · 4 comments · Fixed by #210

Comments

@alexelisenko
Copy link

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.

@alexelisenko
Copy link
Author

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?

@tshaddix
Copy link
Owner

tshaddix commented May 27, 2019

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.

tshaddix added a commit that referenced this issue May 27, 2019
Fixes #209. When a message is sent to each tab explicitly in the store ready function, it will result in `lastError` being populated if no content script exists on the tab.
@alexelisenko
Copy link
Author

That looks like it would also work. Thanks.

@tshaddix
Copy link
Owner

Released in 2.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants