ghostery-extension: Error in console: Uncaught (in promise)
On any site, an error appears in the console:
Uncaught (in promise) {message: 'A listener indicated an asynchronous response by r…age channel closed before a response was received'} message: "A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received"
It interferes quite a lot when working in the console
Steps to Reproduce
To check, you can go to https://www.google.com/, open the console and click on an empty space. Several errors will appear almost immediately.
Versions
- Browser: Chrome 102.0.5005.115
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 8
- Comments: 19 (11 by maintainers)
Commits related to this issue
- Apply patch https://github.com/mozilla/webextension-polyfill/pull/385 from the webextension-polyfill (and removes the minified file). The patch silences the following warning that started to appear in... — committed to philipp-classen/ghostery-extension by philipp-classen 2 years ago
- Apply patch for webextension-polyfill to silence Chrome warning (#830) * Apply patch https://github.com/mozilla/webextension-polyfill/pull/385 from the webextension-polyfill (and removes the minifie... — committed to ghostery/ghostery-extension by philipp-classen 2 years ago
- Upgrade webextension-polyfill That should allows us to remove the patch https://github.com/ghostery/ghostery-extension/pull/830 refs https://github.com/ghostery/ghostery-extension/issues/806 — committed to philipp-classen/common by philipp-classen 2 years ago
- Upgrade webextension-polyfill (#62) That should allows us to remove the patch https://github.com/ghostery/ghostery-extension/pull/830 refs https://github.com/ghostery/ghostery-extension/issues/80... — committed to ghostery/common by philipp-classen 2 years ago
Hello I confirm the bug on
v106.0.5249.119 (Official Build) (arm64)v8.7.4there is also an open question on stackoverflow about this error:
https://stackoverflow.com/questions/72494154/a-listener-indicated-an-asynchronous-response-by-returning-true-but-the-messag
It looks like after the update the error stopped repeating. Thanks
To explain the reasoning behind merging https://github.com/ghostery/ghostery-extension/pull/830:
For parts like the adblocker, Ghostery needs to communicate between the background (the extension) and the content script (the website). Firefox and Chrome have similar APIs, but with a different interface - Firefox is promise-based, while Chrome uses callbacks (in Manifest V2). For that reason, we are using the webextension-polyfill library, which enables us to have a Firefox-like API on Chrome.
As part of their implementation, the polyfill library detected a specific error message from Chrome without showing a warning. In the context of Ghostery that can be seen as a implementation detail, as long as the communication between content script and background works as in Firefox. Now Chrome recently changed its code and the original error message was changed and split into two different message. That is why suppressing the warning inside the library no longer works.
The fix that is being discussed in https://github.com/mozilla/webextension-polyfill/issues/384 is to update the detection code to cover the new text of the error messages. It is not merged (waiting for test coverage), but it solves the problem already in Ghostery and I could not find negative side-effects while testing it. If it gets officially merged and released, we can upgrade the library and drop the npm-patch, of course.