Commit ffecd665 authored by henry's avatar henry Committed by morgan
Browse files

BB 44830: Include the newtab AboutPreferences.sys.mjs file for the home settings.

Drop once we get the patch from bugzilla bug 2048379.
parent 1a8a3b08
Loading
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -5,6 +5,10 @@
import { SettingGroupManager } from "chrome://browser/content/preferences/config/SettingGroupManager.mjs";
import { Preferences } from "chrome://global/content/preferences/Preferences.mjs";

const { AboutPreferences } = ChromeUtils.importESModule(
  "moz-src:///browser/extensions/newtab/lib/AboutPreferences.sys.mjs"
);

/*
 * Preferences:
 *
@@ -32,4 +36,7 @@ if (Services.prefs.getBoolPref("browser.settings-redesign.enabled")) {
    defaultBrowserHome: window.createDefaultBrowserConfig(),
    startupHome: window.createStartupConfig(),
  });
  // Register the rest of the home settings using the "newtab" extension's file.
  // tor-browser#44830.
  new AboutPreferences().baseBrowserRegisterGroups(window);
}
+5 −0
Original line number Diff line number Diff line
@@ -5,3 +5,8 @@
DIRS += []

JAR_MANIFESTS += ["jar.mn"]

# Hack in the AboutPreferences.sys.mjs file, which is needed for the home
# settings pane, and can more-or-less function without the rest of the "newtab"
# extension. tor-browser#44830.
MOZ_SRC_FILES += ["newtab/lib/AboutPreferences.sys.mjs"]
+25 −9
Original line number Diff line number Diff line
@@ -2,15 +2,14 @@
 * 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/. */

import {
  actionTypes as at,
  actionCreators as ac,
} from "resource://newtab/common/Actions.mjs";
import {
  WIDGET_REGISTRY,
  isWidgetToggleVisible,
  isWidgetsContainerVisible,
} from "resource://newtab/common/WidgetsRegistry.mjs";
// The newtab extension is not available in base browser, so we replace the
// imports with empty objects that we do *not* expect to be used in practice.
// See tor-browser#44830.
const at = {};
const ac = {};
const WIDGET_REGISTRY = [];
const isWidgetToggleVisible = () => {};
const isWidgetsContainerVisible = () => {};

const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@@ -347,6 +346,23 @@ export class AboutPreferences {
    this.toggleRestoreDefaults(window.gHomePane);
  }

  /**
   * Register the setting groups for base browser.
   *
   * Added for tor-browser#44830.
   *
   * @param {Window} window - The about:preferences window.
   */
  baseBrowserRegisterGroups(window) {
    // We do not register the "home" component, since this is specific for
    // Firefox Home. tor-browser#44830.
    window.MozXULElement.insertFTLIfNeeded("browser/newtab/newtab.ftl");
    window.SettingGroupManager.registerGroups({
      homepage: this._setupHomepageGroup(window),
      customHomepage: this._setupCustomHomepageGroup(window),
    });
  }

  /** @param {Window} window */
  _registerPreferences(window) {
    const { Preferences } = window;