Bug 1578523 - Fix deletion of LDAP address book. r=mkmelin

This commit is contained in:
Geoff Lankow 2019-09-04 11:23:59 +12:00
Родитель 7837983e0f
Коммит 3769c28982
2 изменённых файлов: 17 добавлений и 3 удалений

Просмотреть файл

@ -64,9 +64,13 @@ nsresult nsAbBSDirectory::CreateDirectoriesFromFactory(const nsACString &aURI,
nsCOMPtr<nsIAbDirectory> childDir = do_QueryInterface(newDirSupports, &rv);
if (NS_FAILED(rv)) continue;
// Define a relationship between the preference
// entry and the directory
mServers.Put(aURI, aServer);
// In some cases (LDAP) the actual URI of the directory may differ from
// aURI. Use the URI of the directory.
nsCString uri;
childDir->GetURI(uri);
// Define a relationship between the preference entry and the directory.
mServers.Put(uri, aServer);
mSubDirectories.AppendObject(childDir);

Просмотреть файл

@ -14,6 +14,8 @@ function run_test() {
return;
}
let abCountBeforeStart = [...MailServices.ab.directories].length;
// Test - Create an LDAP directory
let abUri = MailServices.ab.newAddressBook(
"test",
@ -21,6 +23,9 @@ function run_test() {
kLDAPDirectory
);
let abCountAfterCreate = [...MailServices.ab.directories].length;
Assert.equal(abCountAfterCreate, abCountBeforeStart + 1);
// Test - Check we have the directory.
let abDir = MailServices.ab
.getDirectory(kLDAPUriPrefix + abUri)
@ -193,4 +198,9 @@ function run_test() {
}
localAcTests.forEach(checkAc);
MailServices.ab.deleteAddressBook(abDir.URI);
let abCountAfterDelete = [...MailServices.ab.directories].length;
Assert.equal(abCountAfterDelete, abCountBeforeStart);
}