morgan pushed to branch mullvad-browser-153.1.0esr-16.0-1 at The Tor Project / Applications / Mullvad Browser

Commits:

4 changed files:

Changes:

  • browser/components/preferences/config/home-startup.mjs
    ... ... @@ -5,6 +5,10 @@
    5 5
     import { SettingGroupManager } from "chrome://browser/content/preferences/config/SettingGroupManager.mjs";
    
    6 6
     import { Preferences } from "chrome://global/content/preferences/Preferences.mjs";
    
    7 7
     
    
    8
    +const { AboutPreferences } = ChromeUtils.importESModule(
    
    9
    +  "moz-src:///browser/extensions/newtab/lib/AboutPreferences.sys.mjs"
    
    10
    +);
    
    11
    +
    
    8 12
     /*
    
    9 13
      * Preferences:
    
    10 14
      *
    
    ... ... @@ -32,4 +36,7 @@ if (Services.prefs.getBoolPref("browser.settings-redesign.enabled")) {
    32 36
         defaultBrowserHome: window.createDefaultBrowserConfig(),
    
    33 37
         startupHome: window.createStartupConfig(),
    
    34 38
       });
    
    39
    +  // Register the rest of the home settings using the "newtab" extension's file.
    
    40
    +  // tor-browser#44830.
    
    41
    +  new AboutPreferences().baseBrowserRegisterGroups(window);
    
    35 42
     }

  • browser/components/preferences/preferences.js
    ... ... @@ -318,7 +318,9 @@ const CONFIG_PANES = Object.freeze({
    318 318
       home: {
    
    319 319
         l10nId: "home-section",
    
    320 320
         iconSrc: "chrome://browser/skin/home.svg",
    
    321
    -    groupIds: ["defaultBrowserHome", "startupHome", "homepage", "home"],
    
    321
    +    // We drop the "home" settings entirely since they are only relevant for
    
    322
    +    // Firefox Home. tor-browser#44830.
    
    323
    +    groupIds: ["defaultBrowserHome", "startupHome", "homepage"],
    
    322 324
         module: "chrome://browser/content/preferences/config/home-startup.mjs",
    
    323 325
         replaces: "home",
    
    324 326
       },
    

  • browser/extensions/moz.build
    ... ... @@ -5,3 +5,8 @@
    5 5
     DIRS += []
    
    6 6
     
    
    7 7
     JAR_MANIFESTS += ["jar.mn"]
    
    8
    +
    
    9
    +# Hack in the AboutPreferences.sys.mjs file, which is needed for the home
    
    10
    +# settings pane, and can more-or-less function without the rest of the "newtab"
    
    11
    +# extension. tor-browser#44830.
    
    12
    +MOZ_SRC_FILES += ["newtab/lib/AboutPreferences.sys.mjs"]

  • browser/extensions/newtab/lib/AboutPreferences.sys.mjs
    ... ... @@ -2,15 +2,14 @@
    2 2
      * License, v. 2.0. If a copy of the MPL was not distributed with this
    
    3 3
      * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    
    4 4
     
    
    5
    -import {
    
    6
    -  actionTypes as at,
    
    7
    -  actionCreators as ac,
    
    8
    -} from "resource://newtab/common/Actions.mjs";
    
    9
    -import {
    
    10
    -  WIDGET_REGISTRY,
    
    11
    -  isWidgetToggleVisible,
    
    12
    -  isWidgetsContainerVisible,
    
    13
    -} from "resource://newtab/common/WidgetsRegistry.mjs";
    
    5
    +// The newtab extension is not available in base browser, so we replace the
    
    6
    +// imports with empty objects that we do *not* expect to be used in practice.
    
    7
    +// See tor-browser#44830.
    
    8
    +const at = {};
    
    9
    +const ac = {};
    
    10
    +const WIDGET_REGISTRY = [];
    
    11
    +const isWidgetToggleVisible = () => {};
    
    12
    +const isWidgetsContainerVisible = () => {};
    
    14 13
     
    
    15 14
     const lazy = {};
    
    16 15
     ChromeUtils.defineESModuleGetters(lazy, {
    
    ... ... @@ -347,6 +346,23 @@ export class AboutPreferences {
    347 346
         this.toggleRestoreDefaults(window.gHomePane);
    
    348 347
       }
    
    349 348
     
    
    349
    +  /**
    
    350
    +   * Register the setting groups for base browser.
    
    351
    +   *
    
    352
    +   * Added for tor-browser#44830.
    
    353
    +   *
    
    354
    +   * @param {Window} window - The about:preferences window.
    
    355
    +   */
    
    356
    +  baseBrowserRegisterGroups(window) {
    
    357
    +    // We do not register the "home" component, since this is specific for
    
    358
    +    // Firefox Home. tor-browser#44830.
    
    359
    +    window.MozXULElement.insertFTLIfNeeded("browser/newtab/newtab.ftl");
    
    360
    +    window.SettingGroupManager.registerGroups({
    
    361
    +      homepage: this._setupHomepageGroup(window),
    
    362
    +      customHomepage: this._setupCustomHomepageGroup(window),
    
    363
    +    });
    
    364
    +  }
    
    365
    +
    
    350 366
       /** @param {Window} window */
    
    351 367
       _registerPreferences(window) {
    
    352 368
         const { Preferences } = window;