Pi’s Blog

My blog about Thunderbird and GSoC 2008

Bug 437556

A while ago I mentioned that I accidentally crashed Thunderbird while figuring out how to import an Address Book because I forgot to set the fieldMap before I called BeginImport. So, I filed Bug 437556: Mailnews crashes while importing an address book if a field map is required but not set. After receiving comments on previous patches, I believe the following code should stop the import, log an error, and return false if the field map isn’t set when it needs to be.

  PRBool needsFieldMap = PR_FALSE;

  if (NS_FAILED(m_pInterface->GetNeedsFieldMap(m_pLocation, &needsFieldMap)) ||
      (needsFieldMap && !m_pFieldMap)) {
                                        m_stringBundle, error);
    SetLogs(success, error, successLog, errorLog);
    *_retval = PR_FALSE;
    return NS_OK;

Included in the patch is a simple unit test to check that BeginImport returns false if the fieldMap isn’t set. I am in the process of writing more unit tests for importing address books.

Here is the bug report with the patch and the test.

Update: The patch was checked in, but the original test failed on Windows builds and the new one is waiting for feedback.


June 9, 2008 - Posted by | Uncategorized | , , , ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: