Closed Bug 834911 Opened 11 years ago Closed 11 years ago

remove support of nsIEnumerator from mailnews/base/util/iteratorUtils.jsm

Categories

(MailNews Core :: Backend, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 21.0

People

(Reporter: aceman, Assigned: aceman)

References

Details

(Keywords: addon-compat)

Attachments

(2 files)

+++ This bug was initially created as a clone of Bug #834020 +++

nsIEnumerator seems obsolete per https://developer.mozilla.org/en-US/docs/XPCOM_array_guide.

I think can remove the support from mailnews/base/util/iteratorUtils.jsm
when the nsISupportsArray is killed from comm-central and mozilla-central.
As the the users of these arrays can call .enumerate() them and that that produces an nsIEnumerator that the user may want to iterate on.

Of course nsIEnumerator must be killed first too, but that is done for c-c in bug 834020. We must wait for m-c now, in bug 7795.
Summary: remove support of nsIEnumerator mailnews/base/util/iteratorUtils.jsm → remove support of nsIEnumerator from mailnews/base/util/iteratorUtils.jsm
I wouldn't have expected people to use iteratorUtils on core enumerators. There are only a few:

nsISelectionPrivate::GetEnumerator
nsICollection::Enumerate
nsIInterfaceInfoManager has two
PSM has three.

I'm not even sure you can count nsICollection::Emumerate because you can use iteratorUtils on an nsISupportsArray directly.
I'm thinking of this stuff:
mailnews:
db/gloda/modules/index_msg.js:              for each (let destMsgHdr in fixIterator(aDestMsgHdrs.enumerate(),
db/gloda/modules/index_msg.js:              for each (let srcMsgHdr in fixIterator(aSrcMsgHdrs.enumerate(),
db/gloda/modules/index_msg.js:            for each (let destMsgHdr in fixIterator(aDestMsgHdrs.enumerate(),
test/resources/folderEventLogHelper.js:    for each (let msgHdr in fixIterator(aMsgs.enumerate(),
test/resources/folderEventLogHelper.js:    for each (let msgHdr in fixIterator(aMsgs.enumerate(),
test/resources/folderEventLogHelper.js:    for each (let msgHdr in fixIterator(aSrcMsgs.enumerate(),
test/resources/folderEventLogHelper.js:      for each (let msgHdr in fixIterator(aDestMsgs.enumerate(),

mail:
base/content/folderPane.js:        for each (let folderWithFlag in fixIterator(foldersWithFlag.enumerate(),
base/content/editContactOverlay.js:        for (let card in fixIterator(list.addressLists.enumerate())) {
base/modules/MailUtils.js:    for each (let folder in fixIterator(folders.enumerate(), Ci.nsIMsgFolder)) {
components/cloudfile/cloudFileAccounts.js:    for (let entry in fixIterator(categoryManager.enumerateCategory(CATEGORY),
test/mozmill/cloudfile/test-cloudfile-add-account-dialog.js:  for (let entry in fixIterator(gCategoryMan.enumerateCategory(kCategory),

Couldn't find any in suite.
If we rewrite or audit these places we could probably remove it. With the decision that people having some nsISupportsArray or nsIEnumerator got from m-c code simply must cope with it without fixIterator.
(In reply to aceman from comment #2)
> db/gloda/modules/index_msg.js:              for each (let destMsgHdr in fixIterator(aDestMsgHdrs.enumerate(),
> db/gloda/modules/index_msg.js:              for each (let srcMsgHdr in fixIterator(aSrcMsgHdrs.enumerate(),
> db/gloda/modules/index_msg.js:            for each (let destMsgHdr in fixIterator(aDestMsgHdrs.enumerate(),
> test/resources/folderEventLogHelper.js:    for each (let msgHdr in fixIterator(aMsgs.enumerate(),
> test/resources/folderEventLogHelper.js:    for each (let msgHdr in fixIterator(aMsgs.enumerate(),
> test/resources/folderEventLogHelper.js:    for each (let msgHdr in fixIterator(aSrcMsgs.enumerate(),
> test/resources/folderEventLogHelper.js:      for each (let msgHdr in fixIterator(aDestMsgs.enumerate(),
> base/content/folderPane.js:        for each (let folderWithFlag in fixIterator(foldersWithFlag.enumerate(),
> base/content/editContactOverlay.js:        for (let card in fixIterator(list.addressLists.enumerate())) {
> base/modules/MailUtils.js:    for each (let folder in fixIterator(folders.enumerate(), Ci.nsIMsgFolder)) {
fixIterator works on an nsISupportsArray, no need to call .enumerate() on it first. So if you fix those you can go ahead and remove the support in fixIterator for nsIEnumerator!

> components/cloudfile/cloudFileAccounts.js:    for (let entry in fixIterator(categoryManager.enumerateCategory(CATEGORY),
> test/mozmill/cloudfile/test-cloudfile-add-account-dialog.js:  for (let entry in fixIterator(gCategoryMan.enumerateCategory(kCategory),
Not an nsIEnumerator.
OK, I can try.
Assignee: nobody → acelists
Depends on: 436089
No longer depends on: 7795, 394167
Attached patch patch - mailnewsSplinter Review
Attachment #712020 - Flags: review?(neil)
Attached patch patch - TBSplinter Review
Attachment #712021 - Flags: review?(mkmelin+mozilla)
Status: NEW → ASSIGNED
Keywords: addon-compat
Comment on attachment 712020 [details] [diff] [review]
patch - mailnews

I'm not really familiar with this stuff, maybe mkmelin can review this too?
Attachment #712020 - Flags: review?(neil) → review?(mkmelin+mozilla)
Attachment #712020 - Flags: review?(bugmail)
Comment on attachment 712020 [details] [diff] [review]
patch - mailnews

Thanks for fixing the let each to let while you were at it!

This is pretty straightforward, so I think just my review should suffice.
Attachment #712020 - Flags: review?(mkmelin+mozilla)
Attachment #712020 - Flags: review?(bugmail)
Attachment #712020 - Flags: review+
Comment on attachment 712021 [details] [diff] [review]
patch - TB

I think I can review this one too; stealing.
Attachment #712021 - Flags: review?(mkmelin+mozilla) → review+
Thanks.
Keywords: checkin-needed
https://hg.mozilla.org/comm-central/rev/baabd0228d41
https://hg.mozilla.org/comm-central/rev/b66b5fafc36d
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 21.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: