Closed Bug 1828102 Opened 2 years ago Closed 2 years ago

Support mailto: urls in tabs.update(), tabs.create() and windows.create()

Categories

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

Unspecified
All
defect

Tracking

(thunderbird_esr102 wontfix, thunderbird_esr115 wontfix, thunderbird113 wontfix)

RESOLVED FIXED
124 Branch
Tracking Status
thunderbird_esr102 --- wontfix
thunderbird_esr115 --- wontfix
thunderbird113 --- wontfix

People

(Reporter: tdulcet, Assigned: john)

References

Details

(Keywords: regression)

Attachments

(2 files)

This bug was created at the request of John in bug 1716200:

(In reply to John Bieling (:TbSync) from comment #15)

mailto: is broken elsewhere, do not know where. Needs to be fixed in a different bug. Maybe the protocol handler does not like pointing back at itself.

(In reply to John Bieling (:TbSync) from comment #17)

For me, this does not work if executed from the console:

Cc["@mozilla.org/uriloader/external-protocol-service;1"].getService(Ci.nsIExternalProtocolService).loadURI(Services.io.newURI("mailto:user@inter.net"));

That is not limited to add-ons. There is something broken elsewhere. It does work in Firefox.

This issue is preventing the tabs.update() Mail/Web Extension API from opening mailto: URIs. Note that this API does work in Firefox with mailto: URIs as expected. Based on my remark in bug 1716200 comment 0, this must have worked at some point. Note that clicking a real mailto: link in TB does still open the compose window as expected.

Flags: needinfo?(john)
Blocks: 1716200
Keywords: regression
Blocks: 1828110

not supernova specific, correct?

(In reply to Wayne Mery (:wsmwk) from comment #1)

not supernova specific, correct?

No, the command

Cc["@mozilla.org/uriloader/external-protocol-service;1"].getService(Ci.nsIExternalProtocolService).loadURI(Services.io.newURI("mailto:user@inter.net"));

is broken in 102 as well.

OS: Unspecified → All
Version: Trunk → Thunderbird 102
Flags: needinfo?(john)

The mentioned function call has not worked for Thunderbird for a long time. I went back till TB78. I am not sure it ever worked.

So the fix here will be to manually handle mailto links in the following function calls:

  1. tabs.create({url:"mailto:user@inter.net"})
  2. tabs.update(tabId, {url:"mailto:user@inter.net"})
  3. windows.create({type: "popup", {url:"mailto:user@inter.net"})

We now have to decide what we want to do.

  • tabs.update() needs to work.
  • tabs.create() should not be used to create a compose window.
  • I am unsure about windows.create(), we have the compose API to explicitly create a new compose window.

What do you think? Can you try this try-build and check if it works for you?
https://treeherder.mozilla.org/jobs?repo=try-comm-central&revision=27520ea776289858aecb662413fe23488d950347

Assignee: nobody → john
Status: NEW → ASSIGNED
Flags: needinfo?(john)
Summary: loadURI no longer works with mailto: URIs in Thunderbird → Support mailto: urls in tabs.update()
Version: Thunderbird 102 → Trunk
Component: General → Add-Ons: Extensions API

What do you think?

Thanks John for fixing this.

I would argue to keep the patch as is and support all three APIs, which would provide full Firefox compatibility. However, my add-on would only need the first two specifically.

IIRC, you said you need mailto url support in tabs.create() to open multiple compose windows. Is that correct?

I checked Firefox behavior and tabs.create() will open an empty tab and then leave the tab open in addition to the opened external application. Is that really a UX you want to use? Why not use tabs.update() multiple times, which does not open an empty tab?

Summary: Support mailto: urls in tabs.update() → Support mailto: urls in tabs.update(), tabs.create() and windows.create()
Attachment #9375395 - Attachment description: WIP: Bug 1828102 - Support mailto: urls in tabs.update() → WIP: Bug 1828102 - Support mailto: urls in tabs.update(), tabs.create() and windows.create().

IIRC, you said you need mailto url support in tabs.create() to open multiple compose windows. Is that correct?

Yes, my add-on uses tabs.create() to open multiple arbitrary URIs, which includes mailto: URIs.

I checked Firefox behavior and tabs.create() will open an empty tab and then leave the tab open in addition to the opened external application. Is that really a UX you want to use? Why not use tabs.update() multiple times, which does not open an empty tab?

Yeah, I fully agree that this is not great UX. Using tabs.update() may work now in Thunderbird with mailto: URIs, but unfortunately it does not work in Firefox and it does not work in Thunderbird with arbitrary URIs (tel:, sms:, etc.), as the application picker dialogs will overwrite each other, so only the last URI will open.

I updated the patch to fully follow Firefox.

Attachment #9375395 - Attachment description: WIP: Bug 1828102 - Support mailto: urls in tabs.update(), tabs.create() and windows.create(). → Bug 1828102 - Support mailto: urls in tabs.update(), tabs.create() and windows.create(). r=#thunderbird-reviewers
Target Milestone: --- → 124 Branch

Pushed by solange@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/8f81ee596214
Support mailto: urls in tabs.update(), tabs.create() and windows.create(). r=#thunderbird-reviewers
https://hg.mozilla.org/comm-central/rev/b2f9ee2658e0
Rework tabs.update() and tabs.reload() tests and add missing tests for composer, before adding new tests for tabs.create(). r=#thunderbird-reviewers

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED

I updated the patch to fully follow Firefox.

Thanks again John for fixing this! I just tested it in Thunderbird Daily and can confirm that it now works as expected.

As you suggested, I did update my local copy of the extension to use tabs.update() with mailto: URIs in Thunderbird, which does provide a much better UX. This will be a great improvement for the Thunderbird 128 update of the add-on and will allow me to implement other functionally related to e-mail addresses and mailto URIs.

(While testing this, I noticed that Thunderbird mangles some obscure e-mail addresses formats containing whitespace characters. At first I though it was related to using a mailto: URI, but the issue also happens with the compose.beginNew() API. I just filed Bug 1879762 about the issue, but I was not sure which Thunderbird component to put it in.)

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: