Replace idl nsIArray usage with Array<T> in nsIMsgAccountManager
Categories
(MailNews Core :: General, task)
Tracking
(Not tracked)
People
(Reporter: benc, Assigned: benc)
References
Details
Attachments
(9 files, 6 obsolete files)
9.54 KB,
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
42.97 KB,
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
45.34 KB,
patch
|
benc
:
review+
|
Details | Diff | Splinter Review |
2.73 KB,
patch
|
benc
:
review+
|
Details | Diff | Splinter Review |
14.58 KB,
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
52.85 KB,
patch
|
benc
:
review+
|
Details | Diff | Splinter Review |
22.00 KB,
patch
|
benc
:
review+
|
Details | Diff | Splinter Review |
14.65 KB,
patch
|
benc
:
review+
|
Details | Diff | Splinter Review |
11.61 KB,
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
Split out from Bug 1612239.
There are lots of generic names to track down in this one - "accounts", "identities" etc... so I'm doing it in small steps.
Assignee | ||
Comment 1•5 years ago
|
||
This one switches over the nsIMsgAccountManager accounts
attr from nsIArray to Array<>.
It's a generic name to track down in the javascript side, but I think I got em all... (fingers crossed!)
try build here:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&selectedJob=288806666
Assignee | ||
Comment 2•5 years ago
|
||
Oddly, when I was linting the changes on the previous patch, clang-format highlighted a bunch of small whitespace changes in code I hadn't touched. The other patch is big enough that it could do without the unrelated churn. So here's an independent patch with the changes requested by clang-format.
Comment 3•5 years ago
|
||
Updated•5 years ago
|
Comment 4•5 years ago
•
|
||
Comment 5•5 years ago
•
|
||
Needs also a successful try run - the above looks pretty orange.
Assignee | ||
Comment 6•5 years ago
|
||
Tweaked patch, with suggested changes.
I set the r? on it, but I don't think it needs another full review. I found a couple of places I had missed, under mail/components/im
. If you just search for files under that path in the diff the rest should be sufficiently covered by the previous r+.
There's a try run here:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=6c81ea172348b677edd90753b6f5b5be3afbce6a
The holdup turned out to be rather odd. I think this patch accidentally fixed a previously-broken-but-somehow-still-passing test for some windows-specific import code. So with patch applied, the import test would start working properly... and fail (correctly, because it had incorrect test data). That's addressed separately, in Bug 1620658.
Comment 7•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/1da9c3650607
remove nsIArray use in nsIMsgAccountManager (part one: accounts). r=mkmelin
https://hg.mozilla.org/comm-central/rev/cd8871b0a49c
Tweaks requested by clang-format. r=mkmelin
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 9•5 years ago
|
||
The existing nsIMsgAccountManager
unit tests leave a lot of the interface uncovered. This adds an additional test where I plan to extend coverage as this bug progresses.
Assignee | ||
Comment 10•5 years ago
|
||
This one does nsIMsgAccountManager.allIdentities
.
Try build looking good:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=05424fbb64ac49150d536ad37c1724fc03b1833c
Comment 11•5 years ago
|
||
Updated•5 years ago
|
Comment 12•5 years ago
|
||
Assignee | ||
Comment 13•5 years ago
|
||
Assignee | ||
Comment 14•5 years ago
|
||
Rebased to go after the allIdentities patch.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 15•5 years ago
|
||
The remaining suggestions from Comment 11 - switching enigmail code to get the account manager using MailServices.accounts. Included in this try build.
Updated•5 years ago
|
Comment 16•5 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/8d2199268183
remove nsIArray use in nsIMsgAccountManager.allIdentities. r=mkmelin,pmorris
https://hg.mozilla.org/comm-central/rev/40b4770d124e
Add some more unit tests for nsIMsgAccountManager. r=mkmelin
https://hg.mozilla.org/comm-central/rev/3c0f617d39f6
Followup. Use MailServices to get accountmanager in Enigmail code. r=mkmelin DONTBUILD
Assignee | ||
Comment 17•5 years ago
|
||
Mostly straightfoward, although there was some dead-code removal in nsImapOfflineDownloader::ProcessNextOperation()
I was a little unsure of:
I removed a redundant-looking call to GetAllServers()
.
It's possible that the code was relying on that for side effects (invoking LoadAccounts()
, for example). But even if it is relying on that, I think it'll still be OK - there's an AdvanceToNextServer()
call further down, which does call GetAllServers()
.
Anyway, try build seems fine:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=737b18fc4cb092e7d8069e93d4b743f4409c9052
Comment 18•5 years ago
|
||
Assignee | ||
Comment 19•5 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #18)
this could now be just
return MailServices.accounts.allServers.find(server =>
server.canHaveFilters);
Good point. Tweaked accordingly.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 20•5 years ago
|
||
Assignee | ||
Comment 21•5 years ago
|
||
Try build for parts four and five:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=4d9c1f5df33be753646a0f03259898437457d37d
Comment 22•5 years ago
|
||
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/16ca51abc6dd
Remove nsIArray use in nsIMsgAccountManager.allServers. r=mkmelin
Updated•5 years ago
|
Updated•5 years ago
|
Comment 23•5 years ago
|
||
Comment 24•5 years ago
|
||
Comment 25•5 years ago
|
||
Comment 26•5 years ago
|
||
Comment 27•5 years ago
|
||
Before I forget again: please check the bustage fixes I made in comment 23 and comment 24. I think I did it right but wouldn't go calling myself an expert.
Assignee | ||
Comment 28•5 years ago
|
||
(In reply to Geoff Lankow (:darktrojan) from comment #27)
Before I forget again: please check the bustage fixes I made in comment 23 and comment 24. I think I did it right but wouldn't go calling myself an expert.
Sorry about that! Didn't think the win64 build would be any different than the linux64 one, and there seem to be loads of places where uint32_t
is used for indexing (although not in a build-breaking way, like this).
Anyway, your fix looks like the right one (size_t
for indexes).
Technically, it should be nsTArray<RefPtr<nsIMsgWhatever>>::index_type
, but... no. Just no. It always boils down to size_t
anyway.
My policy from here on shall be:
Use auto
where sensible, and size_t
elsewhere.
Assignee | ||
Comment 29•5 years ago
|
||
Just revised to apply the two suggested tweaks:
(In reply to Magnus Melin [:mkmelin] from comment #25)
::: mail/base/content/folderDisplay.js
could be just
let allEnabled = serverIdentities.every(identity => identity.archiveEnabled);
There's a little more to it. It's checking all true, all false, or a mixture.
But the code wasn't very clear, so I used two of .every() checks on it (one for all true and one for all false).
::: mail/extensions/openpgp/content/modules/filters.jsm
and this
return identities.find(id => id.email.toLowerCase() ===
senderEmail.toLowerCase());
I originally didn't do this because Array.find()
returns undefined rather than null. But I changed my mind - going with the JS convention seems like a better approach (and I can't imagine any code being too picky about it anyway).
Assignee | ||
Comment 30•5 years ago
|
||
Revised with tweaks, as per comment 26.
Assignee | ||
Updated•5 years ago
|
Comment 31•5 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/c3a2ed94fe27
Remove nsIArray use in nsIMsgAccountManager.getIdentitiesForServer(). r=mkmelin
https://hg.mozilla.org/comm-central/rev/c368a253924a
Remove nsIArray use in nsIMsgAccountManager.getServersForIdentity(). r=mkmelin
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 32•5 years ago
|
||
This converts the last one in nsIMsgAccountManager
(the allFolders
attr).
There's a try build here - wasn't totally clean, but I think they're intermittent and unrelated:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=993ae00b3807c19ba2e3209985c705f0a81c6003
I run the same patch with a linux-specific build and it came up clean:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=24204eaeb8d922d31fdeeaa791ea8e5f83da5f7f
Comment 33•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Comment 34•5 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/4fd2ffb62492
Remove nsIArray use in nsIMsgAccountManager.allFolders. r=mkmelin
Description
•