-
Notifications
You must be signed in to change notification settings - Fork 6
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
Return false
from the handler, as it doesn't use sendResponse argument
#47
Conversation
@@ -36,7 +36,9 @@ function handleRequest(message, sender) { | |||
return undefined; | |||
} | |||
|
|||
return inject.module(module).action(action, ...args, sender); | |||
inject.module(module).action(action, ...args, sender); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the content script getting the response back if we do not return the promise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! For instance, adblocking fails then on https://spiegel.de/
.
The warning does originate from this function, so it is the right place. But it is correct that returning the promise is important.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, i missed, that returned promise value works like sendResponse
.. but what then it means that some of the sendMessage origin does not wait for the response. I suppose, that they don't care about it, but the above code sens a promise always, which causes the issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Observation: in the debugger, I see that we are using the polyfill:
My guess is that we are using the API correctly, but the version of the polyfill creates issues on modern Chrome version. (?)
The core problem lies elsewhere. Chrome introduced a new error message lately if the listener of the message returns a promise, which is not resolved. What I found, the I think I found the place, where we don't resolve a promise in the background listener in The I am closing the PR here, as the change must be done in the above package, and then reinstalling the |
Fixes ghostery/ghostery-extension#806.
We are not using the
sendResponse
third argument in thehandleRequest
function, so we should always returnfalse
. For now, it returns a promise, so the API holds for using thesendResponse
, which never happens. As the result, the error message is thrown in the console.