Posts Tagged bug 437556

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.

, , , ,

No Comments