Last Comment Bug 834911 - remove support of nsIEnumerator from mailnews/base/util/iteratorUtils.jsm
: remove support of nsIEnumerator from mailnews/base/util/iteratorUtils.jsm
Status: RESOLVED FIXED
: addon-compat
Product: MailNews Core
Classification: Components
Component: Backend (show other bugs)
: Trunk
: All All
: -- normal (vote)
: Thunderbird 21.0
Assigned To: :aceman
:
Mentors:
Depends on: 436089 834020
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-25 14:30 PST by :aceman
Modified: 2013-02-09 13:44 PST (History)
6 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
patch - mailnews (8.23 KB, patch)
2013-02-08 15:53 PST, :aceman
bugmail: review+
Details | Diff | Review
patch - TB (4.20 KB, patch)
2013-02-08 15:54 PST, :aceman
bugmail: review+
Details | Diff | Review

Description :aceman 2013-01-25 14:30:10 PST
+++ 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.
Comment 1 neil@parkwaycc.co.uk 2013-01-25 15:45:45 PST
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.
Comment 2 :aceman 2013-01-25 16:05:35 PST
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.
Comment 3 :aceman 2013-01-25 16:08:21 PST
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.
Comment 4 neil@parkwaycc.co.uk 2013-01-25 16:32:49 PST
(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.
Comment 5 :aceman 2013-01-25 16:43:09 PST
OK, I can try.
Comment 6 :aceman 2013-02-08 15:53:42 PST
Created attachment 712020 [details] [diff] [review]
patch - mailnews
Comment 7 :aceman 2013-02-08 15:54:12 PST
Created attachment 712021 [details] [diff] [review]
patch - TB
Comment 8 neil@parkwaycc.co.uk 2013-02-08 16:11:01 PST
Comment on attachment 712020 [details] [diff] [review]
patch - mailnews

I'm not really familiar with this stuff, maybe mkmelin can review this too?
Comment 9 Andrew Sutherland [:asuth] 2013-02-09 11:45:00 PST
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.
Comment 10 Andrew Sutherland [:asuth] 2013-02-09 11:46:02 PST
Comment on attachment 712021 [details] [diff] [review]
patch - TB

I think I can review this one too; stealing.
Comment 11 :aceman 2013-02-09 12:16:38 PST
Thanks.

Note You need to log in before you can comment on or make changes to this bug.