зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1568110 - Use RPMGetBoolPref to get prefs in about:protections. r=mtigley,ewright
Differential Revision: https://phabricator.services.mozilla.com/D38966 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a5a3d1e566
Коммит
1bfdedd197
|
@ -65,13 +65,7 @@ var AboutProtectionsHandler = {
|
|||
"FetchContentBlockingEvents",
|
||||
"FetchMonitorData",
|
||||
"FetchUserLoginsData",
|
||||
// Getting prefs
|
||||
"GetEnabledPrefs",
|
||||
],
|
||||
_prefs: {
|
||||
LockwiseCard: "browser.contentblocking.report.lockwise.enabled",
|
||||
MonitorCard: "browser.contentblocking.report.monitor.enabled",
|
||||
},
|
||||
PREF_CB_CATEGORY: "browser.contentblocking.category",
|
||||
|
||||
init() {
|
||||
|
@ -301,18 +295,6 @@ var AboutProtectionsHandler = {
|
|||
await this.getLoginData()
|
||||
);
|
||||
break;
|
||||
case "GetEnabledPrefs":
|
||||
const prefs = Object.keys(this._prefs);
|
||||
|
||||
// Get all the enabled prefs and send separate messages depending on their names.
|
||||
for (let name of prefs) {
|
||||
const message = `SendEnabled${name}Pref`;
|
||||
const isEnabled = Services.prefs.getBoolPref(this._prefs[name]);
|
||||
this.sendMessage(aMessage.target, message, {
|
||||
isEnabled,
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -29,9 +29,6 @@ document.addEventListener("DOMContentLoaded", e => {
|
|||
RPMSendAsyncMessage("OpenContentBlockingPreferences");
|
||||
});
|
||||
|
||||
// Get the display prefs for each component
|
||||
RPMSendAsyncMessage("GetEnabledPrefs");
|
||||
|
||||
RPMAddMessageListener("SendCBCategory", message => {
|
||||
if (message.data == "custom") {
|
||||
protectionDetails.setAttribute(
|
||||
|
@ -172,29 +169,31 @@ document.addEventListener("DOMContentLoaded", e => {
|
|||
createGraph(message.data);
|
||||
});
|
||||
|
||||
// Display Monitor card
|
||||
RPMAddMessageListener("SendEnabledMonitorCardPref", message => {
|
||||
if (message.data.isEnabled) {
|
||||
const monitorCard = new MonitorCard(document);
|
||||
monitorCard.init();
|
||||
}
|
||||
let lockwiseEnabled = RPMGetBoolPref(
|
||||
"browser.contentblocking.report.lockwise.enabled",
|
||||
true
|
||||
);
|
||||
if (lockwiseEnabled) {
|
||||
const lockwiseCard = new LockwiseCard(document);
|
||||
lockwiseCard.init();
|
||||
}
|
||||
|
||||
// For tests
|
||||
const monitorUI = document.querySelector(".monitor-card");
|
||||
monitorUI.dataset.enabled = message.data.isEnabled;
|
||||
});
|
||||
// For tests
|
||||
const lockwiseUI = document.querySelector(".lockwise-card");
|
||||
lockwiseUI.dataset.enabled = lockwiseEnabled;
|
||||
|
||||
// Display Lockwise card
|
||||
RPMAddMessageListener("SendEnabledLockwiseCardPref", message => {
|
||||
if (message.data.isEnabled) {
|
||||
const lockwiseCard = new LockwiseCard(document);
|
||||
lockwiseCard.init();
|
||||
}
|
||||
let monitorEnabled = RPMGetBoolPref(
|
||||
"browser.contentblocking.report.monitor.enabled",
|
||||
true
|
||||
);
|
||||
if (monitorEnabled) {
|
||||
const monitorCard = new MonitorCard(document);
|
||||
monitorCard.init();
|
||||
}
|
||||
|
||||
// For tests
|
||||
const lockwiseUI = document.querySelector(".lockwise-card");
|
||||
lockwiseUI.dataset.enabled = message.data.isEnabled;
|
||||
});
|
||||
// For tests
|
||||
const monitorUI = document.querySelector(".monitor-card");
|
||||
monitorUI.dataset.enabled = monitorEnabled;
|
||||
|
||||
// Dispatch messages to retrieve data for the Lockwise & Monitor
|
||||
// cards.
|
||||
|
|
|
@ -57,6 +57,12 @@ let RPMAccessManager = {
|
|||
getFormatURLPref: ["app.support.baseURL"],
|
||||
isWindowPrivate: ["yes"],
|
||||
},
|
||||
"about:protections": {
|
||||
getBoolPref: [
|
||||
"browser.contentblocking.report.lockwise.enabled",
|
||||
"browser.contentblocking.report.monitor.enabled",
|
||||
],
|
||||
},
|
||||
"about:newinstall": {
|
||||
getUpdateChannel: ["yes"],
|
||||
getFxAccountsEndpoint: ["yes"],
|
||||
|
|
Загрузка…
Ссылка в новой задаче