-
Notifications
You must be signed in to change notification settings - Fork 215
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
runtime.sendMessage doesn't pass callback to onMessage listeners #307
Comments
How are you testing this? The current version of the polyfill passes the webextension-polyfill/src/browser-polyfill.js Line 422 in 50be150
|
OK, I actually posted this in the wrong repo; I meant to post it to |
Closing since this is bug report is unrelated to this project and a bug report has been filed at clarkbw/jest-webextension-mock#136 |
Just for others ending up here, this helped me: #218 (comment) |
I'm attempting to test my onMessage listeners, but I keep getting the error
TypeError: sendResponse is not a function
. It appears that the implementation of runtime.sendMessage accepts a callback as the second argument, but doesn't actually pass it to the listener.My workaround thus far has been to pass a default value to my listeners, ex:
browser.runtime.onMessage.addListener((request, sender, sendResponse = () => {}) => {
While this gets rid of the error, not being able to check the results passed to the callback make the test almost useless.
The text was updated successfully, but these errors were encountered: