Bug 1507595 - Use data-l10n-id instead of formatValue where the change is relatively straightforward. r=Gijs
☠☠ backed out by 8c35900a1c72 ☠ ☠
authorJared Wein <jwein@mozilla.com>
Mon, 24 Dec 2018 16:19:21 +0000
changeset 508974 485ea25a3b82fcf3136bd6102313f76e8d955ef4
parent 508973 28805dd1b97ab5b421d9e886fd5d96460d5d26ab
child 508975 f4556b4f6917f644c17ea83955edaa367803e229
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1507595
milestone66.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 1507595 - Use data-l10n-id instead of formatValue where the change is relatively straightforward. r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D14906
toolkit/content/aboutSupport.js
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -81,39 +81,42 @@ var snapshotFormatters = {
       $("contentprocesses-box").textContent = data.currentContentProcesses +
                                               "/" +
                                               data.maxContentProcesses;
     } else {
       $("contentprocesses-row").hidden = true;
     }
 
     if (Services.policies) {
-      let policiesText = "";
+      let policiesStrId = "";
       let aboutPolicies = "about:policies";
       switch (data.policiesStatus) {
         case Services.policies.INACTIVE:
-          policiesText = await document.l10n.formatValue("policies-inactive");
+          policiesStrId = "policies-inactive";
           break;
 
         case Services.policies.ACTIVE:
-          policiesText = await document.l10n.formatValue("policies-active");
+          policiesStrId = "policies-active";
           aboutPolicies += "#active";
           break;
 
         default:
-          policiesText = await document.l10n.formatValue("policies-error");
+          policiesStrId = "policies-error";
           aboutPolicies += "#errors";
           break;
       }
 
       if (data.policiesStatus != Services.policies.INACTIVE) {
-        let activePolicies = $.new("a", policiesText, null, {href: aboutPolicies});
+        let activePolicies = $.new("a", null, null, {
+          "data-l10n-id": policiesStrId,
+          href: aboutPolicies,
+        });
         $("policies-status").appendChild(activePolicies);
       } else {
-        $("policies-status").textContent = policiesText;
+        document.l10n.setAttributes($("policies-status"), policiesStrId);
       }
     } else {
       $("policies-status-row").hidden = true;
     }
 
     let keyGoogleFound = data.keyGoogleFound ? "found" : "missing";
     document.l10n.setAttributes($("key-google-box"), keyGoogleFound);
 
@@ -582,26 +585,26 @@ var snapshotFormatters = {
     // Now that we're done, grab any remaining keys in data and drop them into
     // the diagnostics section.
     for (let key in data) {
       let value = data[key];
       addRow("diagnostics", key, value);
     }
   },
 
-  async media(data) {
-    async function insertBasicInfo(key, value) {
-      async function createRow(key, value) {
-        let th = $.new("th", await document.l10n.formatValue(key), "column");
+  media(data) {
+    function insertBasicInfo(key, value) {
+      function createRow(key, value) {
+        let th = $.new("th", null, "column", {"data-l10n-id": key});
         let td = $.new("td", value);
         td.style["white-space"] = "pre-wrap";
         td.colSpan = 8;
         return $.new("tr", [th, td]);
       }
-      $.append($("media-info-tbody"), [await createRow(key, value)]);
+      $.append($("media-info-tbody"), [createRow(key, value)]);
     }
 
     function createDeviceInfoRow(device) {
       let deviceInfo = Ci.nsIAudioDeviceInfo;
 
       let states = {};
       states[deviceInfo.STATE_DISABLED] = "Disabled";
       states[deviceInfo.STATE_UNPLUGGED] = "Unplugged";
@@ -674,19 +677,19 @@ var snapshotFormatters = {
       let rows = [];
       for (let dev of devices) {
         rows.push(createDeviceInfoRow(dev));
       }
       $.append($("media-" + side + "-devices-tbody"), rows);
     }
 
     // Basic information
-    await insertBasicInfo("audio-backend", data.currentAudioBackend);
-    await insertBasicInfo("max-audio-channels", data.currentMaxAudioChannels);
-    await insertBasicInfo("sample-rate", data.currentPreferredSampleRate);
+    insertBasicInfo("audio-backend", data.currentAudioBackend);
+    insertBasicInfo("max-audio-channels", data.currentMaxAudioChannels);
+    insertBasicInfo("sample-rate", data.currentPreferredSampleRate);
 
     // Output devices information
     insertDeviceInfo("output", data.audioOutputDevices);
 
     // Input devices information
     insertDeviceInfo("input", data.audioInputDevices);
   },
 
@@ -704,22 +707,22 @@ var snapshotFormatters = {
     }
 
     let a11yInstantiator = $("a11y-instantiator");
     if (a11yInstantiator) {
       a11yInstantiator.textContent = data.instantiator;
     }
   },
 
-  async libraryVersions(data) {
+  libraryVersions(data) {
     let trs = [
       $.new("tr", [
         $.new("th", ""),
-        $.new("th", await document.l10n.formatValue("min-lib-versions")),
-        $.new("th", await document.l10n.formatValue("loaded-lib-versions")),
+        $.new("th", null, null, {"data-l10n-id": "min-lib-versions"}),
+        $.new("th", null, null, {"data-l10n-id": "loaded-lib-versions"}),
       ]),
     ];
     sortedArrayFromObject(data).forEach(
       function([name, val]) {
         trs.push($.new("tr", [
           $.new("td", name),
           $.new("td", val.minVersion),
           $.new("td", val.version),
@@ -735,34 +738,34 @@ var snapshotFormatters = {
     let userJSFile = Services.dirsvc.get("PrefD", Ci.nsIFile);
     userJSFile.append("user.js");
     $("prefs-user-js-link").href = Services.io.newFileURI(userJSFile).spec;
     $("prefs-user-js-section").style.display = "";
     // Clear the no-copy class
     $("prefs-user-js-section").className = "";
   },
 
-  async sandbox(data) {
+  sandbox(data) {
     if (!AppConstants.MOZ_SANDBOX)
       return;
 
     let tbody = $("sandbox-tbody");
     for (let key in data) {
       // Simplify the display a little in the common case.
       if (key === "hasPrivilegedUserNamespaces" &&
           data[key] === data.hasUserNamespaces) {
         continue;
       }
       if (key === "syscallLog") {
         // Not in this table.
         continue;
       }
       let keyStrId = toFluentID(key);
       tbody.appendChild($.new("tr", [
-        $.new("th", await document.l10n.formatValue(keyStrId), "column"),
+        $.new("th", null, "column", {"data-l10n-id": keyStrId}),
         $.new("td", data[key]),
       ]));
     }
 
     if ("syscallLog" in data) {
       let syscallBody = $("sandbox-syscalls-tbody");
       let argsHead = $("sandbox-syscalls-argshead");
       for (let syscall of data.syscallLog) {
@@ -770,17 +773,17 @@ var snapshotFormatters = {
           argsHead.colSpan = syscall.args.length;
         }
         let procTypeStrId = toFluentID(syscall.procType);
         let cells = [
           $.new("td", syscall.index, "integer"),
           $.new("td", syscall.msecAgo / 1000),
           $.new("td", syscall.pid, "integer"),
           $.new("td", syscall.tid, "integer"),
-          $.new("td", await document.l10n.formatValue("sandbox-proc-type-" + procTypeStrId)),
+          $.new("td", null, null, {"data-l10n-id": "sandbox-proc-type-" + procTypeStrId}),
           $.new("td", syscall.syscall, "integer"),
         ];
         for (let arg of syscall.args) {
           cells.push($.new("td", arg, "integer"));
         }
         syscallBody.appendChild($.new("tr", cells));
       }
     }