Bug 1869153, remove file import preference signon.management.page.fileImport.enabled and supporting code since it is enabled by default, r=mconley,fluent-reviewers,credential-management-reviewers,migration-reviewers,issammani

Differential Revision: https://phabricator.services.mozilla.com/D223852
This commit is contained in:
Neil Deakin 2024-10-02 16:13:52 +00:00
parent 9202d3beba
commit 06d4fbee9f
17 changed files with 9 additions and 170 deletions

View File

@ -2494,8 +2494,6 @@ pref("extensions.pocket.refresh.emailButton.enabled", false);
// Hides the recently saved section in the home panel.
pref("extensions.pocket.refresh.hideRecentSaves.enabled", false);
pref("signon.management.page.fileImport.enabled", true);
// "available" - user can see feature offer.
// "offered" - we have offered feature to user and they have not yet made a decision.
// "enabled" - user opted in to the feature.

View File

@ -131,9 +131,6 @@ export class AboutLoginsChild extends JSWindowActorChild {
return gPrimaryPasswordPromise;
},
fileImportEnabled: Services.prefs.getBoolPref(
"signon.management.page.fileImport.enabled"
),
// Default to enabled just in case a search is attempted before we get a response.
primaryPasswordEnabled: true,
passwordRevealVisible: true,

View File

@ -251,9 +251,6 @@
<a data-l10n-name="passwords-help-link" class="intro-help-link" target="_blank" rel="noreferrer"></a>
</li>
</ul>
<p class="description intro-import-text no-file-import" hidden data-l10n-id="about-logins-intro-browser-only-import">
<a data-l10n-name="import-link" href="#"></a>
</p>
<p class="description intro-import-text file-import" hidden data-l10n-id="about-logins-intro-import3">
<a data-l10n-name="import-browser-link" href="#"></a>
<a data-l10n-name="import-file-link" href="#"></a>

View File

@ -54,10 +54,9 @@ export default class LoginIntro extends HTMLElement {
.querySelector(".intro-help-link")
.setAttribute("href", supportURL);
let importClass = window.AboutLoginsUtils.fileImportEnabled
? ".intro-import-text.file-import"
: ".intro-import-text.no-file-import";
let importText = this.shadowRoot.querySelector(importClass);
let importText = this.shadowRoot.querySelector(
".intro-import-text.file-import"
);
importText.addEventListener("click", this);
importText.hidden = !window.AboutLoginsUtils.importVisible;
}

View File

@ -158,9 +158,6 @@ export default class MenuButton extends HTMLElement {
}
_showMenu() {
this._menu.querySelector(".menuitem-import-file").hidden =
!window.AboutLoginsUtils.fileImportEnabled;
this._menu.hidden = false;
// Event listeners to close the menu

View File

@ -84,11 +84,7 @@ add_task(async function test_no_logins_class() {
"When logged in the message should update"
);
let importClass = Services.prefs.getBoolPref(
"signon.management.page.fileImport.enabled"
)
? ".intro-import-text.file-import"
: ".intro-import-text.no-file-import";
const importClass = ".intro-import-text.file-import";
Assert.equal(
ContentTaskUtils.isHidden(
loginIntro.shadowRoot.querySelector(importClass)

View File

@ -65,12 +65,7 @@ class CsvImportHelper {
function getImportMenuItem() {
let menuButton = window.document.querySelector("menu-button");
let importButton = menuButton.shadowRoot.querySelector(
".menuitem-import-file"
);
// Force the menu item to be visible for the test.
importButton.hidden = false;
return importButton;
return menuButton.shadowRoot.querySelector(".menuitem-import-file");
}
BrowserTestUtils.synthesizeMouseAtCenter(getImportMenuItem, {}, browser);

View File

@ -90,9 +90,6 @@ Object.defineProperty(window, "AboutLoginsUtils", {
login1.password == login2.password
);
},
fileImportEnabled: SpecialPowers.getBoolPref(
"signon.management.page.fileImport.enabled"
),
primaryPasswordEnabled: false,
},
});

View File

@ -135,9 +135,7 @@ add_task(async function test_menu_open_close() {
await SimpleTest.promiseWaitForCondition(() => firstVisibleItem.matches(":focus"),
"waiting for firstVisibleItem to get focus again");
ok(firstVisibleItem.matches(":focus"), "firstVisibleItem should be focused after tabbing to it again");
if (SpecialPowers.getBoolPref("signon.management.page.fileImport.enabled")) {
sendKey("TAB"); // Import from file
}
sendKey("TAB"); // Import from file
sendKey("TAB"); // Export
sendKey("TAB"); // Remove All Logins
@ -189,14 +187,12 @@ add_task(async function test_menu_keyboard_cycling() {
}
let allItems = [
"menuitem-import-file",
"menuitem-export",
"menuitem-remove-all-logins",
"menuitem-preferences",
"menuitem-help",
];
if (SpecialPowers.getBoolPref("signon.management.page.fileImport.enabled")) {
allItems = ["menuitem-import-file", ...allItems];
}
if (navigator.platform == "Win32" || navigator.platform == "MacIntel") {
allItems = ["menuitem-import-browser", ...allItems];
}

View File

@ -165,10 +165,7 @@ export class PasswordFileMigrator extends FileMigratorBase {
}
get enabled() {
return Services.prefs.getBoolPref(
"signon.management.page.fileImport.enabled",
false
);
return true;
}
get displayedResourceTypes() {

View File

@ -695,11 +695,7 @@ export class MigrationWizardParent extends JSWindowActorParent {
profileMigrationData & MigrationUtils.resourceTypes[resourceType] ||
(migrator.constructor.key == lazy.SafariProfileMigrator?.key &&
MigrationUtils.resourceTypes[resourceType] ==
MigrationUtils.resourceTypes.PASSWORDS &&
Services.prefs.getBoolPref(
"signon.management.page.fileImport.enabled",
false
))
MigrationUtils.resourceTypes.PASSWORDS)
) {
availableResourceTypes.push(resourceType);
}

View File

@ -17,12 +17,6 @@ add_task(async function test_browser_no_programs() {
return [];
});
// Let's enable the Passwords CSV import by default so that it appears
// as a file migrator.
await SpecialPowers.pushPrefEnv({
set: [["signon.management.page.fileImport.enabled", true]],
});
await withMigrationWizardDialog(async prefsWin => {
let dialog = prefsWin.document.querySelector("#migrationWizardDialog");
let wizard = dialog.querySelector("migration-wizard");
@ -51,42 +45,5 @@ add_task(async function test_browser_no_programs() {
);
});
// Now disable all file migrators to make sure that the "Import from file"
// button is hidden.
await SpecialPowers.pushPrefEnv({
set: [
["signon.management.page.fileImport.enabled", false],
["browser.migrate.bookmarks-file.enabled", false],
],
});
await withMigrationWizardDialog(async prefsWin => {
let dialog = prefsWin.document.querySelector("#migrationWizardDialog");
let wizard = dialog.querySelector("migration-wizard");
let shadow = wizard.openOrClosedShadowRoot;
let deck = shadow.querySelector("#wizard-deck");
await BrowserTestUtils.waitForMutationCondition(
deck,
{ attributeFilter: ["selected-view"] },
() => {
return (
deck.getAttribute("selected-view") ==
"page-" + MigrationWizardConstants.PAGES.NO_BROWSERS_FOUND
);
}
);
Assert.ok(
true,
"Went to no browser page after attempting to search for migrators."
);
let chooseImportFromFile = shadow.querySelector("#choose-import-from-file");
Assert.ok(
chooseImportFromFile.hidden,
"Selecting a file migrator should not be possible."
);
});
sandbox.restore();
});

View File

@ -8,10 +8,6 @@
* selection page when only file migrators are found.
*/
add_task(async function test_only_file_migrators() {
await SpecialPowers.pushPrefEnv({
set: [["signon.management.page.fileImport.enabled", true]],
});
let sandbox = sinon.createSandbox();
registerCleanupFunction(() => {
sandbox.restore();

View File

@ -22,9 +22,6 @@ add_setup(async function () {
registerCleanupFunction(() => {
MockFilePicker.cleanup();
});
await SpecialPowers.pushPrefEnv({
set: [["signon.management.page.fileImport.enabled", true]],
});
});
/**
@ -410,59 +407,3 @@ add_task(async function test_safari_password_skip() {
}
);
});
/**
* Tests that importing from passwords for Safari doesn't exist if
* signon.management.page.fileImport.enabled is false.
*/
add_task(async function test_safari_password_disabled() {
await SpecialPowers.pushPrefEnv({
set: [["signon.management.page.fileImport.enabled", false]],
});
let sandbox = sinon.createSandbox();
registerCleanupFunction(() => {
sandbox.restore();
});
let safariMigrator = new SafariProfileMigrator();
sandbox.stub(MigrationUtils, "getMigrator").resolves(safariMigrator);
// We're not testing the permission flow here, so let's pretend that we
// always have permission to read resources from the disk.
sandbox
.stub(SafariProfileMigrator.prototype, "hasPermissions")
.resolves(true);
// Have the migrator claim that only BOOKMARKS are only available.
sandbox
.stub(SafariProfileMigrator.prototype, "getMigrateData")
.resolves(MigrationUtils.resourceTypes.BOOKMARKS);
await withMigrationWizardDialog(async prefsWin => {
let dialogBody = prefsWin.document.body;
let wizard = dialogBody.querySelector("migration-wizard");
let shadow = wizard.openOrClosedShadowRoot;
info("Choosing Safari");
let panelItem = shadow.querySelector(
`panel-item[key="${SafariProfileMigrator.key}"]`
);
panelItem.click();
let resourceTypeList = shadow.querySelector("#resource-type-list");
// Let's make sure that PASSWORDS is displayed despite the migrator only
// (currently) returning BOOKMARKS as an available resource to migrate.
let passwordsNode = resourceTypeList.querySelector(
`label[data-resource-type="${MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.PASSWORDS}"]`
);
Assert.ok(
passwordsNode.hidden,
"PASSWORDS should not be available to import from."
);
});
await SpecialPowers.popPrefEnv();
});

View File

@ -16,13 +16,6 @@ const { MigrationWizardConstants } = ChromeUtils.importESModule(
"chrome://browser/content/migration/migration-wizard-constants.mjs"
);
add_setup(async function () {
Services.prefs.setBoolPref("signon.management.page.fileImport.enabled", true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("signon.management.page.fileImport.enabled");
});
});
/**
* Tests that the PasswordFileMigrator properly subclasses FileMigratorBase
* and delegates to the LoginCSVImport module.

View File

@ -90,7 +90,6 @@ login-intro-description2 = All passwords you save to { -brand-product-name } are
login-intro-instructions-fxa2 = Create or sign in to your account on the device where your logins are saved.
login-intro-instructions-fxa-settings = Go to Settings > Sync > Turn on syncing… Select the Logins and passwords checkbox.
login-intro-instructions-fxa-passwords-help = Visit <a data-l10n-name="passwords-help-link">passwords support</a> for more help.
about-logins-intro-browser-only-import = If your logins are saved in another browser, you can <a data-l10n-name="import-link">import them into { -brand-product-name }</a>
about-logins-intro-import3 = Select the plus sign button above to add a password now. You can also <a data-l10n-name="import-browser-link">import passwords from another browser</a> or <a data-l10n-name="import-file-link">from a file</a>.
## Login

View File

@ -1398,18 +1398,6 @@ password-autocomplete:
type: boolean
description: Enable direct migration?
cm-csv-import:
description: Importing logins from CSV files
owner: issozi@mozilla.com
hasExposure: false
variables:
csvImport:
type: boolean
description: Can show CSV Import in about:logins or Migration Wizard
setPref:
branch: default
pref: "signon.management.page.fileImport.enabled"
# This feature flag mirrors the one used for ios
# https://github.com/mozilla-mobile/firefox-ios/blob/main/nimbus-features/addressAutofillFeature.yaml
address-autofill-feature: