From b666b9283afffe599d0b9d6114bb51570d893261 Mon Sep 17 00:00:00 2001 From: Ed Lee Date: Thu, 20 Aug 2020 17:48:50 +0000 Subject: [PATCH] Bug 1634386 - The Password Import Autocomplete suggestion is displayed on Linux r=MattN Share ChromeMigrationUtils.supportsLoginsForPlatform for ChromeProfileMigrator.getResources and ChromeMigrationUtils.getImportableLogins. Differential Revision: https://phabricator.services.mozilla.com/D87639 --- browser/components/migration/ChromeMigrationUtils.jsm | 9 +++++++++ browser/components/migration/ChromeProfileMigrator.jsm | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/browser/components/migration/ChromeMigrationUtils.jsm b/browser/components/migration/ChromeMigrationUtils.jsm index 24b0f9decd86..84420af83753 100644 --- a/browser/components/migration/ChromeMigrationUtils.jsm +++ b/browser/components/migration/ChromeMigrationUtils.jsm @@ -37,6 +37,10 @@ var ChromeMigrationUtils = { // } _extensionLocaleStrings: {}, + get supportsLoginsForPlatform() { + return ["macosx", "win"].includes(AppConstants.platform); + }, + /** * Get all extensions installed in a specific profile. * @param {String} profileId - A Chrome user profile ID. For example, "Profile 1". @@ -369,6 +373,11 @@ var ChromeMigrationUtils = { */ _importableLoginsCache: null, async getImportableLogins(formOrigin) { + // Only provide importable if we actually support importing. + if (!this.supportsLoginsForPlatform) { + return undefined; + } + // Lazily fill the cache with all importable login browsers. if (!this._importableLoginsCache) { this._importableLoginsCache = new Map(); diff --git a/browser/components/migration/ChromeProfileMigrator.jsm b/browser/components/migration/ChromeProfileMigrator.jsm index 416d06ead170..1d60a7a0d7e7 100644 --- a/browser/components/migration/ChromeProfileMigrator.jsm +++ b/browser/components/migration/ChromeProfileMigrator.jsm @@ -120,7 +120,7 @@ ChromeProfileMigrator.prototype.getResources = async function Chrome_getResource GetHistoryResource(profileFolder), GetCookiesResource(profileFolder), ]; - if (AppConstants.platform == "win" || AppConstants.platform == "macosx") { + if (ChromeMigrationUtils.supportsLoginsForPlatform) { possibleResourcePromises.push( this._GetPasswordsResource(profileFolder) );