mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 852057 - Sort contacts correctly when givenName or familyName is null. r=gwagner
This commit is contained in:
parent
211e11853d
commit
0cf92bfb46
@ -581,7 +581,7 @@ ContactDB.prototype = {
|
||||
xIndex++;
|
||||
}
|
||||
if (!x) {
|
||||
return sortOrder == 'ascending' ? 1 : -1;
|
||||
return sortOrder == 'descending' ? 1 : -1;
|
||||
}
|
||||
while (yIndex < sortBy.length && !y) {
|
||||
y = b.properties[sortBy[yIndex]] ? b.properties[sortBy[yIndex]][0].toLowerCase() : null;
|
||||
|
@ -28,7 +28,7 @@ if (!SpecialPowers.getBoolPref("dom.mozContacts.enabled")) {
|
||||
comp.utils.import("resource://gre/modules/PermissionPromptHelper.jsm");
|
||||
SpecialPowers.setBoolPref("dom.mozContacts.enabled", true);
|
||||
}
|
||||
|
||||
|
||||
SpecialPowers.addPermission("contacts-write", true, document);
|
||||
SpecialPowers.addPermission("contacts-read", true, document);
|
||||
SpecialPowers.addPermission("contacts-create", true, document);
|
||||
@ -140,8 +140,16 @@ function onFailure() {
|
||||
}
|
||||
|
||||
function checkStr(str1, str2, msg) {
|
||||
if (str1)
|
||||
ok(typeof str1 == "string" ? [str1] : str1, (typeof str2 == "string") ? [str2] : str2, msg);
|
||||
// comparing /[null(,null)+]/ and undefined should pass
|
||||
function nonNull(e) {
|
||||
return e != null;
|
||||
}
|
||||
if ((Array.isArray(str1) && str1.filter(nonNull).length == 0 && str2 == undefined)
|
||||
||(Array.isArray(str2) && str2.filter(nonNull).length == 0 && str1 == undefined)) {
|
||||
ok(true, msg);
|
||||
} else if (str1) {
|
||||
is(JSON.stringify(typeof str1 == "string" ? [str1] : str1), JSON.stringify(typeof str2 == "string" ? [str2] : str2), msg);
|
||||
}
|
||||
}
|
||||
|
||||
function checkAddress(adr1, adr2) {
|
||||
|
Loading…
Reference in New Issue
Block a user