author | Ryan VanderMeulen <ryanvm@gmail.com> |
Tue, 14 May 2013 16:51:22 -0400 | |
changeset 143425 | 975667697d0b6a9997daace037f480e3a626d8c1 |
parent 143424 | 9182c3e6a9673fc21d8fb83f88ee1fc711aac349 (current diff) |
parent 143378 | 26ab72bfa9df71f0cf25b0127e5ed4d9fce86201 (diff) |
child 143426 | bf0bcf4ecf28b0a935478f25be28c1757efd4881 |
push id | 2697 |
push user | bbajaj@mozilla.com |
push date | Mon, 05 Aug 2013 18:49:53 +0000 |
treeherder | mozilla-beta@dfec938c7b63 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
milestone | 24.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/contacts/fallback/ContactDB.jsm +++ b/dom/contacts/fallback/ContactDB.jsm @@ -449,17 +449,17 @@ ContactDB.prototype = { }; for (let field in aContact.properties) { contact.properties[field] = aContact.properties[field]; // Add search fields if (aContact.properties[field] && contact.search[field]) { for (let i = 0; i <= aContact.properties[field].length; i++) { if (aContact.properties[field][i]) { - if (field == "tel") { + if (field == "tel" && aContact.properties[field][i].value) { let number = aContact.properties.tel[i].value.toString(); let normalized = PhoneNumberUtils.normalize(number); // We use an object here to avoid duplicates let containsSearch = {}; let matchSearch = {}; if (normalized) { // exactTel holds normalized version of entered phone number. @@ -495,17 +495,17 @@ ContactDB.prototype = { } } for (let num in containsSearch) { contact.search.tel.push(num); } for (let num in matchSearch) { contact.search.parsedTel.push(num); } - } else if (field == "impp" || field == "email") { + } else if ((field == "impp" || field == "email") && aContact.properties[field][i].value) { let value = aContact.properties[field][i].value; if (value && typeof value == "string") { contact.search[field].push(value.toLowerCase()); } } else { let val = aContact.properties[field][i]; if (typeof val == "string") { contact.search[field].push(val.toLowerCase());
--- a/dom/contacts/tests/test_contacts_basics.html +++ b/dom/contacts/tests/test_contacts_basics.html @@ -331,17 +331,17 @@ var steps = [ req.onsuccess = function () { ok(createResult1.id, "The contact now has an ID."); sample_id1 = createResult1.id; checkContacts(properties1, createResult1); }; req.onerror = onFailure; }, function () { - ok(true, "Retrieving by substring"); + ok(true, "Retrieving by substring 1"); var options = {filterBy: ["givenName"], filterOp: "contains", filterValue: properties1.givenName[1].substring(0,3)}; req = mozContacts.find(options); req.onsuccess = function () { is(req.result.length, 1, "Found exactly 1 contact."); findResult1 = req.result[0]; ok(findResult1.id == sample_id1, "Same ID"); @@ -410,17 +410,17 @@ var steps = [ req = navigator.mozContacts.save(createResult2); req.onsuccess = function () { ok(createResult2.id, "The contact now has an ID."); next(); }; req.onerror = onFailure; }, function () { - ok(true, "Retrieving by substring"); + ok(true, "Retrieving by substring 2"); var options = {filterBy: ["givenName"], filterOp: "contains", filterValue: properties1.givenName[0].substring(0,3)}; req = mozContacts.find(options); req.onsuccess = function () { is(req.result.length, 1, "Found exactly 1 contact."); findResult1 = req.result[0]; checkContacts(createResult1, findResult1); @@ -436,17 +436,17 @@ var steps = [ } req = navigator.mozContacts.remove(createResult1); req.onsuccess = function () { next(); }; req.onerror = onFailure; }, function () { - ok(true, "Retrieving by substring"); + ok(true, "Retrieving by substring 3"); var options = {filterBy: ["givenName"], filterOp: "contains", filterValue: properties1.givenName[1].substring(0,3)}; req = mozContacts.find(options); req.onsuccess = function () { is(req.result.length, 0, "Found no contact."); next(); }; @@ -460,17 +460,17 @@ var steps = [ } req = navigator.mozContacts.remove(createResult2); req.onsuccess = function () { next(); }; req.onerror = onFailure; }, function () { - ok(true, "Retrieving by substring"); + ok(true, "Retrieving by substring 4"); var options = {filterBy: ["givenName"], filterOp: "contains", filterValue: properties1.givenName[1].substring(0,3)}; req = mozContacts.find(options); req.onsuccess = function () { is(req.result.length, 0, "Found no contact."); next(); }; @@ -655,32 +655,32 @@ var steps = [ findResult1 = req.result[0]; ok(findResult1.id == sample_id1, "Same ID"); checkContacts(createResult1, properties1); next(); }; req.onerror = onFailure; }, function () { - ok(true, "Retrieving by substring2"); + ok(true, "Retrieving by substring 5"); var options = {filterBy: ["givenName"], filterOp: "contains", filterValue: properties1.givenName[0].substring(0,3)}; req = mozContacts.find(options); req.onsuccess = function () { is(req.result.length, 1, "Found exactly 1 contact."); findResult1 = req.result[0]; ok(findResult1.id == sample_id1, "Same ID"); checkContacts(createResult1, properties1); next(); }; req.onerror = onFailure; }, function () { - ok(true, "Retrieving by substring3"); + ok(true, "Retrieving by substring 6"); var options = {filterBy: ["familyName", "givenName"], filterOp: "contains", filterValue: properties1.givenName[0].substring(0,3)}; req = mozContacts.find(options); req.onsuccess = function () { is(req.result.length, 1, "Found exactly 1 contact."); findResult1 = req.result[0]; ok(findResult1.id == sample_id1, "Same ID"); @@ -1395,16 +1395,38 @@ var steps = [ honorificPrefix: "string", sex: "17", genderIdentity: "18" }); next(); }; }, function () { + ok(true, "Adding contact with no number but carrier"); + createResult1 = new mozContact(); + createResult1.init({ tel: [{type: ["home"], carrier: "myCarrier"} ] }); + req = navigator.mozContacts.save(createResult1); + req.onsuccess = function () { + ok(createResult1.id, "The contact now has an ID."); + next(); + }; + req.onerror = onFailure; + }, + function () { + ok(true, "Adding contact with email but no value"); + createResult1 = new mozContact(); + createResult1.init({ email: [{type: ["home"]}] }); + req = navigator.mozContacts.save(createResult1); + req.onsuccess = function () { + ok(createResult1.id, "The contact now has an ID."); + next(); + }; + req.onerror = onFailure; + }, + function () { ok(true, "Deleting database"); req = mozContacts.clear() req.onsuccess = function () { ok(true, "Deleted the database"); next(); } req.onerror = onFailure; },
--- a/dom/devicestorage/nsDeviceStorage.cpp +++ b/dom/devicestorage/nsDeviceStorage.cpp @@ -1572,22 +1572,24 @@ public: { } ~InitCursorEvent() {} NS_IMETHOD Run() { NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!"); - bool check; - mFile->mFile->IsDirectory(&check); - if (!check) { - nsCOMPtr<PostErrorEvent> event = new PostErrorEvent(mRequest, POST_ERROR_EVENT_FILE_NOT_ENUMERABLE); - NS_DispatchToMainThread(event); - return NS_OK; + if (mFile->mFile) { + bool check; + mFile->mFile->IsDirectory(&check); + if (!check) { + nsCOMPtr<PostErrorEvent> event = new PostErrorEvent(mRequest, POST_ERROR_EVENT_FILE_NOT_ENUMERABLE); + NS_DispatchToMainThread(event); + return NS_OK; + } } nsDOMDeviceStorageCursor* cursor = static_cast<nsDOMDeviceStorageCursor*>(mRequest.get()); mFile->CollectFiles(cursor->mFiles, cursor->mSince); nsCOMPtr<ContinueCursorEvent> event = new ContinueCursorEvent(mRequest); event->Continue();