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

Return false from the handler, as it doesn't use sendResponse argument #47

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion platforms/webextension/content-communication-manager.es
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor

@remusao remusao Jul 20, 2022

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?

Copy link
Member

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.

Copy link
Author

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

Copy link
Member

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:

https://github.com/mozilla/webextension-polyfill/blob/780518ed1d9b05e6b31c4067d4db29927779abf3/src/browser-polyfill.js#L426

My guess is that we are using the API correctly, but the version of the polyfill creates issues on modern Chrome version. (?)


return false;
}

export default class ContentCommunicationManager {
Expand Down