Closed Bug 1762058 Opened 3 years ago Closed 1 year ago

SpacesToolbar API incompatibility with tabs API

Categories

(Thunderbird :: Add-Ons: Extensions API, defect)

defect

Tracking

(thunderbird_esr102 wontfix)

RESOLVED FIXED
114 Branch
Tracking Status
thunderbird_esr102 --- wontfix

People

(Reporter: schmid-thomas, Assigned: TbSync)

References

Details

Attachments

(1 file, 1 obsolete file)

Create in the background.mjs a new spaces button:

  const url = new URL("./libs/managesieve.ui/accounts.html",
window.location);

  messenger.spacesToolbar.addButton("sieve_spaces_button", {
    "url" : url.toString()
  });

Then open a tab via the tabs api:

  const url = new URL("./libs/managesieve.ui/accounts.html",
window.location);

  await browser.tabs.create({
    "active": true,
      "url": url.toString()
    });

Click anytime later on the new spaces button and the existing the tab
gets a full reload and looses all changes. Despite the URL is exactly
the same. Subsequent clicks on the spaces button won't reload the tab.

Is the new tab is also not marked as a "spaces" tab in spaces toolbar.

This might be a broader issue than it looks at first.

Current behaviour for http(s):// urls:
tabs.create() will always create a new tab, regardless if a tab with that url exists already or not

Current behaviour for moz-extension:// urls:
tabs.create() will always jump to the existing tab and reload it, if a tab with that url exists already. The code responsible for that is probably in mail/base/content/specialTabs.js.

The different behaviour of tabs.create() for moz-extension:// urls and http(s):// urls feels wrong, specifically the reload. I think we should align the behaviour for http(s):// urls and moz-extension:// urls.

My suggestions:

  1. default to "create new tab" for both url types (add-on developers can manually switch to an existing tab using tabs.update(tabId, {active:true}))
  2. add a dedicated openSpacesTab(spaceId) function to the spacesToolbar API, which will open or jump to the requested spaces tab.

Only the extension which created a space can open it programmatically, as spaceIds are not globally unique but only unique to the extension and extension B has no access to the spaceIds of extension A. This would be fine by me.

Magnus, your thoughts on this?

Flags: needinfo?(mkmelin+mozilla)

That sounds like a good approach!

Flags: needinfo?(mkmelin+mozilla)
Depends on: 1762372
Assignee: nobody → john
Status: NEW → ASSIGNED

Can this patch please be merged? Thank you

Comment on attachment 9270457 [details]
Bug 1762058 - Add function to open space tab. r=aleca

Revision D142703 was moved to bug 1829078. Setting attachment 9270457 [details] to obsolete.

Attachment #9270457 - Attachment is obsolete: true
Target Milestone: --- → 114 Branch

The missing open() function to be able to open the space tab programmatically will be added in Bug 1829293.

Depends on: 1829078
Depends on: 1829293
No longer depends on: 1829078

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/8fbe33cf1a17
No longer assimilate existing tabs of foreign spaces, just because they have loaded the same url. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Depends on: 1829936
Depends on: 1829998
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: