diff --git a/browser/components/about/AboutProtectionsHandler.jsm b/browser/components/about/AboutProtectionsHandler.jsm index e7ba4f78a352..383f5be4fca6 100644 --- a/browser/components/about/AboutProtectionsHandler.jsm +++ b/browser/components/about/AboutProtectionsHandler.jsm @@ -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; } }, }; diff --git a/browser/components/protections/content/protections.js b/browser/components/protections/content/protections.js index cba2162d7201..a2e85f605a5a 100644 --- a/browser/components/protections/content/protections.js +++ b/browser/components/protections/content/protections.js @@ -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. diff --git a/toolkit/components/remotepagemanager/MessagePort.jsm b/toolkit/components/remotepagemanager/MessagePort.jsm index 3eb62f7f56c9..162c24577ee5 100644 --- a/toolkit/components/remotepagemanager/MessagePort.jsm +++ b/toolkit/components/remotepagemanager/MessagePort.jsm @@ -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"],