Bug 1411532 part 2 - Add a line to about:support that says whether stylo is enabled for chrome. r=bz

MozReview-Commit-ID: K1DU9KbtQJZ

--HG--
extra : rebase_source : f7e1fc7e2181e1eb0813e944ef7544b7fab545a6
This commit is contained in:
Xidorn Quan 2017-10-27 15:37:22 +11:00
parent b24625e376
commit e75f3eb70c
3 changed files with 44 additions and 13 deletions

View File

@ -81,21 +81,36 @@ var snapshotFormatters = {
$("contentprocesses-row").hidden = true; $("contentprocesses-row").hidden = true;
} }
let styloReason; function getReasonStringName(resultValue, defaultValue) {
if (!data.styloBuild) { if (resultValue != defaultValue) {
styloReason = strings.GetStringFromName("disabledByBuild"); if (resultValue) {
} else if (data.styloResult != data.styloDefault) { return "enabledByUser";
if (data.styloResult) { } else {
styloReason = strings.GetStringFromName("enabledByUser"); return "disabledByUser";
}
} else { } else {
styloReason = strings.GetStringFromName("disabledByUser"); if (resultValue) {
return "enabledByDefault";
} else {
return "disabledByDefault";
}
} }
} else if (data.styloDefault) {
styloReason = strings.GetStringFromName("enabledByDefault");
} else {
styloReason = strings.GetStringFromName("disabledByDefault");
} }
$("stylo-box").textContent = `${data.styloResult} (${styloReason})`; let styloReason;
let styloChromeReason;
if (!data.styloBuild) {
styloReason = "disabledByBuild";
styloChromeReason = "disabledByBuild";
} else {
styloReason = getReasonStringName(data.styloResult, data.styloDefault);
styloChromeReason = getReasonStringName(data.styloChromeResult,
data.styloChromeDefault);
}
styloReason = strings.GetStringFromName(styloReason);
styloChromeReason = strings.GetStringFromName(styloChromeReason);
$("stylo-box").textContent =
`content = ${data.styloResult} (${styloReason}), ` +
`chrome = ${data.styloChromeResult} (${styloChromeReason})`;
let keyGoogleFound = data.keyGoogleFound ? "found" : "missing"; let keyGoogleFound = data.keyGoogleFound ? "found" : "missing";
$("key-google-box").textContent = strings.GetStringFromName(keyGoogleFound); $("key-google-box").textContent = strings.GetStringFromName(keyGoogleFound);

View File

@ -69,7 +69,7 @@ const PREFS_WHITELIST = [
"keyword.", "keyword.",
"layers.", "layers.",
"layout.css.dpi", "layout.css.dpi",
"layout.css.servo.enabled", "layout.css.servo.",
"layout.display-list.", "layout.display-list.",
"media.", "media.",
"mousewheel.", "mousewheel.",
@ -249,6 +249,16 @@ var dataProviders = {
Services.prefs.getBoolPref("layout.css.servo.enabled", false); Services.prefs.getBoolPref("layout.css.servo.enabled", false);
} }
} }
data.styloChromeDefault =
Services.prefs.getDefaultBranch(null)
.getBoolPref("layout.css.servo.chrome.enabled", false);
data.styloChromeResult = false;
if (data.styloResult) {
let winUtils = Services.wm.getMostRecentWindow("").
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);
data.styloChromeResult = winUtils.isStyledByServo;
}
const keyGoogle = Services.urlFormatter.formatURL("%GOOGLE_API_KEY%").trim(); const keyGoogle = Services.urlFormatter.formatURL("%GOOGLE_API_KEY%").trim();
data.keyGoogleFound = keyGoogle != "no-google-api-key" && keyGoogle.length > 0; data.keyGoogleFound = keyGoogle != "no-google-api-key" && keyGoogle.length > 0;

View File

@ -153,6 +153,12 @@ const SNAPSHOT_SCHEMA = {
styloResult: { styloResult: {
type: "boolean", type: "boolean",
}, },
styloChromeDefault: {
type: "boolean",
},
styloChromeResult: {
type: "boolean",
},
keyGoogleFound: { keyGoogleFound: {
type: "boolean", type: "boolean",
}, },