This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch geckoview-99.0.1-11.0-1 in repository tor-browser.
commit ddf8a7e97333813de0239ae48bc59dd28e88a70b Author: Mike Kaply mozilla@kaply.com AuthorDate: Thu Mar 10 15:11:34 2022 +0000
Bug 1759009 - Update distribution config. r=standard8 a=pascalc l10n=flod
Differential Revision: https://phabricator.services.mozilla.com/D140898 --- browser/components/distribution.js | 53 +++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-)
diff --git a/browser/components/distribution.js b/browser/components/distribution.js index ac5d3b0593d6e..73823a62dab81 100644 --- a/browser/components/distribution.js +++ b/browser/components/distribution.js @@ -24,6 +24,11 @@ ChromeUtils.defineModuleGetter( "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm" ); +ChromeUtils.defineModuleGetter( + this, + "AddonManager", + "resource://gre/modules/AddonManager.jsm" +);
function DistributionCustomizer() {}
@@ -114,6 +119,19 @@ DistributionCustomizer.prototype = { return this._language; },
+ async _removeDistributionBookmarks() { + await PlacesUtils.bookmarks.fetch( + { guidPrefix: this.BOOKMARK_GUID_PREFIX }, + bookmark => PlacesUtils.bookmarks.remove(bookmark).catch() + ); + await PlacesUtils.bookmarks.fetch( + { guidPrefix: this.FOLDER_GUID_PREFIX }, + folder => { + PlacesUtils.bookmarks.remove(folder).catch(); + } + ); + }, + async _parseBookmarksSection(parentGuid, section) { let keys = Array.from(this._ini.getKeys(section)).sort(); let re = /^item.(\d+).(\w+).?(\w*)/; @@ -278,7 +296,30 @@ DistributionCustomizer.prototype = {
_bookmarksApplied: false, async applyBookmarks() { - await this._doApplyBookmarks(); + let prefs = Services.prefs + .getChildList("distribution.yandex") + .concat(Services.prefs.getChildList("distribution.mailru")) + .concat(Services.prefs.getChildList("distribution.okru")); + if (prefs.length) { + let extensionIDs = [ + "sovetnik-yandex@yandex.ru", + "vb@yandex.ru", + "ntp-mail@corp.mail.ru", + "ntp-okru@corp.mail.ru", + ]; + for (let extensionID of extensionIDs) { + let addon = await AddonManager.getAddonByID(extensionID); + if (addon) { + await addon.disable(); + } + } + for (let pref of prefs) { + Services.prefs.clearUserPref(pref); + } + await this._removeDistributionBookmarks(); + } else { + await this._doApplyBookmarks(); + } this._bookmarksApplied = true; this._checkCustomizationComplete(); }, @@ -372,6 +413,16 @@ DistributionCustomizer.prototype = { // separate because they are "special" (read: required)
defaults.set("distribution.id", distroID); + + if ( + distroID.startsWith("yandex") || + distroID.startsWith("mailru") || + distroID.startsWith("okru") + ) { + this.__defineGetter__("_ini", () => null); + return this._checkCustomizationComplete(); + } + defaults.set( "distribution.version", this._ini.getString("Global", "version")