Bug 1497637 - Pull and display all settings into the new "about:config" page. r=paolo

Differential Revision: https://phabricator.services.mozilla.com/D8469

--HG--
extra : rebase_source : 6470533b872fda4a6c812cf9e6e69d29de96e094
This commit is contained in:
Vincent Cote 2018-10-30 09:48:32 +00:00
parent fc3d974254
commit e6f30d5b21
4 changed files with 70 additions and 8 deletions

View File

@ -2,4 +2,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* aboutconfig.css */
#list {
margin: 0;
padding: 2em;
overflow-wrap: break-word;
}
#list > li {
padding: 5px;
list-style: none;
}
#list > li:nth-child(even) {
background-color: rgba(0, 0, 0, .06);
}
#list > li:nth-child(odd) {
background-color: rgba(0, 0, 0, .03);
}

View File

@ -2,20 +2,21 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE HTML>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" media="screen, projection" type="text/css"
href="chrome://global/skin/in-content/common.css"/>
href="chrome://global/skin/in-content/common.css">
<link rel="stylesheet" type="text/css"
href="chrome://browser/content/aboutconfig/aboutconfig.css"/>
href="chrome://browser/content/aboutconfig/aboutconfig.css">
<link rel="localization" href="browser/aboutConfig.ftl">
<script type="application/javascript"
src="chrome://browser/content/aboutconfig/aboutconfig.js"></script>
<title data-l10n-id="about-config-title"></title>
</head>
<body>
<body onload="onLoad();">
<ul id="list"></ul>
</body>
</html>
</html>

View File

@ -2,4 +2,28 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* aboutconfig.js */
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/Preferences.jsm");
let gPrefArray;
function onLoad() {
gPrefArray = Services.prefs.getChildList("").map(name => ({
name,
value: Preferences.get(name),
hasUserValue: Services.prefs.prefHasUserValue(name),
}));
gPrefArray.sort((a, b) => a.name > b.name);
let fragment = document.createDocumentFragment();
for (let pref of gPrefArray) {
let listItem = document.createElement("li");
listItem.textContent = pref.name + " || " +
(pref.hasUserValue ? "Modified" : "Default") + " || " +
pref.value.constructor.name + " || " + pref.value;
fragment.appendChild(listItem);
}
document.getElementById("list").appendChild(fragment);
}

View File

@ -1,10 +1,12 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const PAGE_URL = "chrome://browser/content/aboutconfig/aboutconfig.html";
add_task(async function test_load_title() {
await BrowserTestUtils.withNewTab({
gBrowser,
url: "chrome://browser/content/aboutconfig/aboutconfig.html",
url: PAGE_URL,
}, browser => {
info("about:config loaded");
return ContentTask.spawn(browser, null, async () => {
@ -13,3 +15,21 @@ add_task(async function test_load_title() {
});
});
});
add_task(async function test_load_settings() {
await BrowserTestUtils.withNewTab({
gBrowser,
url: PAGE_URL,
}, browser => {
return ContentTask.spawn(browser, null, () => {
let list = [...content.document.getElementById("list")
.getElementsByTagName("li")];
function findPref(name) {
return list.some(e => e.textContent.trim().startsWith(name + " "));
}
Assert.ok(findPref("plugins.testmode"));
Assert.ok(findPref("dom.vr.enabled"));
Assert.ok(findPref("accessibility.AOM.enabled"));
});
});
});