Hey :)
We have experienced a somewhat weird behavior related to chrome.runtime.lastError that I could not explain, would appreciate your help with this one.
In order to communicate with our content script, we utilize the `chrome.tabs.sendMessage` API.
For convenience, we wrapped this API in a wrapper function, named `sendMessageToTab`.
As far as we know, trying to communicate with the content script in `chrome://` like tabs won't work.
We expect `chrome.runtime.lastError` to contain the following in such cases:
Could not establish connection. Receiving end does not exist.
This is indeed the case.
However, if we were to call the callback function inside the callback of `chrome.tabs.get` resolved promise, chrome.runtime.lastError value would be undefined.
So, it brings me to wonder:
- Is this an intended behavior?
- Are there better ways to handle failed sendMessage events in forbidden tabs?
Thanks, team!