MicrosoftEdge-Extensions icon indicating copy to clipboard operation
MicrosoftEdge-Extensions copied to clipboard

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

Open GaurangTandon opened this issue 1 year ago • 8 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.

GaurangTandon avatar Feb 09 '24 12:02 GaurangTandon

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?

RanadhirMSFT avatar Jun 05 '24 11:06 RanadhirMSFT

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

GaurangTandon avatar Jun 06 '24 10:06 GaurangTandon

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

RanadhirMSFT avatar Jun 06 '24 10:06 RanadhirMSFT

Hi @RanadhirMSFT any progress on this?

GaurangTandon avatar Jun 13 '24 11:06 GaurangTandon

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.

ManikanthMSFT avatar Jun 13 '24 13:06 ManikanthMSFT

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?

eight04 avatar Oct 16 '24 19:10 eight04

Facing the same issue here. If you have periodic tasks that invoke chrome.tabs.sendMessage, your memory usage will continuously increase 😄

Willis0826 avatar Dec 05 '24 19:12 Willis0826

Hi @Willis0826, thank you for reaching out to us. We want to assure you that our team is actively working on your concern. While we don’t have an estimated date for resolution yet, we will keep you updated and contact you as soon as we have more information.

Thank you for your patience and understanding.

ManikanthMSFT avatar Dec 06 '24 05:12 ManikanthMSFT