From c731f5f4e4516dc0e17c50fa967069393249c831 Mon Sep 17 00:00:00 2001 From: Magnus Melin Date: Fri, 19 Apr 2024 17:37:03 +0200 Subject: [PATCH] Bug 1891742 - Try to fix intermittent comm/mail/test/browser/composition/browser_quoteMessage.js failure. r=freaktechnik The logs show complaint about null gMsgCompose. Also make some tests work with verify. Differential Revision: https://phabricator.services.mozilla.com/D207772 --HG-- extra : amend_source : 1406206c7972d55f7bcdd37a88663ca0f1bb43f0 --- mail/components/compose/content/MsgComposeCommands.js | 2 +- mail/test/browser/composition/browser_forwardUTF8.js | 1 + mail/test/browser/composition/browser_quoteMessage.js | 1 + .../test/browser/shared-modules/FolderDisplayHelpers.sys.mjs | 5 ++--- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mail/components/compose/content/MsgComposeCommands.js b/mail/components/compose/content/MsgComposeCommands.js index 40b12c4bfc..f041fc0c15 100644 --- a/mail/components/compose/content/MsgComposeCommands.js +++ b/mail/components/compose/content/MsgComposeCommands.js @@ -7450,7 +7450,7 @@ async function ComposeChangeLanguage(languages) { if (gSpellCheckingEnabled && checker?.spellCheckPending) { await new Promise(resolve => { Services.obs.addObserver(function observe(subject, topic) { - if (subject == gMsgCompose.editor) { + if (!gMsgCompose || subject == gMsgCompose.editor) { Services.obs.removeObserver(observe, topic); resolve(); } diff --git a/mail/test/browser/composition/browser_forwardUTF8.js b/mail/test/browser/composition/browser_forwardUTF8.js index 33f9de7416..4a5a1ce659 100644 --- a/mail/test/browser/composition/browser_forwardUTF8.js +++ b/mail/test/browser/composition/browser_forwardUTF8.js @@ -32,6 +32,7 @@ var folderToSendFrom; add_setup(async function () { requestLongerTimeout(2); folderToSendFrom = await create_folder("FolderWithUTF8"); + registerCleanupFunction(() => folderToSendFrom.deleteSelf(null)); }); function check_content(window) { diff --git a/mail/test/browser/composition/browser_quoteMessage.js b/mail/test/browser/composition/browser_quoteMessage.js index d0f1803899..af2a84eebb 100644 --- a/mail/test/browser/composition/browser_quoteMessage.js +++ b/mail/test/browser/composition/browser_quoteMessage.js @@ -28,6 +28,7 @@ var folderToStoreMessages; add_setup(async function () { folderToStoreMessages = await create_folder("QuoteTestFolder"); + registerCleanupFunction(() => folderToStoreMessages.deleteSelf(null)); }); add_task(async function test_quoteMessage() { diff --git a/mail/test/browser/shared-modules/FolderDisplayHelpers.sys.mjs b/mail/test/browser/shared-modules/FolderDisplayHelpers.sys.mjs index 0b236ae7a5..a0e55930c5 100644 --- a/mail/test/browser/shared-modules/FolderDisplayHelpers.sys.mjs +++ b/mail/test/browser/shared-modules/FolderDisplayHelpers.sys.mjs @@ -715,9 +715,8 @@ export async function click_tree_row(aTree, aRowIndex) { async function _get_row_at_index(aViewIndex) { const win = get_about_3pane(); const tree = win.document.getElementById("threadTree"); - Assert.greater( - tree.view.rowCount, - aViewIndex, + await TestUtils.waitForCondition( + () => aViewIndex < tree.view.rowCount, `index ${aViewIndex} must exist to be clicked on` ); tree.scrollToIndex(aViewIndex, true);