microsoft / MicrosoftEdge-Extensions

This is a community space for Microsoft Edge Add-ons developers, to share resources and information about building, publishing and growing their Microsoft Edge extension.
MIT License
134 stars 120 forks source link

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

Open GaurangTandon opened 4 months ago

GaurangTandon commented 4 months ago

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.

RanadhirMSFT commented 1 month ago

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?

GaurangTandon commented 1 month ago

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

RanadhirMSFT commented 4 weeks ago

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

GaurangTandon commented 3 weeks ago

Hi @RanadhirMSFT any progress on this?

ManikanthMSFT commented 3 weeks ago

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.