Bug 1567103 - fix link problems in the about dialog. r+a=jorgk
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Thu, 18 Jul 2019 12:31:39 +0300
changeset 35244 46de833b93e7a4d8765895b5034ac39895640eaf
parent 35243 dde505c5d853626bcbe81e65b85b0da7f67908de
child 35245 4481c1e7fb456f4b945c55fc546b78ed6bf82aa2
push id2469
push usermozilla@jorgk.com
push dateThu, 18 Jul 2019 18:56:51 +0000
treeherdercomm-beta@a80e22de5036 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1567103
Bug 1567103 - fix link problems in the about dialog. r+a=jorgk
mail/base/content/aboutDialog.js
mail/base/content/aboutDialog.xul
mail/base/content/utilityOverlay.js
--- a/mail/base/content/aboutDialog.js
+++ b/mail/base/content/aboutDialog.js
@@ -105,17 +105,14 @@ function openAboutTab(url) {
 
   // No existing windows.
   window.openDialog("chrome://messenger/content/", "_blank",
                     "chrome,dialog=no,all", null,
                     { tabType: "contentTab",
                       tabParams: {contentPage: url, clickHandler: "specialTabs.aboutClickHandler(event);"} });
 }
 
-function openUILink(url, event) {
-  if (!event.button) {
-    let m = ("messenger" in window) ? window.messenger :
-      Cc["@mozilla.org/messenger;1"]
-        .createInstance(Ci.nsIMessenger);
-    m.launchExternalURL(url);
-    event.preventDefault();
-  }
+function openLink(url) {
+  let m = ("messenger" in window) ? window.messenger :
+    Cc["@mozilla.org/messenger;1"]
+      .createInstance(Ci.nsIMessenger);
+  m.launchExternalURL(url);
 }
--- a/mail/base/content/aboutDialog.xul
+++ b/mail/base/content/aboutDialog.xul
@@ -118,33 +118,33 @@
           <vbox id="experimental" hidden="true">
             <description class="text-blurb" id="warningDesc">
               &warningDesc.version;
 #ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
               &warningDesc.telemetryDesc;
 #endif
             </description>
             <description class="text-blurb" id="communityExperimentalDesc">
-              &community.exp.start;<label is="text-link" href="http://www.mozilla.org/">&community.exp.mozillaLink;</label>&community.exp.middle;<label is="text-link" href="about:credits">&community.exp.creditsLink;</label>&community.exp.end;
+              &community.exp.start;<label class="text-link" onclick="openLink('https://www.mozilla.org/');">&community.exp.mozillaLink;</label>&community.exp.middle;<label class="text-link" onclick="openAboutTab('about:credits');">&community.exp.creditsLink;</label>&community.exp.end;
             </description>
           </vbox>
           <description class="text-blurb" id="communityDesc">
-            &community.start2;<label is="text-link" onclick="openURL('http://www.mozilla.org/');" oncommand="openUILink(this.getAttribute('href'), event);">&community.mozillaLink;</label>&community.middle2;<label is="text-link" onclick="openAboutTab('about:credits');">&community.creditsLink;</label>&community.end3;
+            &community.start2;<label class="text-link" onclick="openLink('https://www.mozilla.org/');">&community.mozillaLink;</label>&community.middle2;<label class="text-link" onclick="openAboutTab('about:credits');">&community.creditsLink;</label>&community.end3;
           </description>
           <description class="text-blurb" id="contributeDesc">
-            &helpus.start;<label is="text-link" onclick="openUILink(this.getAttribute('href'), event)" href="https://donate.mozilla.org/thunderbird/?utm_source=thunderbird-client&amp;utm_medium=referral&amp;utm_content=about-dialog">&helpus.donateLink;</label>&helpus.middle;<label is="text-link" onclick="openUILink(this.getAttribute('href'), event)" href="https://www.thunderbird.net/get-involved/">&helpus.getInvolvedLink;</label>&helpus.end;
+            &helpus.start;<label class="text-link" onclick="openLink('https://donate.mozilla.org/thunderbird/?utm_source=thunderbird-client&amp;utm_medium=referral&amp;utm_content=about-dialog');">&helpus.donateLink;</label>&helpus.middle;<label class="text-link" onclick="openLink('https://www.thunderbird.net/get-involved/')">&helpus.getInvolvedLink;</label>&helpus.end;
           </description>
         </vbox>
       </vbox>
     </hbox>
     <vbox id="bottomBox">
       <hbox pack="center">
         <label class="text-link bottom-link" onclick="openAboutTab('about:license');">&bottomLinks.license;</label>
         <label class="text-link bottom-link" onclick="openAboutTab('about:rights');">&bottomLinks.rights;</label>
-        <label class="text-link bottom-link" onclick="openURL('https://www.mozilla.org/en-US/thunderbird/legal/privacy/');">&bottomLinks.privacy;</label>
+        <label class="text-link bottom-link" onclick="openLink('https://www.mozilla.org/privacy/thunderbird/');">&bottomLinks.privacy;</label>
       </hbox>
       <description id="trademark">
         <label class="trademark-label">&trademarkInfo.part1;</label>
       </description>
     </vbox>
   </vbox>
 
   <keyset id="mainKeyset">
--- a/mail/base/content/utilityOverlay.js
+++ b/mail/base/content/utilityOverlay.js
@@ -170,29 +170,29 @@ function togglePaneSplitter(splitterId) 
     splitter.setAttribute("state", "collapsed");
 }
 
 // openUILink handles clicks on UI elements that cause URLs to load.
 // Firefox and SeaMonkey have a function with the same name,
 // so extensions can use this everywhere to open links.
 // We currently only react to left click in Thunderbird.
 function openUILink(url, event) {
-  if (!event.button) {
+  if (event.button == 0) {
     PlacesUtils.history.insert({
       url,
       visits: [{
         date: new Date(),
       }],
     }).catch(Cu.reportError);
     messenger.launchExternalURL(url);
   }
 }
 
-function openLinkText(event, url) {
-  switch (url) {
+function openLinkText(event, what) {
+  switch (what) {
     case "getInvolvedURL":
       openUILink("https://www.thunderbird.net/get-involved/", event);
       break;
     case "keyboardShortcutsURL":
       openUILink("https://support.mozilla.org/kb/keyboard-shortcuts/", event);
       break;
     case "donateURL":
       openUILink("https://donate.mozilla.org/thunderbird/?utm_source=thunderbird-client&utm_medium=referral&utm_content=help-menu", event);