Closed Bug 1196694 Opened 9 years ago Closed 9 years ago

Failure to match contacts by phone numbers

Categories

(Firefox OS Graveyard :: Gaia::Dialer, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1200576

People

(Reporter: gerard-majax, Unassigned)

References

Details

(Keywords: dataloss, foxfood, regression)

This is something that used to work and that regressed at some point in the past. Might be a data migration issue with my profile ...

STR:
 0. Have a contact "* XXX", with registered valid phone number "+33247..."
 1. Open Dialer
 2. Type "0247"

Expected:
 I have a match of phone number that is ready to call, i.e., I see the suggested contact "* XXX, +33247..."

Actual:
 I have a match against the good contact, but the phone number in the suggestion is "undefined"

On startup of dialer, I can see:
> 08-20 13:36:26.773   320   320 E GeckoConsole: [JavaScript Error: "ConstraintError" {file: "jar:file:///system/b2g/omni.ja!/components/DataStoreImpl.js" line: 233}]

On appearance of the bogus suggestion, I can see:
> 08-20 13:36:47.183  5475  5475 E Communications: [JavaScript Error: "TypeError: item is undefined" {file: "app://communications.gaiamobile.org/shared/js/binary_search.js" line: 1}]
> 08-20 13:36:47.233   320   320 E GeckoConsole: [JavaScript Error: "uncaught exception: [object DOMError]"]
> 08-20 13:36:47.233   320   320 E GeckoConsole: [JavaScript Error: "uncaught exception: [object DOMError]"]
> 08-20 13:36:47.233   320   320 E GeckoConsole: [JavaScript Error: "TypeError: iconObject is undefined" {file: "app://system.gaiamobile.org/js/card.js" line: 298}]
> 08-20 13:36:47.233   320   320 E GeckoConsole: [JavaScript Error: "uncaught exception: [object DOMError]"]
> 08-20 13:36:47.233   320   320 E GeckoConsole: [JavaScript Error: "uncaught exception: [object DOMError]"]
> 08-20 13:36:47.233   320   320 E GeckoConsole: [JavaScript Error: "uncaught exception: [object DOMError]"]
> 08-20 13:36:47.243  5475  5475 E Communications: [JavaScript Error: "TypeError: item is undefined" {file: "app://communications.gaiamobile.org/shared/js/binary_search.js" line: 1}]

If I start typing "+33247" the matching is properly done and the correct phone number is being suggested.

I am filing this in Dialer, but it might be a lower-level issue ...
Flags: needinfo?(jlorenzo)
Flags: needinfo?(gsvelto)
FYI that seems to be reproduced for all contacts I have with an international format number stored: +33xxx.
Smells like a regression to me, possibly related to my l10n work. Leaving the NI until I've time to work on this.
I doubt this is related, but we've had some recent bugs dupe'd against bug 1114525.
Flags: needinfo?(jlorenzo)
See Also: → 1114525
I doubt this is related: Alexandre has a match, while the symptom of bug 1114525 is that we have no match.
I've tried this on my phones but I cannot get it to reproduce. I've tried both in the emulator using the US prefix (+1) and on my Italian (+39) and Dutch (+31) SIM cards and none match 0247 with a prefixed number (e.g. +31247... or +39247...). 0247 simply yields nothing, could this be specific to how French prefixes are matched? IIRC that job is done in gecko but I could be wrong.
Flags: needinfo?(gsvelto)
In Dialer we use a lib called simple_phone_matcher.js: https://github.com/mozilla-b2g/gaia/blob/master/shared/js/simple_phone_matcher.js

It runs after a mozContacts call that's done in the lib shared/js/dialer/contacts.js. I don't know much more...
Retested on a build from today and found something even worse: if I remove the number from the contact and add it, when I try to reproduce the bug I do not get an "undefined" value, but rather nothing. But the contact matches !

It means I see a suggestion "XXX, " with XXX the name of the contact and nothing instead of the phone number. Tapping on it triggers a call with the few numbers I started typing.
I see you guys did hack in the ContactDB code. Can you instruct me what I should give you to check ?
Component: Gaia::Dialer → DOM: Contacts
Flags: needinfo?(reuben.bmo)
Flags: needinfo?(ferjmoreno)
Product: Firefox OS → Core
Hi Alexandre. Could you set DEBUG to true in ContactDB.jsm and then attach the log while reproducing this? That'd be a good start.

https://dxr.mozilla.org/mozilla-central/source/dom/contacts/fallback/ContactDB.jsm#11
Flags: needinfo?(reuben.bmo)
The contacts database is at /data/local/storage/permanent/chrome/idb/3406066227csotncta.sqlite
Flags: needinfo?(lissyx+mozillians)
(In reply to Reuben Morais [:reuben] from comment #10)
> The contacts database is at
> /data/local/storage/permanent/chrome/idb/3406066227csotncta.sqlite

I have been able to get you logs that should be even better :). Sent everything per mail (since it contains confidential informations).

FYI this gets reproduced on another device that has another profile and when I create new contacts.
Flags: needinfo?(lissyx+mozillians) → needinfo?(reuben.bmo)
For context:
 - creating new account
 - adding number following international standard, i.e., +336xxx
 - french SIM card
 - french network
 - no roaming at all
Nominating because this feels like quite bad regression: unable to match number registered with international prefix. Not a dupe of bug 1114525 because I reproduce this on several devices, new profiles, new contacts, with french SIM card on french network, out of roaming zone and with french international prefix.

That means:
 - new contact with number +33612345678
 - open dialer, start tapping 0612

=> Contact match with empty phone number exposed.
blocking-b2g: --- → 2.5?
Flags: needinfo?(nhirata.bugzilla)
Flags: needinfo?(jlorenzo)
After investigation, I have been able to confirm the issue is indeed around formatting code in suggestion_bar.js code:
> telTag.innerHTML = Sanitizer.unwrapSafeHTML(tel);

The |tel| value we pass onto this call is the proper one, i.e., +336xxx. But we receive an empty string as a result.
Component: DOM: Contacts → Gaia::Dialer
Product: Core → Firefox OS
Okay, that makes more sense than ContactDB changing behavior after years without any changes to the code :)
Flags: needinfo?(reuben.bmo)
(In reply to Alexandre LISSY :gerard-majax from comment #14)
> After investigation, I have been able to confirm the issue is indeed around
> formatting code in suggestion_bar.js code:
> > telTag.innerHTML = Sanitizer.unwrapSafeHTML(tel);
> 
> The |tel| value we pass onto this call is the proper one, i.e., +336xxx. But
> we receive an empty string as a result.

Ugh, I somehow knew that would have come back and bitten us one day. Bug 1200576 is the proper fix, I'm mentoring it right now but since it's not making much forward progress I'll probably make a fix myself and find another bug for the person it's assigned to right now.
Regression, blocking.

If this is a dupe of bug 1200576, please mark as dup and nominate bug 1200576 .
blocking-b2g: 2.5? → 2.5+
Clearing needinfo based on comment 14.
Flags: needinfo?(ferjmoreno)
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: needinfo?(jlorenzo)
Resolution: --- → DUPLICATE
blocking-b2g: 2.5+ → ---
Flags: needinfo?(nhirata.bugzilla)
You need to log in before you can comment on or make changes to this bug.