Bug 1573832 - Enumerate the stored benchmark entries in about support. r=chunmin,fluent-reviewers,flod
authorAlex Chronopoulos <achronop@gmail.com>
Tue, 03 Sep 2019 16:31:27 +0000
changeset 491445 0f2fc0e0ca97f52def644a65850284534f622334
parent 491444 e3f06f11de629df831bc33d8eaed50c407d340c4
child 491446 a8ae120eedba3f09b945c09ab451a565e44df0c6
push id36528
push useraiakab@mozilla.com
push dateTue, 03 Sep 2019 21:53:16 +0000
treeherdermozilla-central@6a6153cb19e9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschunmin, fluent-reviewers, flod
bugs1573832
milestone71.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 1573832 - Enumerate the stored benchmark entries in about support. r=chunmin,fluent-reviewers,flod In media section of the about:support page, create a button that enumerate the benchmark entries from the database. Differential Revision: https://phabricator.services.mozilla.com/D42090
toolkit/content/aboutSupport.js
toolkit/content/aboutSupport.xhtml
toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
toolkit/themes/shared/aboutSupport.css
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -859,26 +859,66 @@ var snapshotFormatters = {
     function insertDeviceInfo(side, devices) {
       let rows = [];
       for (let dev of devices) {
         rows.push(createDeviceInfoRow(dev));
       }
       $.append($("media-" + side + "-devices-tbody"), rows);
     }
 
+    function insertEnumerateDatabase() {
+      let button = $("enumerate-database-button");
+      if (button) {
+        button.addEventListener("click", function(event) {
+          let {KeyValueService} = ChromeUtils.import("resource://gre/modules/kvstore.jsm");
+          let currProfDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
+          let path = currProfDir.path + "/mediacapabilities";
+
+          function enumerateDatabase(name) {
+            KeyValueService.getOrCreate(path, name)
+            .then(database => {
+              return database.enumerate();
+            })
+            .then(enumerator => {
+              var logs = [];
+              logs.push(`${name}:`);
+              while (enumerator.hasMoreElements()) {
+                const { key, value } = enumerator.getNext();
+                logs.push(`${key}: ${value}`);
+              }
+              $("enumerate-database-result").textContent += logs.join("\n") + "\n";
+            });
+          }
+
+          $("enumerate-database-result").style.display = "block";
+          $("enumerate-database-result").classList.remove("no-copy");
+          $("enumerate-database-result").textContent = "";
+
+          enumerateDatabase("video/av1");
+          enumerateDatabase("video/vp8");
+          enumerateDatabase("video/vp9");
+          enumerateDatabase("video/avc");
+          enumerateDatabase("video/theora");
+        });
+      }
+    }
+
     // Basic information
     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);
+
+    // Media Capabilitites
+    insertEnumerateDatabase();
   },
 
   javaScript(data) {
     $("javascript-incremental-gc").textContent = data.incrementalGCEnabled;
   },
 
   accessibility(data) {
     $("a11y-activated").textContent = data.isActive;
--- a/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -448,16 +448,28 @@
             <th data-l10n-id="media-device-preferred"/>
             <th data-l10n-id="media-device-format"/>
             <th data-l10n-id="media-device-channels"/>
             <th data-l10n-id="media-device-rate"/>
             <th data-l10n-id="media-device-latency"/>
           </tr>
         </tbody>
 
+        <tbody id="media-capabilities-tbody">
+          <tr>
+            <th colspan="9" class="title-column" data-l10n-id="media-capabilities-title"/>
+          </tr>
+          <tr>
+            <td colspan="9">
+              <button id="enumerate-database-button" data-l10n-id="media-capabilities-enumerate"/>
+              <pre id="enumerate-database-result" class="hidden no-copy"></pre>
+            </td>
+          </tr>
+        </tbody>
+
       </table>
 
       <!-- - - - - - - - - - - - - - - - - - - - - -->
 
       <h2 class="major-section" data-l10n-id="modified-key-prefs-title"/>
 
       <table class="prefs-table">
         <thead class="no-copy">
--- a/toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
+++ b/toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
@@ -112,28 +112,39 @@ sandbox-sys-call-index = #
 sandbox-sys-call-age = Seconds Ago
 sandbox-sys-call-pid = PID
 sandbox-sys-call-tid = TID
 sandbox-sys-call-proc-type = Process Type
 sandbox-sys-call-number = Syscall
 sandbox-sys-call-args = Arguments
 safe-mode-title = Try Safe Mode
 restart-in-safe-mode-label = Restart with Add-ons Disabled…
+
+## Media titles
+
+audio-backend = Audio Backend
+max-audio-channels = Max Channels
+sample-rate = Preferred Sample Rate
 media-title = Media
 media-output-devices-title = Output Devices
 media-input-devices-title = Input Devices
 media-device-name = Name
 media-device-group = Group
 media-device-vendor = Vendor
 media-device-state = State
 media-device-preferred = Preferred
 media-device-format = Format
 media-device-channels = Channels
 media-device-rate = Rate
 media-device-latency = Latency
+media-capabilities-title = Media Capabilities
+# List all the entries of the database.
+media-capabilities-enumerate = Enumerate database
+##
+
 intl-title = Internationalization & Localization
 intl-app-title = Application Settings
 intl-locales-requested = Requested Locales
 intl-locales-available = Available Locales
 intl-locales-supported = App Locales
 intl-locales-default = Default Locale
 intl-os-title = Operating System
 intl-os-prefs-system-locales = System Locales
@@ -251,21 +262,16 @@ gpu-process-kill-button = Terminate GPU 
 gpu-device-reset = Device Reset
 gpu-device-reset-button = Trigger Device Reset
 uses-tiling = Uses Tiling
 content-uses-tiling = Uses Tiling (Content)
 off-main-thread-paint-enabled = Off Main Thread Painting Enabled
 off-main-thread-paint-worker-count = Off Main Thread Painting Worker Count
 target-frame-rate = Target Frame Rate
 
-audio-backend = Audio Backend
-max-audio-channels = Max Channels
-channel-layout = Preferred Channel Layout
-sample-rate = Preferred Sample Rate
-
 min-lib-versions = Expected minimum version
 loaded-lib-versions = Version in use
 
 has-seccomp-bpf = Seccomp-BPF (System Call Filtering)
 has-seccomp-tsync = Seccomp Thread Synchronization
 has-user-namespaces = User Namespaces
 has-privileged-user-namespaces = User Namespaces for privileged processes
 can-sandbox-content = Content Process Sandboxing
--- a/toolkit/themes/shared/aboutSupport.css
+++ b/toolkit/themes/shared/aboutSupport.css
@@ -90,11 +90,16 @@ td.integer {
   display: block;
 }
 
 #verify-place-result {
   max-height: 200px;
   overflow: auto;
 }
 
+#enumerate-database-result {
+  max-height: 200px;
+  overflow: auto;
+}
+
 .hidden {
   display: none;
 }