Bug 1375692 - Add Stylo status to about:support. r=bholley draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Fri, 23 Jun 2017 15:37:09 -0500
changeset 601340 f8aa2d4085cebb726bd802669d99a470bd0772bf
parent 599782 c03f906e6579fce0b61524c4f5c8445dfa76ffe0
child 635212 65487ce773612bb845b947cd0083302af3ec3cc9
push id66011
push userbmo:jryans@gmail.com
push dateWed, 28 Jun 2017 17:02:22 +0000
reviewersbholley
bugs1375692
milestone56.0a1
Bug 1375692 - Add Stylo status to about:support. r=bholley Display current Stylo status in about:support along with a reason why it is enabled or disabled. MozReview-Commit-ID: HZaTL7y2FsY
toolkit/content/aboutSupport.js
toolkit/content/aboutSupport.xhtml
toolkit/locales/en-US/chrome/global/aboutSupport.properties
toolkit/modules/AppConstants.jsm
toolkit/modules/Troubleshoot.jsm
toolkit/modules/tests/browser/browser_Troubleshoot.js
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -67,16 +67,32 @@ var snapshotFormatters = {
       case 10:
         statusText = (Services.appinfo.OS == "Darwin" ? "OS X 10.6 - 10.8" : "Windows XP");
         break;
     }
 
     $("multiprocess-box").textContent = strings.formatStringFromName("multiProcessWindows",
       [data.numRemoteWindows, data.numTotalWindows, statusText], 3);
 
+    let styloReason;
+    if (!data.styloBuild) {
+      styloReason = strings.GetStringFromName("disabledByBuild");
+    } else if (data.styloResult != data.styloDefault) {
+      if (data.styloResult) {
+        styloReason = strings.GetStringFromName("enabledByUser");
+      } else {
+        styloReason = strings.GetStringFromName("disabledByUser");
+      }
+    } else if (data.styloDefault) {
+      styloReason = strings.GetStringFromName("enabledByDefault");
+    } else {
+      styloReason = strings.GetStringFromName("disabledByDefault");
+    }
+    $("stylo-box").textContent = `${data.styloResult} (${styloReason})`;
+
     let keyGoogleFound = data.keyGoogleFound ? "found" : "missing";
     $("key-google-box").textContent = strings.GetStringFromName(keyGoogleFound);
 
     let keyMozillaFound = data.keyMozillaFound ? "found" : "missing";
     $("key-mozilla-box").textContent = strings.GetStringFromName(keyMozillaFound);
 
     $("safemode-box").textContent = data.safeMode;
   },
--- a/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -225,16 +225,25 @@
             </th>
 
             <td id="multiprocess-box">
             </td>
           </tr>
 
           <tr>
             <th class="column">
+              Stylo
+            </th>
+
+            <td id="stylo-box">
+            </td>
+          </tr>
+
+          <tr>
+            <th class="column">
               &aboutSupport.appBasicsKeyGoogle;
             </th>
 
             <td id="key-google-box">
             </td>
           </tr>
 
           <tr>
--- a/toolkit/locales/en-US/chrome/global/aboutSupport.properties
+++ b/toolkit/locales/en-US/chrome/global/aboutSupport.properties
@@ -137,8 +137,15 @@ asyncPanZoom = Asynchronous Pan/Zoom
 apzNone = none
 wheelEnabled = wheel input enabled
 touchEnabled = touch input enabled
 dragEnabled = scrollbar drag enabled
 
 # LOCALIZATION NOTE %1 will be replaced with the key of a preference.
 wheelWarning = async wheel input disabled due to unsupported pref: %S
 touchWarning = async touch input disabled due to unsupported pref: %S
+
+# LOCALIZATION NOTE Strings explaining why a feature is or is not available.
+disabledByBuild = disabled by build
+enabledByDefault = enabled by default
+disabledByDefault = disabled by default
+enabledByUser = enabled by user
+disabledByUser = disabled by user
\ No newline at end of file
--- a/toolkit/modules/AppConstants.jsm
+++ b/toolkit/modules/AppConstants.jsm
@@ -364,9 +364,16 @@ this.AppConstants = Object.freeze({
 
   MOZ_PHOTON_THEME:
 #ifdef MOZ_PHOTON_THEME
     true,
 #else
     false,
 #endif
 
+  MOZ_STYLO:
+#ifdef MOZ_STYLO
+    true,
+#else
+    false,
+#endif
+
 });
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -61,16 +61,17 @@ const PREFS_WHITELIST = [
   "general.useragent.",
   "gfx.",
   "html5.",
   "image.",
   "javascript.",
   "keyword.",
   "layers.",
   "layout.css.dpi",
+  "layout.css.servo.enabled",
   "media.",
   "mousewheel.",
   "network.",
   "permissions.default.image",
   "places.",
   "plugin.",
   "plugins.",
   "print.",
@@ -217,16 +218,21 @@ var dataProviders = {
                          .createInstance(Ci.nsISupportsPRUint64);
       let appinfo = Services.appinfo.QueryInterface(Ci.nsIObserver);
       appinfo.observe(e10sStatus, "getE10SBlocked", "");
       data.autoStartStatus = e10sStatus.data;
     } catch (e) {
       data.autoStartStatus = -1;
     }
 
+    data.styloBuild = AppConstants.MOZ_STYLO;
+    data.styloDefault = Services.prefs.getDefaultBranch(null)
+                                .getBoolPref("layout.css.servo.enabled", false);
+    data.styloResult = Services.prefs.getBoolPref("layout.css.servo.enabled", false);
+
     const keyGoogle = Services.urlFormatter.formatURL("%GOOGLE_API_KEY%").trim();
     data.keyGoogleFound = keyGoogle != "no-google-api-key" && keyGoogle.length > 0;
 
     const keyMozilla = Services.urlFormatter.formatURL("%MOZILLA_API_KEY%").trim();
     data.keyMozillaFound = keyMozilla != "no-mozilla-api-key" && keyMozilla.length > 0;
 
     done(data);
   },
--- a/toolkit/modules/tests/browser/browser_Troubleshoot.js
+++ b/toolkit/modules/tests/browser/browser_Troubleshoot.js
@@ -133,16 +133,25 @@ const SNAPSHOT_SCHEMA = {
           type: "number",
         },
         numTotalWindows: {
           type: "number",
         },
         numRemoteWindows: {
           type: "number",
         },
+        styloBuild: {
+          type: "boolean",
+        },
+        styloDefault: {
+          type: "boolean",
+        },
+        styloResult: {
+          type: "boolean",
+        },
         keyGoogleFound: {
           type: "boolean",
         },
         keyMozillaFound: {
           type: "boolean",
         },
         safeMode: {
           type: "boolean",