Closed Bug 434493 Opened 16 years ago Closed 16 years ago

Drop more instances of nsISupportsArray in mailnews.

Categories

(MailNews Core :: Backend, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.9

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(3 files)

Here are some more instances of nsISupportsArray that are easy to fix because they are stand-alone:

nsMsgSearchSession
nsMsgDBFolder
nsMsgDatabase
nsMsgImapProtocol

nsMsgComposeProgress is not used by anything, so this patch cvs removes it (which does mean we get rid of some nsISupportsArray instances of grep).
Attachment #321590 - Flags: superreview?(bienvenu)
Attachment #321590 - Flags: review?(bienvenu)
Comment on attachment 321590 [details] [diff] [review]
The fix (diff -w)

this looks like nice cleanup!

some nits - can you use the prevailing brace style in nsMsgSearchSession, instead of K&R?

e.g.,
+  nsCOMPtr<nsIMsgSearchNotify> listener;
+  while (iter.HasMore()) {


Here, do you mean the member variables like m_hasPendingMoves?
+  // Nothing to do, so don't change the local variables.
+  if (numFolders == 0)
+    return NS_OK;
+

not bailing out on error with the nsMsgDatabase notify methods is a change in behavior - errors should be rare, and it's probably better to not to bail out - I guess we'll see :-)
Attachment #321590 - Flags: superreview?(bienvenu)
Attachment #321590 - Flags: superreview+
Attachment #321590 - Flags: review?(bienvenu)
Attachment #321590 - Flags: review+
(In reply to comment #2)

> Here, do you mean the member variables like m_hasPendingMoves?
> +  // Nothing to do, so don't change the local variables.
> +  if (numFolders == 0)
> +    return NS_OK;
> +
Yes, I've done s/local/member/ in that comment. I checked the patch again, if AddMove only created the array if something was going to be added to it. So I think this is equivalent code.

> not bailing out on error with the nsMsgDatabase notify methods is a change in
> behavior - errors should be rare, and it's probably better to not to bail out -
> I guess we'll see :-)

Yes, I think I was slightly worried about extensions doing the wrong things and messing us up. If we are really relying on the order of listeners being called there its probably going to be an issue anyway.

I'll check the patch in with these comments addressed.
Attachment #321591 - Attachment description: The fix (full patch) → [checked in] The fix (full patch)
Patch checked in.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9
Note: since you know the nsCOMArray is never going to have more than kNumHdrsToXfer elements you could reserve space for it i.e.

nsMsgImapHdrXferInfo::nsMsgImapHdrXferInfo()
  : m_hdrInfos(kNumHdrsToXfer)
{
  m_nextFreeHdrInfo = 0;
}

The other alternative would be an nsAutoTArray<nsCOMPtr<nsIImapHeaderInfo>, 10>
Unfortunately this patch broke my unit test for search that I was preparing for bug 217034.

Previously, I was able start a test search with something like:

searchSession.search(null)

with a null window. But the new test at line 268 of nsMsgSearchSession.cpp:

  m_msgWindowWeak = do_GetWeakReference(aWindow, &rv);
  if (NS_FAILED(rv))
    return rv;

now fails the search with a null window. Is this really necessary? The code elsewhere seems to ignore null windows.
(In reply to comment #6)
> Unfortunately this patch broke my unit test for search that I was preparing for
> bug 217034.
...
> Is this really necessary? The code elsewhere seems to ignore null windows.

No it isn't necessary, sorry, that was my error. I know you've included it in the patch for bug 217034, but I'd like to back it out via this bug as I'm probably not going to get to review yours until Monday/Tuesday and I don't know if it'll have caused other regressions or not.
David, please see comments 6/7.
Attachment #322253 - Flags: superreview?(bienvenu)
Attachment #322253 - Flags: review?(bienvenu)
Attachment #322253 - Flags: superreview?(bienvenu)
Attachment #322253 - Flags: superreview+
Attachment #322253 - Flags: review?(bienvenu)
Attachment #322253 - Flags: review+
Attachment #322253 - Attachment description: Drop/Backout the unneeded check → [checked in] Drop/Backout the unneeded check
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: