Bug 439292: allow 'open in new tab/window' for mailto links if the registered handler is a web handler, patch by Natch <highmind63@gmail.com>, r=me

This commit is contained in:
Gavin Sharp 2008-08-26 20:20:41 -04:00
parent 69c0f2c2b4
commit 43ad651252

View File

@ -131,7 +131,16 @@ nsContextMenu.prototype = {
},
initOpenItems: function CM_initOpenItems() {
var shouldShow = this.onSaveableLink ||
var isMailtoInternal = false;
if (this.onMailtoLink) {
var mailtoHandler = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
getService(Ci.nsIExternalProtocolService).
getProtocolHandlerInfo("mailto");
isMailtoInternal = (!mailtoHandler.alwaysAskBeforeHandling &&
mailtoHandler.preferredAction == Ci.nsIHandlerInfo.useHelperApp &&
(mailtoHandler.preferredApplicationHandler instanceof Ci.nsIWebHandlerApp));
}
var shouldShow = this.onSaveableLink || isMailtoInternal ||
(this.inDirList && this.onLink);
this.showItem("context-openlink", shouldShow);
this.showItem("context-openlinkintab", shouldShow);