Loading mobile/shared/modules/geckoview/GeckoViewWebExtension.sys.mjs +6 −1 Original line number Diff line number Diff line Loading @@ -354,7 +354,9 @@ async function exportExtension(aAddon, aSourceURI) { disabledFlags.push("appVersionDisabled"); } const baseURL = policy ? policy.getURL() : ""; const privateBrowsingAllowed = policy ? policy.privateBrowsingAllowed : false; const privateBrowsingAllowed = policy ? policy.privateBrowsingAllowed : lazy.PrivateBrowsingUtils.permanentPrivateBrowsing; let updateDate; try { Loading Loading @@ -509,6 +511,9 @@ class ExtensionInstallListener { async onInstallEnded(aInstall, aAddon) { debug`onInstallEnded addonId=${aAddon.id}`; if (lazy.PrivateBrowsingUtils.permanentPrivateBrowsing) { await GeckoViewWebExtension.setPrivateBrowsingAllowed(aAddon.id, true); } const extension = await exportExtension(aAddon, aInstall.sourceURI); this.resolve({ extension }); } Loading toolkit/mozapps/extensions/AddonManager.sys.mjs +25 −0 Original line number Diff line number Diff line Loading @@ -83,7 +83,10 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { AbuseReporter: "resource://gre/modules/AbuseReporter.sys.mjs", AddonRepository: "resource://gre/modules/addons/AddonRepository.sys.mjs", GeckoViewWebExtension: "resource://gre/modules/GeckoViewWebExtension.sys.mjs", EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", Extension: "resource://gre/modules/Extension.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", TelemetryTimestamps: "resource://gre/modules/TelemetryTimestamps.sys.mjs", isGatedPermissionType: Loading Loading @@ -2346,6 +2349,24 @@ var AddonManagerInternal = { return promiseInstall; }, async installGeckoViewWebExtension(extensionUri) { const installId = Services.uuid.generateUUID().toString(); let { extension } = await lazy.GeckoViewWebExtension.installWebExtension( installId, extensionUri ); if (lazy.PrivateBrowsingUtils.permanentPrivateBrowsing) { extension = await lazy.GeckoViewWebExtension.setPrivateBrowsingAllowed( extension.webExtensionId, true ); } await lazy.EventDispatcher.instance.sendRequest({ type: "GeckoView:WebExtension:OnInstalled", extension, }); }, /** * Starts installation of an AddonInstall notifying the registered * web install listener of a blocked or started install. Loading Loading @@ -2518,6 +2539,10 @@ var AddonManagerInternal = { ); if (installAllowed) { if (AppConstants.platform == "android") { aInstall.cancel(); return this.installGeckoViewWebExtension(aInstall.sourceURI); } startInstall("AMO"); } else if (installPerm === Ci.nsIPermissionManager.DENY_ACTION) { // Block without prompt Loading toolkit/mozapps/extensions/components.conf +9 −10 Original line number Diff line number Diff line Loading @@ -32,10 +32,9 @@ Classes = [ 'esModule': 'resource://gre/modules/amWebAPI.sys.mjs', 'constructor': 'WebAPI', }, ] if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] != 'android': Classes += [ # tor-browser#43132: re-enable XPI handler on Android to allow scriptless extensions installation. # This reverts https://bugzilla.mozilla.org/show_bug.cgi?id=1610571, which made sense for generic # GeckoView extensionless embedders and for Firefox, relying on navigator.mozAddonManager. { 'cid': '{7beb3ba8-6ec3-41b4-b67c-da89b8518922}', 'contract_ids': ['@mozilla.org/uriloader/content-handler;1?type=application/x-xpinstall'], Loading toolkit/mozapps/extensions/internal/XPIInstall.sys.mjs +5 −0 Original line number Diff line number Diff line Loading @@ -4475,6 +4475,11 @@ export var XPIInstall = { return false; } // tor-browser#43132: short-circuit permission check on Android scriptless install from AMO if (AppConstants.platform == "android" && uri.prePath == "https://addons.mozilla.org") { return true; } let requireWhitelist = Services.prefs.getBoolPref( PREF_XPI_WHITELIST_REQUIRED, true Loading Loading
mobile/shared/modules/geckoview/GeckoViewWebExtension.sys.mjs +6 −1 Original line number Diff line number Diff line Loading @@ -354,7 +354,9 @@ async function exportExtension(aAddon, aSourceURI) { disabledFlags.push("appVersionDisabled"); } const baseURL = policy ? policy.getURL() : ""; const privateBrowsingAllowed = policy ? policy.privateBrowsingAllowed : false; const privateBrowsingAllowed = policy ? policy.privateBrowsingAllowed : lazy.PrivateBrowsingUtils.permanentPrivateBrowsing; let updateDate; try { Loading Loading @@ -509,6 +511,9 @@ class ExtensionInstallListener { async onInstallEnded(aInstall, aAddon) { debug`onInstallEnded addonId=${aAddon.id}`; if (lazy.PrivateBrowsingUtils.permanentPrivateBrowsing) { await GeckoViewWebExtension.setPrivateBrowsingAllowed(aAddon.id, true); } const extension = await exportExtension(aAddon, aInstall.sourceURI); this.resolve({ extension }); } Loading
toolkit/mozapps/extensions/AddonManager.sys.mjs +25 −0 Original line number Diff line number Diff line Loading @@ -83,7 +83,10 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { AbuseReporter: "resource://gre/modules/AbuseReporter.sys.mjs", AddonRepository: "resource://gre/modules/addons/AddonRepository.sys.mjs", GeckoViewWebExtension: "resource://gre/modules/GeckoViewWebExtension.sys.mjs", EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", Extension: "resource://gre/modules/Extension.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", RemoteSettings: "resource://services-settings/remote-settings.sys.mjs", TelemetryTimestamps: "resource://gre/modules/TelemetryTimestamps.sys.mjs", isGatedPermissionType: Loading Loading @@ -2346,6 +2349,24 @@ var AddonManagerInternal = { return promiseInstall; }, async installGeckoViewWebExtension(extensionUri) { const installId = Services.uuid.generateUUID().toString(); let { extension } = await lazy.GeckoViewWebExtension.installWebExtension( installId, extensionUri ); if (lazy.PrivateBrowsingUtils.permanentPrivateBrowsing) { extension = await lazy.GeckoViewWebExtension.setPrivateBrowsingAllowed( extension.webExtensionId, true ); } await lazy.EventDispatcher.instance.sendRequest({ type: "GeckoView:WebExtension:OnInstalled", extension, }); }, /** * Starts installation of an AddonInstall notifying the registered * web install listener of a blocked or started install. Loading Loading @@ -2518,6 +2539,10 @@ var AddonManagerInternal = { ); if (installAllowed) { if (AppConstants.platform == "android") { aInstall.cancel(); return this.installGeckoViewWebExtension(aInstall.sourceURI); } startInstall("AMO"); } else if (installPerm === Ci.nsIPermissionManager.DENY_ACTION) { // Block without prompt Loading
toolkit/mozapps/extensions/components.conf +9 −10 Original line number Diff line number Diff line Loading @@ -32,10 +32,9 @@ Classes = [ 'esModule': 'resource://gre/modules/amWebAPI.sys.mjs', 'constructor': 'WebAPI', }, ] if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] != 'android': Classes += [ # tor-browser#43132: re-enable XPI handler on Android to allow scriptless extensions installation. # This reverts https://bugzilla.mozilla.org/show_bug.cgi?id=1610571, which made sense for generic # GeckoView extensionless embedders and for Firefox, relying on navigator.mozAddonManager. { 'cid': '{7beb3ba8-6ec3-41b4-b67c-da89b8518922}', 'contract_ids': ['@mozilla.org/uriloader/content-handler;1?type=application/x-xpinstall'], Loading
toolkit/mozapps/extensions/internal/XPIInstall.sys.mjs +5 −0 Original line number Diff line number Diff line Loading @@ -4475,6 +4475,11 @@ export var XPIInstall = { return false; } // tor-browser#43132: short-circuit permission check on Android scriptless install from AMO if (AppConstants.platform == "android" && uri.prePath == "https://addons.mozilla.org") { return true; } let requireWhitelist = Services.prefs.getBoolPref( PREF_XPI_WHITELIST_REQUIRED, true Loading