diff options
Diffstat (limited to 'comm/mailnews/import/test/unit/test_bug_437556.js')
-rw-r--r-- | comm/mailnews/import/test/unit/test_bug_437556.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/comm/mailnews/import/test/unit/test_bug_437556.js b/comm/mailnews/import/test/unit/test_bug_437556.js new file mode 100644 index 0000000000..284309a2dc --- /dev/null +++ b/comm/mailnews/import/test/unit/test_bug_437556.js @@ -0,0 +1,23 @@ +/** + * Test for a regression of Bug 437556: mailnews crashes while importing an + * address book if a field map is required but not set. + */ +function run_test() { + var file = do_get_file("resources/basic_addressbook.csv"); + var errorStr = Cc["@mozilla.org/supports-string;1"].createInstance( + Ci.nsISupportsString + ); + // get the Address Book text import interface and make sure it succeeded + var helper = new AbImportHelper(file, "Text file"); + helper.setFieldMap(null); + helper.setAddressBookLocation(file); + + var abInterface = helper.getInterface(); + Assert.notEqual(abInterface, null); + // prepare to start the import + Assert.ok(abInterface.WantsProgress()); + // start the import + // BeginImport should return false and log an error if the fieldMap isn't set + Assert.ok(!abInterface.BeginImport(null, errorStr)); + Assert.notEqual(errorStr, ""); +} |