Closed Bug 1676114 Opened 2 years ago Closed 8 months ago

convert relevant parts of messageInjection.js to MessageInjection.jsm

Categories

(Thunderbird :: Testing Infrastructure, task)

Tracking

(thunderbird_esr91 wontfix)

RESOLVED FIXED
96 Branch
Tracking Status
thunderbird_esr91 --- wontfix

People

(Reporter: mkmelin, Assigned: u695164)

References

Details

Attachments

(10 files, 2 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

https://searchfox.org/comm-central/rev/7c87b9f5a18f5b6df13e6d06cd7d7ce8bb173c5e/mailnews/test/resources/messageInjection.js

This should be hg copied over to a new file and converted over to a .jsm, for relevant parts.

https://searchfox.org/comm-central/rev/5e94c611d13ff79f35b34f91c13af7064a927d58/mailnews/test/resources/messageInjection.js#9-16

To expand on the above. Convert it to a .jsm which exposes needed function. I think the functions that get called by including the file should be called explicitly in the caller.

Assignee: nobody → nicolai
Status: NEW → ASSIGNED

Changed also importing in comm/mail/test/browser over comm/mail/test/browser/shared-modules/FolderDisplayHelpers.jsm.
MessageInjection is completely fowarded not subfunctions of it.
delete_message_set is renamed to MessageInjection.async_delete_messages

Try: https://treeherder.mozilla.org/jobs?repo=try-comm-central&revision=71a69699f754dc57529ed1d2fdc421451e359f7e

Attachment #9250349 - Attachment is obsolete: true

Im still unsure if i should get rid of asyncTestUtils.js through async/await/Promise stuff or using Internals to load a JS file like
load_via_src_path in a jsm file.

I'd prefer getting rid of asyncTestUtils in MessageInjection.jsm through async/await/Promise. Is it a long term goal to get rid of asyncTestUtils.js or do i oversee here something?

Flags: needinfo?(mkmelin+mozilla)

found Bug 1571683 - [meta] get rid of asyncTestUtils.js, so I'm going ahead for the async/await/Promise.

Sounds good!

Flags: needinfo?(mkmelin+mozilla)

Thanks for your advice to get in c-c.

I do have test failure after rebasing the patch on the latest c-c.
https://searchfox.org/comm-central/rev/24389a8c5ecf3e4b3bf30af9c51a6c09a936ca63/mailnews/imap/test/unit/test_offlineStoreLocking.js#99

FAIL compactOneFolder - [compactOneFolder : 99] false == 128

I'm still trying to figure out if its caused by this patch.

The compactOneFolder is not caused by this patch, it seems safe to apply.

There are about 100 tests who are using generators for async execution.
Before introducing MessageInjection.jsm I'd like to mark messageInjection.js as deprecated.
This should make it easier to replace the future implementation of MessageInjection.jsm to get
rid of generators for async execution in all tests. Some tests might have more reasons than
messageInjection for using asyncTestUtils. In this case the deprecated marking could give a hint
that there is a async/await/Promise MessageInjection.

Using mozilla-central/toolkit/modules/Deprecated.jsm:warning causes the tests to fail.
Thats why I'm using the file name and object name to indicate that something is about to happen.

Target Milestone: --- → 96 Branch

Pushed by thunderbird@calypsoblue.org:
https://hg.mozilla.org/comm-central/rev/8055f233b878
Part 1: Using object MessageInjection for messageInjection.js functions. r=mkmelin

Backout (part 1). ESLint error will likely cascade to other broken tests.
https://hg.mozilla.org/comm-central/rev/bf53384895f3585e5b7b7b89fd0012f687797b93

Arghhh, thanks!

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/101751fa59a9
Part 1: Using object MessageInjection for messageInjection.js functions. r=mkmelin

SyntheticMessageSet is used in messageInjection. To convert messageInjection to a JSM this
dependency is converted to a JSM aswell.
With this change SyntheticMessageSet is invoked over the exported symbol MessageModifier as
MessageModifier.SyntheticMessageSet(...).

Try: https://treeherder.mozilla.org/jobs?repo=try-comm-central&revision=32cace963bad3ce9c92d5aa316798a7bb00f3dc0

Depends on D132686

Attachment #9253413 - Attachment is obsolete: true
Attachment #9253837 - Attachment description: Bug 1676114 - Part 3: Convert messageModifier.js to MessageModifier.jsm. r=mkmelin → Bug 1676114 - Part 2: Copy contents of messageModifier.js into MessageGenerator.jsm. r=mkmelin
Attachment #9253838 - Attachment description: WIP: Bug 1676114 - Part 4: Introduce MessageInjection.jsm without using asyncTestUtils. r=mkmelin → WIP: Bug 1676114 - Part 3: Introduce MessageInjection.jsm without using asyncTestUtils. r=mkmelin

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/9c12b7973aa3
Part 2: Copy contents of messageModifier.js into MessageGenerator.jsm. r=mkmelin

Attachment #9253838 - Attachment description: WIP: Bug 1676114 - Part 3: Introduce MessageInjection.jsm without using asyncTestUtils. r=mkmelin → Bug 1676114 - Part 3: Introduce MessageInjection.jsm without using asyncTestUtils. r=mkmelin

With Part 4 there should be 59 cases left with messageInjection.js usage.

mail/base/test/unit/test_emptyTrash_dbViewWrapper.js
mail/base/test/unit/test_viewWrapper_imapFolder.js
mail/base/test/unit/test_viewWrapper_logic.js
mail/base/test/unit/test_viewWrapper_realFolder.js
mail/base/test/unit/test_viewWrapper_virtualFolder.js
mail/base/test/unit/test_viewWrapper_virtualFolderCustomTerm.js
mail/base/test/unit/resources/viewWrapperTestUtils.js
mailnews/base/test/unit/test_junkingWhenDisabled.js
mailnews/base/test/unit/test_nsIFolderListener.js
mailnews/base/test/unit/test_nsMsgDBView_headerValues.js
mailnews/base/test/unit/test_nsMsgDBView.js
mailnews/base/test/unit/test_retention.js
mailnews/base/test/unit/test_viewSortByAddresses.js
mailnews/db/gloda/test/unit/base_gloda_content.js
mailnews/db/gloda/test/unit/base_index_junk.js
mailnews/db/gloda/test/unit/base_index_messages.js
mailnews/db/gloda/test/unit/base_query_messages.js
mailnews/db/gloda/test/unit/test_cleanup_msf_databases.js
mailnews/db/gloda/test/unit/test_folder_logic.js
mailnews/db/gloda/test/unit/test_fts3_tokenizer.js
mailnews/db/gloda/test/unit/test_gloda_content_imap_offline.js
mailnews/db/gloda/test/unit/test_gloda_content_local.js
mailnews/db/gloda/test/unit/test_index_addressbook.js
mailnews/db/gloda/test/unit/test_index_bad_messages.js
mailnews/db/gloda/test/unit/test_index_compaction.js
mailnews/db/gloda/test/unit/test_index_junk_imap_offline.js
mailnews/db/gloda/test/unit/test_index_junk_imap_online.js
mailnews/db/gloda/test/unit/test_index_junk_local.js
mailnews/db/gloda/test/unit/test_index_messages_imap_offline.js
mailnews/db/gloda/test/unit/test_index_messages_imap_online_to_offline.js
mailnews/db/gloda/test/unit/test_index_messages_imap_online.js
mailnews/db/gloda/test/unit/test_index_messages_local.js
mailnews/db/gloda/test/unit/test_index_sweep_folder.js
mailnews/db/gloda/test/unit/test_intl.js
mailnews/db/gloda/test/unit/test_migration.js
mailnews/db/gloda/test/unit/test_mime_attachments_size.js
mailnews/db/gloda/test/unit/test_mime_emitter.js
mailnews/db/gloda/test/unit/test_msg_search.js
mailnews/db/gloda/test/unit/test_query_messages_imap_offline.js
mailnews/db/gloda/test/unit/test_query_messages_imap_online_to_offline.js
mailnews/db/gloda/test/unit/test_query_messages_imap_online.js
mailnews/db/gloda/test/unit/test_query_messages_local.js
mailnews/db/gloda/test/unit/test_smime_mimemsg_representation.js
mailnews/db/gloda/test/unit/test_startup_offline.js
mailnews/db/gloda/test/unit/resources/glodaTestHelper.js
mailnews/imap/test/unit/test_imapAutoSync.js
mailnews/imap/test/unit/test_imapHdrStreaming.js
mailnews/imap/test/unit/test_imapStoreMsgOffline.js
mailnews/local/test/unit/test_undoDelete.js
mailnews/mime/test/unit/test_alternate_p7m_handling.js
mailnews/mime/test/unit/test_attachment_size.js
mailnews/mime/test/unit/test_badContentType.js
mailnews/mime/test/unit/test_hidden_attachments.js
mailnews/mime/test/unit/test_message_attachment.js
mailnews/mime/test/unit/test_openpgp_decrypt.js
mailnews/mime/test/unit/test_rfc822_body.js
mailnews/mime/test/unit/test_smime_decrypt.js
mailnews/mime/test/unit/test_smime_perm_decrypt.js
mailnews/mime/test/unit/test_text_attachment.js

mailnews/db/gloda/test/unit/** will be shifted to MessageInjection.jsm as last one. It might be stuff for another bug filing.

Attachment #9255055 - Attachment description: WIP: Bug 1676114 - Part 4: Using MessageInjection.jsm in **/test/browser/**. r=mkmelin → Bug 1676114 - Part 4: Using MessageInjection.jsm in **/test/browser/**. r=mkmelin
Attachment #9255055 - Attachment description: Bug 1676114 - Part 4: Using MessageInjection.jsm in **/test/browser/**. r=mkmelin → Bug 1676114 - Part 4: Getting rid of `asyncTestUtils.js` in FolderDisplayHelpers.jsm by using MessageInjection.jsm. r=mkmelin

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/7782a9bd2022
Part 3: Introduce MessageInjection.jsm without using asyncTestUtils. r=mkmelin
https://hg.mozilla.org/comm-central/rev/b7c7e8c081aa
Part 4: Getting rid of asyncTestUtils.js in FolderDisplayHelpers.jsm by using MessageInjection.jsm. r=mkmelin

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/3480eae44be8
Part 5: Using MessageInjection.jsm in mailnews/base/test/unit/**. r=mkmelin

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/8ad01f03ecec
Part 6: Using MessageInjection.jsm in comm/mailnews/local/test/unit/test_undoDelete.js. r=mkmelin

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/73a117e64bda
Part 7: Using MessageInjection.jsm in mailnews/mime/test/unit/**. r=mkmelin

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/36a970cd7ba9
follow-up fix "info not defined". rs=me DONTBUILD

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/60248cc0235b
Part 8: MessageInjection.jsm different approach to explain the usage of MessageGenerator and delete makeFolderWithSets. r=mkmelin
https://hg.mozilla.org/comm-central/rev/eb657663cbe5
Part 9: Using MessageInjection.jsm in mail/base/test/unit/**. r=mkmelin

Depends on D141383

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/b610528b2a10
Part 10: Remove messageInjection.js. r=mkmelin
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Keywords: leave-open
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.