Backed out changeset 75215e4ff218 (bug 1896597) for causing mochitests failures.

This commit is contained in:
Stanca Serban
2024-06-08 04:24:47 +03:00
parent 09251075f4
commit ae9f298177
8 changed files with 2 additions and 99 deletions

View File

@@ -33,7 +33,6 @@ export const EmbeddedMigrationWizard = ({ handleAction, content }) => {
}, []); // eslint-disable-line react-hooks/exhaustive-deps
return (
<migration-wizard
in-aboutwelcome-bundle=""
force-show-import-all={options?.force_show_import_all || "false"}
auto-request-state=""
ref={ref}

View File

@@ -2138,7 +2138,6 @@ const EmbeddedMigrationWizard = ({
};
}, []); // eslint-disable-line react-hooks/exhaustive-deps
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("migration-wizard", {
"in-aboutwelcome-bundle": "",
"force-show-import-all": options?.force_show_import_all || "false",
"auto-request-state": "",
ref: ref,

View File

@@ -156,7 +156,6 @@ class MigrationUtils {
"MigrationWizard:OpenAboutAddons": { wantUntrusted: true },
"MigrationWizard:PermissionsNeeded": { wantUntrusted: true },
"MigrationWizard:GetPermissions": { wantUntrusted: true },
"MigrationWizard:OpenURL": { wantUntrusted: true },
},
},

View File

@@ -162,14 +162,6 @@ export class MigrationWizardChild extends JSWindowActorChild {
}
break;
}
case "MigrationWizard:OpenURL": {
this.sendAsyncMessage("OpenURL", {
url: event.detail.url,
where: event.detail.where,
});
break;
}
}
}

View File

@@ -172,12 +172,6 @@ export class MigrationWizardParent extends JSWindowActorParent {
let migrator = await MigrationUtils.getMigrator(message.data.key);
return migrator.getPermissions(this.browsingContext.topChromeWindow);
}
case "OpenURL": {
let browser = this.browsingContext.topChromeWindow;
this.#openURL(browser, message.data.url, message.data.where);
break;
}
}
return null;
@@ -845,30 +839,4 @@ export class MigrationWizardParent extends JSWindowActorParent {
let window = browser.ownerGlobal;
window.openTrustedLinkIn("about:addons", "tab", { inBackground: true });
}
/**
* Opens a url in a new background tab in the same window
* as the passed browser.
*
* @param {Element} browser
* The browser element requesting that the URL opens in.
* @param {Element} url
* The URL that will be opened.
* @param {Element} where
* Where the URL will be opened. Defaults to current tab.
*/
#openURL(browser, url, where) {
let window = browser.ownerGlobal;
window.openLinkIn(
Services.urlFormatter.formatURL(url),
where || "current",
{
private: false,
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal(
{}
),
csp: null,
}
);
}
}

View File

@@ -31,7 +31,6 @@ export class MigrationWizard extends HTMLElement {
#resourceSummary = null;
#expandedDetails = false;
#extensionsSuccessLink = null;
#supportTextLinks = null;
static get markup() {
return `
@@ -360,11 +359,6 @@ export class MigrationWizard extends HTMLElement {
);
this.#extensionsSuccessLink.addEventListener("click", this);
this.#supportTextLinks = shadow.querySelectorAll(".support-text");
this.#supportTextLinks.forEach(link =>
link.addEventListener("click", this)
);
this.#shadowRoot = shadow;
}
@@ -1472,23 +1466,6 @@ export class MigrationWizard extends HTMLElement {
})
);
event.preventDefault();
} else if (
[...this.#supportTextLinks].includes(event.target) &&
this.hasAttribute("in-aboutwelcome-bundle")
) {
// When we're running in the context of a spotlight
// the click events for standard anchors are being gobbled up by spotlight,
// so we're also firing a custom event to handle those clicks when in that context
this.dispatchEvent(
new CustomEvent("MigrationWizard:OpenURL", {
bubbles: true,
detail: {
url: event.target.href,
where: "tabshifted",
},
})
);
event.preventDefault();
} else if (event.target == this.#getPermissionsButton) {
this.#getPermissions();
}

View File

@@ -49,8 +49,6 @@ Notably, the ``MigrationWizard`` does not contain any internal logic or privileg
If the ``MigrationWizard`` is embedded in a dialog, it should have the ``dialog-mode`` attribute set on it so that dialog-appropriate buttons and styles are applied.
If the ``MigrationWizard`` is used in a messaging system surface that uses the same underlying component as ``about:welcome`` such as the Spotlight modal or Feature Callout, it should have the ``is-aboutwelcome-bundle`` attribute set so that anchor click events are appropriately captured and handled.
``MigrationWizardConstants``
============================

View File

@@ -60,11 +60,8 @@ async function assertExtensionsProgressState(wizard, state, description) {
} else if (state == MigrationWizardConstants.PROGRESS_VALUE.WARNING) {
Assert.stringMatches(progressIcon.getAttribute("state"), "warning");
Assert.stringMatches(messageText.textContent, description.message);
await assertSupportLink(
supportLink,
description.linkURL,
description.linkText
);
Assert.stringMatches(supportLink.textContent, description.linkText);
Assert.stringMatches(supportLink.href, description.linkURL);
await assertSuccessLink(extensionsSuccessLink, "");
} else if (state == MigrationWizardConstants.PROGRESS_VALUE.INFO) {
Assert.stringMatches(progressIcon.getAttribute("state"), "info");
@@ -100,32 +97,6 @@ async function assertSuccessLink(link, message) {
}
}
/**
* Checks that support links have the correct text, correct url,
* and if they have both text and a URL, checks that clicking on the link
* opens a background tab with the desired URL.
*
* @param {Element} link
* The support link link element.
* @param {string} url
* The URL that is expected to be in the link. If the link is not
* expected to appear, this should be an emptry string.
* @param {string} message
* The expected string to appear in the link textContent. If the
* link is not expected to appear, this should be an empty string.
* @returns {Promise<undefined>}
*/
async function assertSupportLink(link, url, message) {
Assert.stringMatches(link.textContent, message);
Assert.stringMatches(link.href, url);
if (message && url) {
let linkOpened = BrowserTestUtils.waitForNewTab(gBrowser, link.href);
EventUtils.synthesizeMouseAtCenter(link, {}, link.ownerGlobal);
let tab = await linkOpened;
BrowserTestUtils.removeTab(tab);
}
}
/**
* Checks the case where no extensions were matched.
*/