Bug 1481088 - Open links from Add-ons Manager Search tab in Thunderbird instead of external browser. r=aceman
authorAndrei Hajdukewycz <sancus@pobox.com>
Tue, 04 Sep 2018 02:43:58 -0700
changeset 33094 de4e342f0567a6883ea499c5c9bfdb03983231b5
parent 33093 c1a9f19c8216d71c640076a1ecb63ce43cf5092a
child 33095 2fa2b1ec51ad9138fdf6bf936c80b4f0b679f36d
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersaceman
bugs1481088
Bug 1481088 - Open links from Add-ons Manager Search tab in Thunderbird instead of external browser. r=aceman
mail/base/content/mailWindow.js
mail/base/content/utilityOverlay.js
--- a/mail/base/content/mailWindow.js
+++ b/mail/base/content/mailWindow.js
@@ -756,14 +756,18 @@ function switchToTabHavingURI(aURI, aOpe
 
   // Open the found matching tab.
   if (tabmail && matchingIndex > -1) {
     tabmail.switchToTab(matchingIndex);
     return true;
   }
 
   if (aOpenNew) {
-    // Open a new tab.
-    openContentTab(aURI, "tab");
+    // Open a new tab, keeping links from the new tab in Thunderbird if the regexp is set.
+    if (aOpenParams && ("handlerRegExp" in aOpenParams)) {
+      openContentTab(aURI, "tab", aOpenParams.handlerRegExp);
+    } else {
+      openContentTab(aURI, "tab");
+    }
   }
 
   return false;
 }
--- a/mail/base/content/utilityOverlay.js
+++ b/mail/base/content/utilityOverlay.js
@@ -324,18 +324,19 @@ function openPrivacyPolicy(where) {
   let url = Services.prefs.getCharPref(kTelemetryInfoUrl);
   openContentTab(url, where, "^http://www.mozilla.org/");
 }
 
 /* Used by the Add-on manager's search box */
 function openLinkIn(aURL, aWhere, aOpenParams) {
   if (!aURL)
     return;
-  // Open a new tab.
-  switchToTabHavingURI(aURL, true);
+  // Open a new tab and set the regexp to open links from the Addons site in Thunderbird.
+  let addonRegExp = Services.prefs.getCharPref("extensions.getAddons.siteRegExp");
+  switchToTabHavingURI(aURL, true, {handlerRegExp: addonRegExp});
 }
 
 /**
  * Moved from toolkit/content/globalOverlay.js.
  * For details see bug 1422720 and bug 1422721.
  */
 function goSetMenuValue(aCommand, aLabelAttribute) {
   var commandNode = top.document.getElementById(aCommand);