summaryrefslogtreecommitdiffstats
path: root/browser/components/migration/content
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /browser/components/migration/content
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/migration/content')
-rw-r--r--browser/components/migration/content/migration-wizard.mjs206
1 files changed, 111 insertions, 95 deletions
diff --git a/browser/components/migration/content/migration-wizard.mjs b/browser/components/migration/content/migration-wizard.mjs
index 89872a1558..9d58fbe95f 100644
--- a/browser/components/migration/content/migration-wizard.mjs
+++ b/browser/components/migration/content/migration-wizard.mjs
@@ -333,6 +333,7 @@ export class MigrationWizard extends HTMLElement {
this.#getPermissionsButton.addEventListener("click", this);
this.#browserProfileSelector.addEventListener("click", this);
+ this.#browserProfileSelector.addEventListener("mousedown", this);
this.#resourceTypeList = shadow.querySelector("#resource-type-list");
this.#resourceTypeList.addEventListener("change", this);
@@ -1396,107 +1397,122 @@ export class MigrationWizard extends HTMLElement {
}
}
+ #handleClickEvent(event) {
+ if (
+ event.target == this.#importButton ||
+ event.target == this.#importFromFileButton
+ ) {
+ this.#doImport();
+ } else if (
+ event.target.classList.contains("cancel-close") ||
+ event.target.classList.contains("finish-button")
+ ) {
+ this.dispatchEvent(
+ new CustomEvent("MigrationWizard:Close", { bubbles: true })
+ );
+ } else if (
+ event.currentTarget == this.#browserProfileSelectorList &&
+ event.target != this.#browserProfileSelectorList
+ ) {
+ this.#onBrowserProfileSelectionChanged(event.target);
+ // If the user selected a file migration type from the selector, we'll
+ // help the user out by immediately starting the file migration flow,
+ // rather than waiting for them to click the "Select File".
+ if (
+ event.target.getAttribute("type") ==
+ MigrationWizardConstants.MIGRATOR_TYPES.FILE
+ ) {
+ this.#doImport();
+ }
+ } else if (event.target == this.#safariPermissionButton) {
+ this.#requestSafariPermissions();
+ } else if (event.currentTarget == this.#resourceSummary) {
+ this.#expandedDetails = true;
+ } else if (event.target == this.#chooseImportFromFile) {
+ this.dispatchEvent(
+ new CustomEvent("MigrationWizard:RequestState", {
+ bubbles: true,
+ detail: {
+ allowOnlyFileMigrators: true,
+ },
+ })
+ );
+ } else if (event.target == this.#safariPasswordImportSkipButton) {
+ // If the user chose to skip importing passwords from Safari, we
+ // programmatically uncheck the PASSWORDS resource type and re-request
+ // import.
+ let checkbox = this.#shadowRoot.querySelector(
+ `label[data-resource-type="${MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.PASSWORDS}"]`
+ ).control;
+ checkbox.checked = false;
+
+ // If there are no other checked checkboxes, go back to the selection
+ // screen.
+ let checked = this.#shadowRoot.querySelectorAll(
+ `label[data-resource-type] > input:checked`
+ ).length;
+
+ if (!checked) {
+ this.requestState();
+ } else {
+ this.#doImport();
+ }
+ } else if (event.target == this.#safariPasswordImportSelectButton) {
+ this.#selectSafariPasswordFile();
+ } else if (event.target == this.#extensionsSuccessLink) {
+ this.dispatchEvent(
+ new CustomEvent("MigrationWizard:OpenAboutAddons", {
+ bubbles: true,
+ })
+ );
+ event.preventDefault();
+ } else if (event.target == this.#getPermissionsButton) {
+ this.#getPermissions();
+ }
+ }
+
+ #handleChangeEvent(event) {
+ if (event.target == this.#browserProfileSelector) {
+ this.#onBrowserProfileSelectionChanged();
+ } else if (event.target == this.#selectAllCheckbox) {
+ let checkboxes = this.#shadowRoot.querySelectorAll(
+ 'label[data-resource-type]:not([hidden]) > input[type="checkbox"]'
+ );
+ for (let checkbox of checkboxes) {
+ checkbox.checked = this.#selectAllCheckbox.checked;
+ }
+ this.#displaySelectedResources();
+ } else {
+ let checkboxes = this.#shadowRoot.querySelectorAll(
+ 'label[data-resource-type]:not([hidden]) > input[type="checkbox"]'
+ );
+
+ let allVisibleChecked = Array.from(checkboxes).every(checkbox => {
+ return checkbox.checked;
+ });
+
+ this.#selectAllCheckbox.checked = allVisibleChecked;
+ this.#displaySelectedResources();
+ }
+ }
+
handleEvent(event) {
+ if (
+ event.target == this.#browserProfileSelector &&
+ (event.type == "mousedown" ||
+ (event.type == "click" &&
+ event.mozInputSource == MouseEvent.MOZ_SOURCE_KEYBOARD))
+ ) {
+ this.#browserProfileSelectorList.toggle(event);
+ return;
+ }
switch (event.type) {
case "click": {
- if (
- event.target == this.#importButton ||
- event.target == this.#importFromFileButton
- ) {
- this.#doImport();
- } else if (
- event.target.classList.contains("cancel-close") ||
- event.target.classList.contains("finish-button")
- ) {
- this.dispatchEvent(
- new CustomEvent("MigrationWizard:Close", { bubbles: true })
- );
- } else if (event.target == this.#browserProfileSelector) {
- this.#browserProfileSelectorList.show(event);
- } else if (
- event.currentTarget == this.#browserProfileSelectorList &&
- event.target != this.#browserProfileSelectorList
- ) {
- this.#onBrowserProfileSelectionChanged(event.target);
- // If the user selected a file migration type from the selector, we'll
- // help the user out by immediately starting the file migration flow,
- // rather than waiting for them to click the "Select File".
- if (
- event.target.getAttribute("type") ==
- MigrationWizardConstants.MIGRATOR_TYPES.FILE
- ) {
- this.#doImport();
- }
- } else if (event.target == this.#safariPermissionButton) {
- this.#requestSafariPermissions();
- } else if (event.currentTarget == this.#resourceSummary) {
- this.#expandedDetails = true;
- } else if (event.target == this.#chooseImportFromFile) {
- this.dispatchEvent(
- new CustomEvent("MigrationWizard:RequestState", {
- bubbles: true,
- detail: {
- allowOnlyFileMigrators: true,
- },
- })
- );
- } else if (event.target == this.#safariPasswordImportSkipButton) {
- // If the user chose to skip importing passwords from Safari, we
- // programmatically uncheck the PASSWORDS resource type and re-request
- // import.
- let checkbox = this.#shadowRoot.querySelector(
- `label[data-resource-type="${MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.PASSWORDS}"]`
- ).control;
- checkbox.checked = false;
-
- // If there are no other checked checkboxes, go back to the selection
- // screen.
- let checked = this.#shadowRoot.querySelectorAll(
- `label[data-resource-type] > input:checked`
- ).length;
-
- if (!checked) {
- this.requestState();
- } else {
- this.#doImport();
- }
- } else if (event.target == this.#safariPasswordImportSelectButton) {
- this.#selectSafariPasswordFile();
- } else if (event.target == this.#extensionsSuccessLink) {
- this.dispatchEvent(
- new CustomEvent("MigrationWizard:OpenAboutAddons", {
- bubbles: true,
- })
- );
- event.preventDefault();
- } else if (event.target == this.#getPermissionsButton) {
- this.#getPermissions();
- }
+ this.#handleClickEvent(event);
break;
}
case "change": {
- if (event.target == this.#browserProfileSelector) {
- this.#onBrowserProfileSelectionChanged();
- } else if (event.target == this.#selectAllCheckbox) {
- let checkboxes = this.#shadowRoot.querySelectorAll(
- 'label[data-resource-type]:not([hidden]) > input[type="checkbox"]'
- );
- for (let checkbox of checkboxes) {
- checkbox.checked = this.#selectAllCheckbox.checked;
- }
- this.#displaySelectedResources();
- } else {
- let checkboxes = this.#shadowRoot.querySelectorAll(
- 'label[data-resource-type]:not([hidden]) > input[type="checkbox"]'
- );
-
- let allVisibleChecked = Array.from(checkboxes).every(checkbox => {
- return checkbox.checked;
- });
-
- this.#selectAllCheckbox.checked = allVisibleChecked;
- this.#displaySelectedResources();
- }
+ this.#handleChangeEvent(event);
break;
}
}