Context menu for mailto: links should include commands like "Open in new tab" (when handled by a web app)

RESOLVED FIXED in Firefox 3.1b1

Status

()

Firefox
General
--
enhancement
RESOLVED FIXED
10 years ago
9 years ago

People

(Reporter: Natch, Assigned: Natch)

Tracking

unspecified
Firefox 3.1b1
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment, 3 obsolete attachments)

(Assignee)

Description

10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0

The context menu for regular links includes an option to open in a new tab/window, since mailto is now handled in the browser, there should be a similar option.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
(Assignee)

Comment 1

9 years ago
Created attachment 335590 [details] [diff] [review]
Patch for nsContextmenu

Here's a patch that's tested and works.
Attachment #335590 - Flags: review?
(Assignee)

Updated

9 years ago
Attachment #335590 - Flags: review? → review?(gavin.sharp)
Comment on attachment 335590 [details] [diff] [review]
Patch for nsContextmenu

>diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js

>   initOpenItems: function CM_initOpenItems() {
>+    var extProtocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
>+                                   .getService(Components.interfaces.nsIExternalProtocolService);
>+    var isMailtoInternal;
>+    if (extProtocolSvc) {

This null check is unnecessary, getService will either return an object or throw. You can just call getProtocolHandlerInfo directly on the result of getService and assign directly to mailtoHandler (removing the extProtocolSvc variable entirely). You can also use the Cc/Ci shortcuts here as with other getService calls in this file.

>+      var mailtoHandler = extProtocolSvc.getProtocolHandlerInfo("mailto");
>+      isMailtoInternal = (mailtoHandler.preferredAction == 2 &&

Can use Ci.nsIHandlerInfo.useHelperApp here, rather than "2".

>+                         (mailtoHandler.preferredApplicationHandler instanceof Ci.nsIWebHandlerApp));
>+    }

Otherwise this looks good, thanks for the patch! Attach a patch addressing those comments and I'll r+.
Severity: trivial → enhancement
Status: UNCONFIRMED → NEW
Component: Tabbed Browser → General
Ever confirmed: true
QA Contact: tabbed.browser → general
(Assignee)

Comment 3

9 years ago
Created attachment 335631 [details] [diff] [review]
Addresses comment 2
Attachment #335590 - Attachment is obsolete: true
Attachment #335631 - Flags: review?(gavin.sharp)
Attachment #335590 - Flags: review?(gavin.sharp)
Comment on attachment 335631 [details] [diff] [review]
Addresses comment 2

Actually, I noticed one last thing: you can avoid doing all that work to retrieve isMailtoInternal if this.onMailtoLink is false. I'll fix that and check it in.
Attachment #335631 - Flags: review?(gavin.sharp) → review+
Created attachment 335637 [details] [diff] [review]
updated patch
Attachment #335631 - Attachment is obsolete: true
Assignee: nobody → highmind63
Hmm, with this latest patch I still get the "Open in new tab" options if I select "Always ask".
Created attachment 335639 [details] [diff] [review]
updated updated patch

A check for !alwaysAskBeforeHandling fixes that.
Attachment #335637 - Attachment is obsolete: true
Fixed for Firefox 3.1
http://hg.mozilla.org/mozilla-central/index.cgi/rev/5c132b2d3848

Thanks again for the patch!
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 3.1b1
(Assignee)

Comment 9

9 years ago
(In reply to comment #7)
> Created an attachment (id=335639) [details]
> updated updated patch
> 
> A check for !alwaysAskBeforeHandling fixes that.


That shouldn't be necessary as preferredAction should not be == useHelperApp. It worked in my patch. Anyhow... thanks for the help.
(In reply to comment #9)
> That shouldn't be necessary as preferredAction should not be == useHelperApp.
> It worked in my patch. Anyhow... thanks for the help.

preferredAction isn't updated when askBeforeHandling is set, so it is needed (at least for me, on Mac). You need to switch to a web handler (so that preferredAction gets set), and then switch to "Always ask" for it to be a problem, though, so that might explain why you didn't see that problem in testing.

Updated

9 years ago
Summary: Now that mailto links are handled by a web-app there should be an option to open in a new tab → Context menu for mailto: links should include commands like "Open in new tab" (when handled by a web app)
You need to log in before you can comment on or make changes to this bug.