Closed Bug 1859980 Opened 2 years ago Closed 2 years ago

Use createLocalSubfolder where possible in tests

Categories

(MailNews Core :: General, task)

Tracking

(thunderbird_esr115 unaffected)

RESOLVED FIXED
122 Branch
Tracking Status
thunderbird_esr115 --- unaffected

People

(Reporter: darktrojan, Assigned: darktrojan)

References

Details

Attachments

(1 file, 1 obsolete file)

We have a pattern, especially in tests, of

  1. getting an nsIMsgFolder
  2. QIing it to nsIMsgLocalMailFolder
  3. calling createLocalSubfolder
  4. QIing that folder to nsIMsgLocalMailFolder

so we can create sub-sub-folders or add messages. It'd be less of a mess if step 4 was unnecessary, since we know from steps 2 and 3 it must be a local folder.

Weirdly, although the two interfaces aren't related, the returned folder is already QIed to nsIMsgFolder so using the properties of that interface just works. There's some voodoo going on there I don't quite understand, but it makes life easier.

Assignee: nobody → geoff
Status: NEW → ASSIGNED
Blocks: 1867422
See Also: → 1867422
See Also: 1867422

I think I might abandon this idea. While it makes mochitests tidier to write (because of comment 2), in xpcshell tests that doesn't apply and folders have to be converted back to nsIMsgFolder all over the place. If we have to do a whole lot of converting, it should be from the more general interface to the more specific one.

This is a less-ugly pattern, even if it is longer because of all the QueryInterface-ing.

Attachment #9359287 - Attachment is obsolete: true
Summary: nsIMsgLocalMailFolder.createLocalSubfolder should return nsIMsgLocalMailFolder not nsIMsgFolder → Use createLocalSubfolder where possible in tests
Target Milestone: --- → 122 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/a342b551ba91
Use createLocalSubfolder where possible in tests. r=leftmostcat

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: