From 75cc37186011b2c6a8149ad8e317c3b754db6915 Mon Sep 17 00:00:00 2001 From: Michael Kaply Date: Wed, 21 Aug 2019 22:18:37 +0000 Subject: [PATCH] Bug 1571639 - Don't add distro bookmarks if profile has been reset. r=MattN Differential Revision: https://phabricator.services.mozilla.com/D42944 --HG-- extra : moz-landing-system : lando --- browser/components/distribution.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/browser/components/distribution.js b/browser/components/distribution.js index aca4c95ef50a..3ab96323e6b6 100644 --- a/browser/components/distribution.js +++ b/browser/components/distribution.js @@ -314,9 +314,19 @@ DistributionCustomizer.prototype = { ".bookmarksProcessed"; } - let bmProcessed = Services.prefs.getBoolPref(bmProcessedPref, false); + if (Services.prefs.getBoolPref(bmProcessedPref, false)) { + return; + } - if (!bmProcessed) { + let ProfileAge = ChromeUtils.import( + "resource://gre/modules/ProfileAge.jsm", + {} + ).ProfileAge; + let profileAge = await ProfileAge(); + let resetDate = await profileAge.reset; + + // If the profile has been reset, don't recreate bookmarks. + if (!resetDate) { if (sections.BookmarksMenu) { await this._parseBookmarksSection( PlacesUtils.bookmarks.menuGuid, @@ -329,8 +339,8 @@ DistributionCustomizer.prototype = { "BookmarksToolbar" ); } - Services.prefs.setBoolPref(bmProcessedPref, true); } + Services.prefs.setBoolPref(bmProcessedPref, true); }, _prefDefaultsApplied: false,