microsoft/MicrosoftEdge-Extensions

Critical bug in chrome.tabs.sendMessage for a "Sleeping" tab in Edge browser

GaurangTandon opened this issue · 6 comments

Hi, I don't know where to report this because this issue is specific to the Edge browser (Chrome doesn't have a Sleeping tabs feature - and it's Memory Saver feature works correctly).

Steps to reproduce issue:

  1. Enable "Sleeping tabs" setting in Edge settings
  2. Wait for a tab to go to sleep
  3. Open your Manifest V3 extension's Service Worker console
  4. Run await chrome.tabs.query({}) to get all open tabs
  5. Get the tabId of the sleeping tab
  6. Run chrome.tabs.sendMessage(tabId, { type: 'check', }, { frameId: 0 }).then(x => console.log('responded', x)).catch(x => console.log('errored', x))

Expected result: promise resolves/rejects with an error message like "Receiving end does not exist".
Actual result: promise remains in pending state until the tab is woken up from sleep.

Request: I think this is a bug and we should fix this, but at the very least, there should be a property on the Tab object indicating that this tab is sleeping (so the extension doesn't bother messaging the tab). On Chrome, the discarded property is set to true for a tab that is crashed by the Memory Saver.

This seems to be a Edge specific issue in Extension APIs. Please let me know what is the appropriate forum to report this issue.

Hi @GaurangTandon, you are at the right place. Apologies for the delay in acknowledging this.
Does this issue persist while operating on the Edge Browser now?
If it does, could you please share some screenshots of the same?

Hi @RanadhirMSFT the issue is still happening in Edge 125. See first screenshot. Notice on the last line the promise is pending. This google.com tab in my Edge browser was sleeping (see second screenshot, the tab is faded):

image

image

Thanks @GaurangTandon for bringing this up. We'll get the right team to address this at the earliest.

Hi @RanadhirMSFT any progress on this?

Hi @GaurangTandon, we have forwarded the details of the issue to the designated team for further verification.

Once we have an update, we will get back to you as soon as possible.

Thank you for your understanding.

Is there a queue when messaging with the background page?

I noticed that when there is a sleeping extension tab, the popup won't be able to receive any response from the background when calling runtime.sendMessage. Could it be that the sleeping tab stuck the entire queue?