diff --git a/mail/components/extensions/parent/ext-compose.js b/mail/components/extensions/parent/ext-compose.js index 30e4bfb84f..548696921c 100644 --- a/mail/components/extensions/parent/ext-compose.js +++ b/mail/components/extensions/parent/ext-compose.js @@ -675,6 +675,7 @@ async function setComposeDetails(composeWindow, details, extension) { )) { const recipientType = row.dataset.recipienttype.trim().toLowerCase(); if (customHeaders.has(recipientType)) { + row.classList.remove("hidden"); row.querySelector(".address-row-input").value = customHeaders.get(recipientType); } diff --git a/mail/components/extensions/test/browser/browser_ext_compose_details_headers.js b/mail/components/extensions/test/browser/browser_ext_compose_details_headers.js index f7124a6a01..079a2b5bc2 100644 --- a/mail/components/extensions/test/browser/browser_ext_compose_details_headers.js +++ b/mail/components/extensions/test/browser/browser_ext_compose_details_headers.js @@ -656,6 +656,11 @@ add_task(async function testCustomHeaders() { let customHeaders = [{ name: "X-TEST1", value: "some header" }]; const tab = await browser.compose.beginNew(null, { customHeaders }); + // The initial window should not have the X-Expediteur row visible. + await window.sendMessage("Check X-Expediteur header display", { + isHidden: true, + }); + // Add a header which does not start with X- and should not be touched by // the API. await window.sendMessage("addTestHeader"); @@ -687,6 +692,11 @@ add_task(async function testCustomHeaders() { ]; await checkCustomHeaders(tab, expectedHeaders); + // The X-Expediteur row should now be visible. + await window.sendMessage("Check X-Expediteur header display", { + isHidden: false, + }); + // Update existing header and remove some of the others. Test support for // empty headers. customHeaders = [ @@ -764,6 +774,19 @@ add_task(async function testCustomHeaders() { extension.sendMessage(value); }); + extension.onMessage("Check X-Expediteur header display", expected => { + const composeWindow = Services.wm.getMostRecentWindow("msgcompose"); + const row = composeWindow.document.querySelector( + ".address-row-raw[data-recipienttype=X-Expediteur]" + ); + Assert.equal( + BrowserTestUtils.isHidden(row), + expected.isHidden, + "The display of the X-Expediteur header row should be correct" + ); + extension.sendMessage(); + }); + await extension.startup(); await extension.awaitFinish("finished"); await extension.unload();