Closed Bug 2059345 Opened 3 months ago Closed 3 months ago

Split nsImapOfflineDownloader from nsImapOfflineSync

Categories

(MailNews Core :: Database, task)

task

Tracking

(Not tracked)

RESOLVED FIXED
155 Branch

People

(Reporter: benc, Assigned: benc)

References

(Blocks 1 open bug)

Details

Attachments

(3 external files)

nsImapOfflineDownloader currently inherits from nsImapOfflineSync, even though they don't really have any overlap in functionality.

They are both used when we go from offline to online:

nsImapOfflineSync - plays back any stored operations on IMAP folders that occurred while we were offline and need to be relayed up to the server.

nsImapOfflineDownloader - kicks off downloading messages to the local store (pausing the nsIAutoSyncManager which does the same thing, but in the background).

The only real commonality is potential traversal over all the folders, and even then there are special cases (eg nsImapOfflineDownloader is only interested in IMAP folder, while nsImapOfflineSync also needs to handle local folders (which might be targets for offline move/copy ops).

The inheritance makes both classes pretty incomprehensible (and makes refactoring offline ops really hard - Bug 2057063).
It'd be much simpler if they were completely separate classes, even if it means duplicating some folder-traversal code.

Assignee: nobody → benc
Status: NEW → ASSIGNED
Keywords: leave-open

Notes to self, to help pick up the assorted threads needed to climb out of this rabbit hole next week:

So there's a patch which splits out nsImapOfflineDownloader.
But nsImapOfflineDownloader has no test coverage to verify it's working. So let's add a test before we split it out, so we can check before and after.

Looks like nsImapOfflineDownloader is used exclusively by nsIMsgOfflineManager.synchronizeForOffline(), so I've written a simple test which uses that.

Except that there isn't a way to tell when nsIMsgOfflineManager.synchronizeForOffline() is finished.
There is an nsIMsgOfflineManager.inProgress attribute you can poll, but that doesn't seem to work, so some more investigation is needed there (polling .inProgress works for some of the other tests, but not here - it just hangs).

Attachment #9620238 - Attachment description: WIP: Bug 2059345 - Add test_nsImapOfflineDownloader.js. → Bug 2059345 - Add test_nsImapOfflineDownloader.js. r=#thunderbird-reviewers
Attachment #9619709 - Attachment description: WIP: Bug 2059345 - Split nsImapOfflineDownloader out from nsImapOfflineSync. → Bug 2059345 - Split nsImapOfflineDownloader out from nsImapOfflineSync. r=#thunderbird-back-end-reviewers
Target Milestone: --- → 155 Branch

Pushed by benc@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/0115a688b4f8
Add test_nsImapOfflineDownloader.js. r=tobyp
https://hg.mozilla.org/comm-central/rev/f9dd9e30db6e
Split nsImapOfflineDownloader out from nsImapOfflineSync. r=tobyp

Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED

Doh - I screwed up and left a member variable uninitialised.
Thanks, ASAN!
https://treeherder.mozilla.org/jobs?repo=comm-central&selectedTaskRun=XVibuuWZSlWDTuwSyBmi-g.0

Status: RESOLVED → REOPENED
Resolution: FIXED → ---

Pushed by toby@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/49bbf56aea06
Fix uninitialised member variable in nsImapOfflineDownloader. r=mkmelin

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

Attachment

General

Creator:
Created:
Updated:
Size: