Commit 24db7bf6 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃 Committed by brizental
Browse files

MB 20: Allow packaged-addons in PBM.

We install a few addons from the distribution directory, but they are
not automatically enabled for PBM mode.
This commit modifies the code that installs them to also add the PBM
permission to the known ones.
parent 2abe1b5d
Loading
Loading
Loading
Loading
+14 −0
Changes for toolkit/mozapps/extensions/internal/XPIProvider.sys.mjs: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
  Dictionary: "resource://gre/modules/Extension.sys.mjs",
  Extension: "resource://gre/modules/Extension.sys.mjs",
  ExtensionData: "resource://gre/modules/Extension.sys.mjs",
  ExtensionPermissions: "resource://gre/modules/ExtensionPermissions.sys.mjs",
  FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
  JSONFile: "resource://gre/modules/JSONFile.sys.mjs",
  Langpack: "resource://gre/modules/Extension.sys.mjs",
@@ -3267,6 +3268,19 @@ export var XPIProvider = {
            }
            aManifests[loc.name][id] = addon;
            changed = true;

            // mullvad-browser#20: Allow pre-installed extensions in PBM
            const PRIVATE_ALLOWED_PERMISSION =
              "internal:privateBrowsingAllowed";
            if (
              addon.id === "uBlock0@raymondhill.net" ||
              addon.id == "{d19a89b9-76c1-4a61-bcd4-49e8de916403}"
            ) {
              lazy.ExtensionPermissions.add(addon.id, {
                permissions: [PRIVATE_ALLOWED_PERMISSION],
                origins: [],
              });
            }
          }
        } catch (e) {
          logger.error(`Failed to install distribution add-on ${file.path}`, e);