commit c7464169c3c328e443619db9c6dad0e1e7545606
parent cae4ed8cbf8ce6dc29928ad18bfaa3bb28d1679a
Author: Mark Striemer <mstriemer@mozilla.com>
Date: Fri, 19 Dec 2025 04:14:17 +0000
Bug 2005797 - Part 3: Put AI Features behind a pref r=akulyk
Differential Revision: https://phabricator.services.mozilla.com/D276734
Diffstat:
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/browser/components/preferences/preferences.js b/browser/components/preferences/preferences.js
@@ -285,6 +285,7 @@ const CONFIG_PANES = Object.freeze({
l10nId: "preferences-ai-features-header",
groupIds: ["aiFeatures"],
module: "chrome://browser/content/preferences/config/aiFeatures.mjs",
+ visible: () => srdSectionEnabled("aiFeatures"),
},
});
diff --git a/browser/components/preferences/widgets/setting-pane/setting-pane.mjs b/browser/components/preferences/widgets/setting-pane/setting-pane.mjs
@@ -12,6 +12,7 @@ import { MozLitElement } from "chrome://global/content/lit-utils.mjs";
* @property {string[]} groupIds What setting groups should be rendered.
* @property {string} [iconSrc] Optional icon shown in the page header.
* @property {string} [module] Import path for module housing the config.
+ * @property {() => boolean} [visible] If this pane is visible.
*/
export class SettingPane extends MozLitElement {
@@ -50,9 +51,26 @@ export class SettingPane extends MozLitElement {
window.gotoPref(this.config.parent);
}
+ handleVisibility() {
+ if (this.config.visible) {
+ let visible = this.config.visible();
+ if (!visible && !this.isSubPane) {
+ let categoryButton = /** @type {XULElement} */ (
+ document.querySelector(`#categories [value="${this.name}"]`)
+ );
+ if (categoryButton) {
+ categoryButton.remove();
+ }
+ this.remove();
+ }
+ }
+ }
+
connectedCallback() {
super.connectedCallback();
+ this.handleVisibility();
+
document.addEventListener(
"paneshown",
/**