Bug 1507595 - Use data-l10n-id instead of formatValue where the change is relatively straightforward. r=Gijs
authorJared Wein <jwein@mozilla.com>
Fri, 28 Dec 2018 19:40:20 +0000
changeset 512065 32fe57d45d1be0278956b9d44c86805c809b65f3
parent 512064 3f16eb2a8603abf8d9e28219671b394d5c9d2387
child 512066 c68ba2c62949ea7bb210666a1e67466205a75603
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [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));
       }
     }