Closed Bug 818158 Opened 12 years ago Closed 12 years ago

mozContact.find() - contains lookup on the "tel" field failing

Categories

(Core :: DOM: Device Interfaces, defect, P2)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
B2G C3 (12dec-1jan)
blocking-basecamp +
Tracking Status
firefox18 --- fixed
firefox19 --- fixed
firefox20 --- fixed

People

(Reporter: etienne, Assigned: gwagner)

Details

Attachments

(1 file, 1 obsolete file)

A "contains" find with 699056123 will not match a contact with a 0699056123 phone number. Which is weird, since 0699056123 *does* contain 699056123.

But a "contains" find of +33699056123 will match 0699056123, so I guess we're doing something smart on the platform side which might be a bit too smart.

In the meantime all the contacts lookup from the Dialer are failing...
blocking-basecamp: --- → ?
Component: DOM: Core & HTML → DOM: Device Interfaces
Assignee: nobody → anygregor
We definitely need to fix this.  Is it related to PhoneNumberJS?
blocking-basecamp: ? → +
Mass Modify: All un-milestoned, unresolved blocking-basecamp+ bugs are being moved into the C3 milestone. Note that the target milestone does not mean that these bugs can't be resolved prior to 12/10, rather C2 bugs should be prioritized ahead of C3 bugs.
Target Milestone: --- → B2G C3 (12dec-1jan)
Priority: -- → P2
Attached patch patch (obsolete) — Splinter Review
Attachment #689274 - Flags: review?(bent.mozilla)
Attached patch patchSplinter Review
Attachment #689274 - Attachment is obsolete: true
Attachment #689274 - Flags: review?(bent.mozilla)
Attachment #689422 - Flags: review?(bent.mozilla)
Comment on attachment 689422 [details] [diff] [review]
patch

Review of attachment 689422 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/contacts/fallback/ContactDB.jsm
@@ +260,5 @@
>                  if (digits && number.length != digits.length) {
>                    digits = digits.join('');
>                    for(let i = 0; i < digits.length; i++) {
> +                    let num = digits.substring(i, digits.length);
> +                    if (contact.search[field].indexOf(num) < 0) {

Instead of doing this n^2 stuff let's just add all the numbers to a jsobj and then enumerate it at the end?

@@ +445,5 @@
>          let tmp = typeof options.filterValue == "string"
>                    ? options.filterValue.toLowerCase()
>                    : options.filterValue.toString().toLowerCase();
> +        if (key === 'tel') {
> +          let digits = options.filterValue.match(/\d/g);

Shouldn't this be 'tmp.match(...)'?
Attachment #689422 - Flags: review?(bent.mozilla) → review+
https://hg.mozilla.org/mozilla-central/rev/bf86988e2420
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: