Bug 1801981 - Use the word "favorites" instead of "bookmarks" when importing from IE / Edge. r=niklas,fluent-reviewers,flod

Differential Revision: https://phabricator.services.mozilla.com/D173567
This commit is contained in:
Mike Conley 2023-03-29 17:58:22 +00:00
Родитель aaa5bcc9d5
Коммит 180bc050d1
12 изменённых файлов: 494 добавлений и 171 удалений

Просмотреть файл

@ -119,10 +119,10 @@ export class MigrationWizardChild extends JSWindowActorChild {
*/
receiveMessage(message) {
if (message.name == "UpdateProgress") {
let progress = message.data;
this.setComponentState({
page: MigrationWizardConstants.PAGES.PROGRESS,
progress,
progress: message.data.progress,
key: message.data.key,
});
}
}

Просмотреть файл

@ -133,7 +133,7 @@ export class MigrationWizardParent extends JSWindowActorParent {
}
}
this.sendAsyncMessage("UpdateProgress", progress);
this.sendAsyncMessage("UpdateProgress", { key: migratorKey, progress });
try {
await migrator.migrate(
@ -165,10 +165,14 @@ export class MigrationWizardParent extends JSWindowActorParent {
progress[foundResourceTypeName] = {
inProgress: false,
message: await this.#getStringForImportQuantity(
migratorKey,
foundResourceTypeName
),
};
this.sendAsyncMessage("UpdateProgress", progress);
this.sendAsyncMessage("UpdateProgress", {
key: migratorKey,
progress,
});
}
}
);
@ -294,22 +298,29 @@ export class MigrationWizardParent extends JSWindowActorParent {
* Returns the "success" string for a particular resource type after
* migration has completed.
*
* @param {string} migratorKey
* The key for the migrator being used.
* @param {string} resourceTypeStr
* A string mapping to one of the key values of
* MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.
* @returns {Promise<string>}
* The success string for the resource type after migration has completed.
*/
#getStringForImportQuantity(resourceTypeStr) {
#getStringForImportQuantity(migratorKey, resourceTypeStr) {
switch (resourceTypeStr) {
case lazy.MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.BOOKMARKS: {
let quantity = MigrationUtils.getImportedCount("bookmarks");
return lazy.gFluentStrings.formatValue(
"migration-wizard-progress-success-bookmarks",
{
quantity,
}
);
let stringID = "migration-wizard-progress-success-bookmarks";
if (
lazy.MigrationWizardConstants.USES_FAVORITES.includes(migratorKey)
) {
stringID = "migration-wizard-progress-success-favorites";
}
return lazy.gFluentStrings.formatValue(stringID, {
quantity,
});
}
case lazy.MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.HISTORY: {
return lazy.gFluentStrings.formatValue(

Просмотреть файл

@ -46,4 +46,15 @@ export const MigrationWizardConstants = Object.freeze({
// We don't yet show OTHERDATA or SESSION resources.
}),
/**
* The set of keys that maps to migrators that use the term "favorites"
* in the place of "bookmarks". This tends to be browsers from Microsoft.
*/
USES_FAVORITES: Object.freeze([
"chromium-edge",
"chromium-edge-beta",
"edge",
"ie",
]),
});

Просмотреть файл

@ -64,7 +64,7 @@ export class MigrationWizard extends HTMLElement {
<input type="checkbox" class="select-all-checkbox"/><span data-l10n-id="migration-select-all-option-label"></span>
</label>
<label id="bookmarks" data-resource-type="BOOKMARKS"/>
<input type="checkbox"/><span data-l10n-id="migration-bookmarks-option-label"></span>
<input type="checkbox"/><span default-data-l10n-id="migration-bookmarks-option-label" ie-edge-data-l10n-id="migration-favorites-option-label"></span>
</label>
<label id="logins-and-passwords" data-resource-type="PASSWORDS">
<input type="checkbox"/><span data-l10n-id="migration-logins-and-passwords-option-label"></span>
@ -89,7 +89,7 @@ export class MigrationWizard extends HTMLElement {
<div class="resource-progress">
<div data-resource-type="BOOKMARKS" class="resource-progress-group">
<span class="progress-icon-parent"><span class="progress-icon" role="img"></span></span>
<span data-l10n-id="migration-bookmarks-option-label"></span>
<span default-data-l10n-id="migration-bookmarks-option-label" ie-edge-data-l10n-id="migration-favorites-option-label"></span>
<span class="success-text deemphasized-text">&nbsp;</span>
</div>
@ -324,6 +324,7 @@ export class MigrationWizard extends HTMLElement {
).style.content = "url(chrome://global/skin/icons/defaultFavicon.svg)";
}
let key = panelItem.getAttribute("key");
let resourceTypes = panelItem.resourceTypes;
for (let child of this.#resourceTypeList.children) {
child.hidden = true;
@ -337,6 +338,23 @@ export class MigrationWizard extends HTMLElement {
if (resourceLabel) {
resourceLabel.hidden = false;
resourceLabel.control.checked = true;
let labelSpan = resourceLabel.querySelector(
"span[default-data-l10n-id]"
);
if (labelSpan) {
if (MigrationWizardConstants.USES_FAVORITES.includes(key)) {
document.l10n.setAttributes(
labelSpan,
labelSpan.getAttribute("ie-edge-data-l10n-id")
);
} else {
document.l10n.setAttributes(
labelSpan,
labelSpan.getAttribute("default-data-l10n-id")
);
}
}
}
}
let selectAll = this.#shadowRoot.querySelector("#select-all").control;
@ -434,6 +452,8 @@ export class MigrationWizard extends HTMLElement {
* @param {object} state
* The state object passed into setState. The following properties are
* used:
* @param {string} state.key
* The key of the migrator being used.
* @param {Object<string, ProgressState>} state.progress
* An object whose keys match one of DISPLAYED_RESOURCE_TYPES.
*
@ -458,6 +478,21 @@ export class MigrationWizard extends HTMLElement {
let progressIcon = group.querySelector(".progress-icon");
let successText = group.querySelector(".success-text");
let labelSpan = group.querySelector("span[default-data-l10n-id]");
if (labelSpan) {
if (MigrationWizardConstants.USES_FAVORITES.includes(state.key)) {
document.l10n.setAttributes(
labelSpan,
labelSpan.getAttribute("ie-edge-data-l10n-id")
);
} else {
document.l10n.setAttributes(
labelSpan,
labelSpan.getAttribute("default-data-l10n-id")
);
}
}
if (state.progress[resourceType].inProgress) {
document.l10n.setAttributes(
progressIcon,
@ -599,13 +634,15 @@ export class MigrationWizard extends HTMLElement {
let resourceTypeLabels = this.#resourceTypeList.querySelectorAll(
"label:not([hidden])[data-resource-type]"
);
let panelItem = this.#browserProfileSelector.selectedPanelItem;
let key = panelItem.getAttribute("key");
let totalResources = resourceTypeLabels.length;
let checkedResources = 0;
let selectedData = this.#shadowRoot.querySelector(".selected-data");
let selectedDataArray = [];
const RESOURCE_TYPE_TO_LABEL_IDS = {
let resourceTypeToLabelIDs = {
[MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.BOOKMARKS]:
"migration-list-bookmark-label",
[MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.PASSWORDS]:
@ -616,8 +653,14 @@ export class MigrationWizard extends HTMLElement {
"migration-list-autofill-label",
};
let resourceTypes = Object.keys(RESOURCE_TYPE_TO_LABEL_IDS);
let labelIds = Object.values(RESOURCE_TYPE_TO_LABEL_IDS).map(id => {
if (MigrationWizardConstants.USES_FAVORITES.includes(key)) {
resourceTypeToLabelIDs[
MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.BOOKMARKS
] = "migration-list-favorites-label";
}
let resourceTypes = Object.keys(resourceTypeToLabelIDs);
let labelIds = Object.values(resourceTypeToLabelIDs).map(id => {
return { id };
});
let labels = await document.l10n.formatValues(labelIds);

Просмотреть файл

@ -9,6 +9,7 @@ prefs =
[browser_dialog_resize.js]
[browser_do_migration.js]
[browser_entrypoint_telemetry.js]
[browser_ie_edge_bookmarks_success_strings.js]
[browser_safari_permissions.js]
run-if =
os == "mac"

Просмотреть файл

@ -3,13 +3,6 @@
"use strict";
const { sinon } = ChromeUtils.importESModule(
"resource://testing-common/Sinon.sys.mjs"
);
const { InternalTestingProfileMigrator } = ChromeUtils.importESModule(
"resource:///modules/InternalTestingProfileMigrator.sys.mjs"
);
/**
* These are the resource types that currently display their import success
* message with a quantity.
@ -21,153 +14,6 @@ const RESOURCE_TYPES_WITH_QUANTITIES = [
MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.FORMDATA,
];
/**
* We'll have this be our magic number of quantities of various imports.
* We will use Sinon to prepare MigrationUtils to presume that this was
* how many of each quantity-supported resource type was imported.
*/
const EXPECTED_QUANTITY = 123;
/**
* A helper function that prepares the InternalTestingProfileMigrator
* with some set of fake available resources, and resolves a Promise
* when the InternalTestingProfileMigrator is used for a migration.
*
* @param {number[]} availableResourceTypes
* An array of resource types from MigrationUtils.resourcesTypes.
* A single MigrationResource will be created per type, with a
* no-op migrate function.
* @param {number[]} expectedResourceTypes
* An array of resource types from MigrationUtils.resourceTypes.
* These are the resource types that are expected to be passed
* to the InternalTestingProfileMigrator.migrate function.
* @param {object|string} expectedProfile
* The profile object or string that is expected to be passed
* to the InternalTestingProfileMigrator.migrate function.
* @returns {Promise<undefined>}
*/
async function waitForTestMigration(
availableResourceTypes,
expectedResourceTypes,
expectedProfile
) {
let sandbox = sinon.createSandbox();
// Fake out the getResources method of the migrator so that we return
// a single fake MigratorResource per availableResourceType.
sandbox
.stub(InternalTestingProfileMigrator.prototype, "getResources")
.callsFake(() => {
return Promise.resolve(
availableResourceTypes.map(resourceType => {
return {
type: resourceType,
migrate: () => {},
};
})
);
});
sandbox.stub(MigrationUtils, "_importQuantities").value({
bookmarks: EXPECTED_QUANTITY,
history: EXPECTED_QUANTITY,
logins: EXPECTED_QUANTITY,
});
// Fake out the migrate method of the migrator and assert that the
// next time it's called, its arguments match our expectations.
return new Promise(resolve => {
sandbox
.stub(InternalTestingProfileMigrator.prototype, "migrate")
.callsFake((aResourceTypes, aStartup, aProfile, aProgressCallback) => {
Assert.ok(
!aStartup,
"Migrator should not have been called as a startup migration."
);
let bitMask = 0;
for (let resourceType of expectedResourceTypes) {
bitMask |= resourceType;
}
Assert.deepEqual(
aResourceTypes,
bitMask,
"Got the expected resource types"
);
Assert.deepEqual(
aProfile,
expectedProfile,
"Got the expected profile object"
);
for (let resourceType of expectedResourceTypes) {
aProgressCallback(resourceType);
}
Services.obs.notifyObservers(null, "Migration:Ended");
resolve();
});
}).finally(async () => {
sandbox.restore();
// MigratorBase caches resources fetched by the getResources method
// as a performance optimization. In order to allow different tests
// to have different available resources, we call into a special
// method of InternalTestingProfileMigrator that clears that
// cache.
let migrator = await MigrationUtils.getMigrator(
InternalTestingProfileMigrator.key
);
migrator.flushResourceCache();
});
}
/**
* Takes a MigrationWizard element and chooses the
* InternalTestingProfileMigrator as the browser to migrate from. Then, it
* checks the checkboxes associated with the selectedResourceTypes and
* unchecks the rest before clicking the "Import" button.
*
* @param {Element} wizard
* The MigrationWizard element.
* @param {string[]} selectedResourceTypes
* An array of resource type strings from
* MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.
*/
async function selectResourceTypesAndStartMigration(
wizard,
selectedResourceTypes
) {
let shadow = wizard.openOrClosedShadowRoot;
// First, select the InternalTestingProfileMigrator browser.
let selector = shadow.querySelector("#browser-profile-selector");
selector.click();
await new Promise(resolve => {
wizard
.querySelector("panel-list")
.addEventListener("shown", resolve, { once: true });
});
let panelItem = wizard.querySelector(
`panel-item[key="${InternalTestingProfileMigrator.key}"]`
);
panelItem.click();
// And then check the right checkboxes for the resource types.
let resourceTypeList = shadow.querySelector("#resource-type-list");
for (let resourceType in MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES) {
let node = resourceTypeList.querySelector(
`label[data-resource-type="${resourceType}"]`
);
node.control.checked = selectedResourceTypes.includes(resourceType);
}
let importButton = shadow.querySelector("#import");
importButton.click();
}
/**
* Assert that the resource types passed in expectedResourceTypes are
* showing a success state after a migration, and if they are part of

Просмотреть файл

@ -0,0 +1,88 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Tests that the progress strings that the Migration Wizard shows
* during migrations for IE and Edge uses the term "Favorites" rather
* then "Bookmarks".
*/
add_task(async function test_ie_edge_bookmarks_success_strings() {
for (let key of ["ie", "edge", "internal-testing"]) {
let sandbox = sinon.createSandbox();
sandbox.stub(InternalTestingProfileMigrator, "key").get(() => {
return key;
});
sandbox.stub(MigrationUtils, "availableMigratorKeys").get(() => {
return key;
});
let testingMigrator = new InternalTestingProfileMigrator();
sandbox.stub(MigrationUtils, "getMigrator").callsFake(() => {
return Promise.resolve(testingMigrator);
});
let migration = waitForTestMigration(
[MigrationUtils.resourceTypes.BOOKMARKS],
[MigrationUtils.resourceTypes.BOOKMARKS],
null
);
await withMigrationWizardDialog(async prefsWin => {
let dialogBody = prefsWin.document.body;
let wizard = dialogBody.querySelector("migration-wizard");
let wizardDone = BrowserTestUtils.waitForEvent(
wizard,
"MigrationWizard:DoneMigration"
);
selectResourceTypesAndStartMigration(
wizard,
[MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.BOOKMARKS],
key
);
await migration;
let dialog = prefsWin.document.querySelector("#migrationWizardDialog");
let shadow = wizard.openOrClosedShadowRoot;
// If we were using IE or Edge (EdgeHTLM), then the success message should
// include the word "favorites". Otherwise, we expect it to include
// the word "bookmarks".
let bookmarksProgressGroup = shadow.querySelector(
`.resource-progress-group[data-resource-type="${MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.BOOKMARKS}"`
);
let successTextElement = bookmarksProgressGroup.querySelector(
".success-text"
);
await BrowserTestUtils.waitForCondition(() => {
return successTextElement.textContent.trim();
});
let successText = successTextElement.textContent.toLowerCase();
if (key == "internal-testing") {
Assert.ok(
successText.includes("bookmarks"),
`Success test should refer to bookmarks: ${successText}.`
);
} else {
Assert.ok(
successText.includes("favorites"),
`Success test should refer to favorites: ${successText}`
);
}
let doneButton = shadow.querySelector("#done-button");
let dialogClosed = BrowserTestUtils.waitForEvent(dialog, "close");
doneButton.click();
await dialogClosed;
await wizardDone;
});
sandbox.restore();
}
});

Просмотреть файл

@ -3,7 +3,6 @@
"use strict";
const { sinon } = ChromeUtils.import("resource://testing-common/Sinon.jsm");
const { SafariProfileMigrator } = ChromeUtils.importESModule(
"resource:///modules/SafariProfileMigrator.sys.mjs"
);

Просмотреть файл

@ -3,13 +3,26 @@
"use strict";
const { sinon } = ChromeUtils.importESModule(
"resource://testing-common/Sinon.sys.mjs"
);
const { MigrationWizardConstants } = ChromeUtils.importESModule(
"chrome://browser/content/migration/migration-wizard-constants.mjs"
);
const { InternalTestingProfileMigrator } = ChromeUtils.importESModule(
"resource:///modules/InternalTestingProfileMigrator.sys.mjs"
);
const DIALOG_URL =
"chrome://browser/content/migration/migration-dialog-window.html";
/**
* We'll have this be our magic number of quantities of various imports.
* We will use Sinon to prepare MigrationUtils to presume that this was
* how many of each quantity-supported resource type was imported.
*/
const EXPECTED_QUANTITY = 123;
/**
* The withMigrationWizardDialog callback, called after the
* dialog has loaded and the wizard is ready.
@ -79,3 +92,145 @@ async function waitForMigrationWizardDialogTab() {
return tab.linkedBrowser;
}
/**
* A helper function that prepares the InternalTestingProfileMigrator
* with some set of fake available resources, and resolves a Promise
* when the InternalTestingProfileMigrator is used for a migration.
*
* @param {number[]} availableResourceTypes
* An array of resource types from MigrationUtils.resourcesTypes.
* A single MigrationResource will be created per type, with a
* no-op migrate function.
* @param {number[]} expectedResourceTypes
* An array of resource types from MigrationUtils.resourceTypes.
* These are the resource types that are expected to be passed
* to the InternalTestingProfileMigrator.migrate function.
* @param {object|string} expectedProfile
* The profile object or string that is expected to be passed
* to the InternalTestingProfileMigrator.migrate function.
* @returns {Promise<undefined>}
*/
async function waitForTestMigration(
availableResourceTypes,
expectedResourceTypes,
expectedProfile
) {
let sandbox = sinon.createSandbox();
// Fake out the getResources method of the migrator so that we return
// a single fake MigratorResource per availableResourceType.
sandbox
.stub(InternalTestingProfileMigrator.prototype, "getResources")
.callsFake(() => {
return Promise.resolve(
availableResourceTypes.map(resourceType => {
return {
type: resourceType,
migrate: () => {},
};
})
);
});
sandbox.stub(MigrationUtils, "_importQuantities").value({
bookmarks: EXPECTED_QUANTITY,
history: EXPECTED_QUANTITY,
logins: EXPECTED_QUANTITY,
});
// Fake out the migrate method of the migrator and assert that the
// next time it's called, its arguments match our expectations.
return new Promise(resolve => {
sandbox
.stub(InternalTestingProfileMigrator.prototype, "migrate")
.callsFake((aResourceTypes, aStartup, aProfile, aProgressCallback) => {
Assert.ok(
!aStartup,
"Migrator should not have been called as a startup migration."
);
let bitMask = 0;
for (let resourceType of expectedResourceTypes) {
bitMask |= resourceType;
}
Assert.deepEqual(
aResourceTypes,
bitMask,
"Got the expected resource types"
);
Assert.deepEqual(
aProfile,
expectedProfile,
"Got the expected profile object"
);
for (let resourceType of expectedResourceTypes) {
aProgressCallback(resourceType);
}
Services.obs.notifyObservers(null, "Migration:Ended");
resolve();
});
}).finally(async () => {
sandbox.restore();
// MigratorBase caches resources fetched by the getResources method
// as a performance optimization. In order to allow different tests
// to have different available resources, we call into a special
// method of InternalTestingProfileMigrator that clears that
// cache.
let migrator = await MigrationUtils.getMigrator(
InternalTestingProfileMigrator.key
);
migrator.flushResourceCache();
});
}
/**
* Takes a MigrationWizard element and chooses the
* InternalTestingProfileMigrator as the browser to migrate from. Then, it
* checks the checkboxes associated with the selectedResourceTypes and
* unchecks the rest before clicking the "Import" button.
*
* @param {Element} wizard
* The MigrationWizard element.
* @param {string[]} selectedResourceTypes
* An array of resource type strings from
* MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.
* @param {string} [migratorKey=InternalTestingProfileMigrator.key]
* The key for the migrator to use. Defaults to the
* InternalTestingProfileMigrator.
*/
async function selectResourceTypesAndStartMigration(
wizard,
selectedResourceTypes,
migratorKey = InternalTestingProfileMigrator.key
) {
let shadow = wizard.openOrClosedShadowRoot;
// First, select the InternalTestingProfileMigrator browser.
let selector = shadow.querySelector("#browser-profile-selector");
selector.click();
await new Promise(resolve => {
wizard
.querySelector("panel-list")
.addEventListener("shown", resolve, { once: true });
});
let panelItem = wizard.querySelector(`panel-item[key="${migratorKey}"]`);
panelItem.click();
// And then check the right checkboxes for the resource types.
let resourceTypeList = shadow.querySelector("#resource-type-list");
for (let resourceType in MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES) {
let node = resourceTypeList.querySelector(
`label[data-resource-type="${resourceType}"]`
);
node.control.checked = selectedResourceTypes.includes(resourceType);
}
let importButton = shadow.querySelector("#import");
importButton.click();
}

Просмотреть файл

@ -425,6 +425,7 @@
const BOOKMARKS_SUCCESS_STRING = "Some bookmarks success string";
gWiz.setState({
page: MigrationWizardConstants.PAGES.PROGRESS,
key: "chrome",
progress: {
[MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.BOOKMARKS]: {
inProgress: false,
@ -516,6 +517,7 @@
const FORMDATA_SUCCESS_STRING = "Some formdata string";
gWiz.setState({
page: MigrationWizardConstants.PAGES.PROGRESS,
key: "chrome",
progress: {
[MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.BOOKMARKS]: {
inProgress: false,
@ -641,6 +643,142 @@
".cancel-close button should be hidden when not in dialog mode."
);
});
/**
* Internet Explorer and Edge refer to bookmarks as "favorites",
* and we change our labels to suit when either of those browsers are
* selected as the migration source. This test tests that behavior in the
* selection page.
*/
add_task(async function test_ie_edge_favorites_selection() {
gWiz.setState({
page: MigrationWizardConstants.PAGES.SELECTION,
migrators: MIGRATOR_PROFILE_INSTANCES,
showImportAll: false,
});
let bookmarksCheckboxLabel = gShadowRoot.querySelector("#bookmarks");
let span = bookmarksCheckboxLabel.querySelector("span[default-data-l10n-id]");
ok(span, "The bookmarks selection span has a default-data-l10n-id attribute");
is(
span.getAttribute("data-l10n-id"),
span.getAttribute("default-data-l10n-id"),
"Should be showing the default string for bookmarks"
);
// Now test when in Variant 2, for the string in the <summary>.
let selectedDataUpdated = BrowserTestUtils.waitForEvent(
gWiz,
"MigrationWizard:ResourcesUpdated"
);
gWiz.setState({
page: MigrationWizardConstants.PAGES.SELECTION,
migrators: MIGRATOR_PROFILE_INSTANCES,
showImportAll: true,
});
await selectedDataUpdated;
let summary = gShadowRoot.querySelector("summary");
ok(
summary.textContent.toLowerCase().includes("bookmarks"),
"Summary should include the string 'bookmarks'"
);
for (let key of MigrationWizardConstants.USES_FAVORITES) {
gWiz.setState({
page: MigrationWizardConstants.PAGES.SELECTION,
migrators: [{
key,
displayName: "Legacy Microsoft Browser",
resourceTypes: ["BOOKMARKS"],
profile: null,
}],
showImportAll: false,
});
is(
span.getAttribute("data-l10n-id"),
span.getAttribute("ie-edge-data-l10n-id"),
"Should be showing the IE/Edge string for bookmarks"
);
// Now test when in Variant 2, for the string in the <summary>.
selectedDataUpdated = BrowserTestUtils.waitForEvent(
gWiz,
"MigrationWizard:ResourcesUpdated"
);
gWiz.setState({
page: MigrationWizardConstants.PAGES.SELECTION,
migrators: [{
key,
displayName: "Legacy Microsoft Browser",
resourceTypes: ["BOOKMARKS"],
profile: null,
}],
showImportAll: true,
});
await selectedDataUpdated;
ok(
summary.textContent.toLowerCase().includes("favorites"),
"Summary should include the string 'favorites'"
);
}
});
/**
* Internet Explorer and Edge refer to bookmarks as "favorites",
* and we change our labels to suit when either of those browsers are
* selected as the migration source. This test tests that behavior in the
* progress page
*/
add_task(async function test_ie_edge_favorites_progress() {
gWiz.setState({
page: MigrationWizardConstants.PAGES.PROGRESS,
key: "chrome",
progress: {
[MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.BOOKMARKS]: {
inProgress: false,
message: "A string from the parent",
},
},
});
let bookmarksGroup = getResourceGroup(
MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.BOOKMARKS
);
let span = bookmarksGroup.querySelector("span[default-data-l10n-id]");
ok(span, "Should have found a span with default-data-l10n-id");
is(
span.getAttribute("data-l10n-id"),
span.getAttribute("default-data-l10n-id"),
"Should be using the default string."
);
for (let key of MigrationWizardConstants.USES_FAVORITES) {
gWiz.setState({
page: MigrationWizardConstants.PAGES.PROGRESS,
key,
progress: {
[MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.BOOKMARKS]: {
inProgress: false,
message: "A string from the parent",
},
},
});
is(
span.getAttribute("data-l10n-id"),
span.getAttribute("ie-edge-data-l10n-id"),
"Should be showing the IE/Edge string for bookmarks"
);
}
});
</script>
</head>
<body>

Просмотреть файл

@ -40,6 +40,12 @@ const FAKE_BROWSER_LIST = [
profile: null,
brandImage: "chrome://browser/content/migration/brands/ie.png",
},
{
key: "edge",
displayName: "Microsoft Edge Legacy",
resourceTypes: ["HISTORY", "FORMDATA", "PASSWORDS", "BOOKMARKS"],
profile: null,
},
{
key: "chromium-edge",
displayName: "Microsoft Edge",
@ -139,6 +145,7 @@ Progress.args = {
dialogMode: true,
state: {
page: MigrationWizardConstants.PAGES.PROGRESS,
key: "chrome",
progress: {
[MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.BOOKMARKS]: {
inProgress: true,
@ -161,6 +168,7 @@ PartialProgress.args = {
dialogMode: true,
state: {
page: MigrationWizardConstants.PAGES.PROGRESS,
key: "chrome",
progress: {
[MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.BOOKMARKS]: {
inProgress: true,
@ -185,6 +193,7 @@ Success.args = {
dialogMode: true,
state: {
page: MigrationWizardConstants.PAGES.PROGRESS,
key: "chrome",
progress: {
[MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.BOOKMARKS]: {
inProgress: false,

Просмотреть файл

@ -53,6 +53,11 @@ migration-selected-data-label = Import selected data
migration-select-all-option-label = Select all
migration-bookmarks-option-label = Bookmarks
# Favorites is used for Bookmarks when importing from Internet Explorer or
# Edge, as this is the terminology for bookmarks on those browsers.
migration-favorites-option-label = Favorites
migration-logins-and-passwords-option-label = Saved logins and passwords
migration-history-option-label = Browsing history
migration-form-autofill-option-label = Form autofill data
@ -69,6 +74,10 @@ migration-wizard-import-browser-no-browsers = { -brand-short-name } couldnt f
## For example, a possible list could be "Bookmarks, passwords and autofill data".
migration-list-bookmark-label = bookmarks
# “favorites” refers to bookmarks in Edge and Internet Explorer. Use the same terminology
# if the browser is available in your language.
migration-list-favorites-label = favorites
migration-list-password-label = passwords
migration-list-history-label = history
migration-list-autofill-label = autofill data
@ -103,6 +112,19 @@ migration-wizard-progress-success-bookmarks =
*[other] { $quantity } bookmarks
}
# Shown in the migration wizard after importing bookmarks from either
# Internet Explorer or Edge.
#
# Use the same terminology if the browser is available in your language.
#
# Variables:
# $quantity (Number): the number of successfully imported bookmarks
migration-wizard-progress-success-favorites =
{ $quantity ->
[one] { $quantity } favorite
*[other] { $quantity } favorites
}
# Shown in the migration wizard after importing passwords from another
# browser has completed.
#