I am developing a Google Chrome extension with a script content, a help page, a settings page and a pop-up page. I diligently studied that although the contents of the script are uploaded to the Chrome Web Store, onMessage listeners never call.
I can break sequentially at the point where I execute chrome.extension.onMessage.addListener , but the listener is never called. Therefore, when I execute chrome.tabs.sendMessage in the background or in pop-up pages, the responseCallback function is never called, i.e. The logic inside responseCallback never executed. Chrome does not even consider this as an error scenario - it accepts the request, but then was silent.
If he considered this as an error case (as when trying to send a message to the chrome:// page), then responseCallback would be called with an undefined response argument - and this would cause my error handling code to execute ... but not such luck.
I could add special behavior in my code for http(s)://chrome.google.com/webstore/* , but hoped that there was a more formal way to search for pages that were banned. Any pointer would be appreciated.
I found a great post here , but it does not have a software API, hence this question.
I already know that the Chrome and chrome:// URLs are special cases. However, in my investigation, the behavior on the chrome:// URL is different from the behavior on the Chrome Web Store. On chrome:// urls, my content script doesn't seem to load at all, and the sendMessage responseCallback function is called using the null / undefined response object. This is the official form of the error signaling API, and it works great for me.
My problem is being able to programmatically detect errors like the ones experienced in the Chrome Web Store, without the need for hard-coding URLs (URLs can change over time).
Thanks in advance for your answers.