Bug 1545052 - Fix broken about:preferences link (Android), r=Gijs
authorAvery Berninger <berning5@msu.edu>
Mon, 22 Apr 2019 20:37:17 +0000
changeset 470409 7d6de1b4d5f980454e8a924390812743917596f0
parent 470408 9c712980e9709732e4966d404f50267566d3b149
child 470410 b3ff6570a179d4fdcc9ffce068f20d45be05cc44
push id35905
push userdvarga@mozilla.com
push dateTue, 23 Apr 2019 09:53:27 +0000
treeherdermozilla-central@831918f009f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1545052
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1545052 - Fix broken about:preferences link (Android), r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D28169
toolkit/content/aboutTelemetry.js
toolkit/content/aboutTelemetry.xhtml
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -172,27 +172,29 @@ var Settings = {
   attachObservers() {
     for (let s of this.SETTINGS) {
       let setting = s;
       Preferences.observe(setting.pref, this.render, this);
     }
 
     let elements = document.getElementsByClassName("change-data-choices-link");
     for (let el of elements) {
-      el.addEventListener("click", function() {
-        if (AppConstants.platform == "android") {
-          var {EventDispatcher} = ChromeUtils.import("resource://gre/modules/Messaging.jsm");
-          EventDispatcher.instance.sendRequest({
-            type: "Settings:Show",
-            resource: "preferences_privacy",
-          });
-        } else {
-          // Show the data choices preferences on desktop.
-          let mainWindow = getMainWindowWithPreferencesPane();
-          mainWindow.openPreferences("privacy-reports");
+      el.parentElement.addEventListener("click", function(event) {
+        if (event.target.localName === "a") {
+          if (AppConstants.platform == "android") {
+            var {EventDispatcher} = ChromeUtils.import("resource://gre/modules/Messaging.jsm");
+            EventDispatcher.instance.sendRequest({
+              type: "Settings:Show",
+              resource: "preferences_privacy",
+            });
+          } else {
+            // Show the data choices preferences on desktop.
+            let mainWindow = getMainWindowWithPreferencesPane();
+            mainWindow.openPreferences("privacy-reports");
+          }
         }
       });
     }
   },
 
   detachObservers() {
     for (let setting of this.SETTINGS) {
       Preferences.ignore(setting.pref, this.render, this);
@@ -208,24 +210,16 @@ var Settings = {
 
     let datacase = extendedEnabled ? "prerelease" : "release";
     let uploadcase = TelemetrySend.sendingEnabled() ? "enabled" : "disabled";
 
     document.l10n.setAttributes(settingsExplanation, "about-telemetry-settings-explanation", {datacase, uploadcase});
 
     this.attachObservers();
   },
-
-  convertStringToLink(string) {
-    let link = document.createElement("a");
-    link.setAttribute("href", "#");
-    link.setAttribute("class", "change-data-choices-link");
-    link.textContent = string;
-    return link;
-  },
 };
 
 var PingPicker = {
   viewCurrentPingData: null,
   _archivedPings: null,
   TYPE_ALL: "all",
 
   attachObservers() {
--- a/toolkit/content/aboutTelemetry.xhtml
+++ b/toolkit/content/aboutTelemetry.xhtml
@@ -129,17 +129,17 @@
 
       <div id="no-search-results" hidden="true" class="hidden">
         <span id="no-search-results-text"></span>
         <div class="no-search-results-image"></div>
       </div>
 
       <section id="home-section" class="active">
         <p id="page-subtitle"></p>
-        <p id="settings-explanation"><a id="uploadLink" data-l10n-name="upload-link" href="about:preferences#privacy"></a></p>
+        <p id="settings-explanation"><a id="uploadLink" data-l10n-name="upload-link" class="change-data-choices-link" href="#"></a></p>
         <p id="ping-explanation"><a id="pingLink" data-l10n-name="ping-link" href="https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/concepts/pings.html"></a></p>
         <p data-l10n-id="about-telemetry-more-information"></p>
         <ul>
           <li data-l10n-id="about-telemetry-firefox-data-doc"><a id="dataDocLink" data-l10n-name="data-doc-link" href="https://docs.telemetry.mozilla.org/"></a></li>
           <li data-l10n-id="about-telemetry-telemetry-client-doc"><a id="clientDocLink" data-l10n-name="client-doc-link" href="https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/index.html"></a></li>
           <li data-l10n-id="about-telemetry-telemetry-dashboard"><a id="dashboardLink" data-l10n-name="dashboard-link" href="https://telemetry.mozilla.org/"></a></li>
           <li data-l10n-id="about-telemetry-telemetry-probe-dictionary"><a id="probeDictionaryLink" data-l10n-name="probe-dictionary-link" href="https://telemetry.mozilla.org/probe-dictionary/"></a></li>
         </ul>