[email][contacts] Contact is not shown in Contact app after adding from email using "Save contact"



Firefox OS
5 years ago
5 years ago


(Reporter: nhirata, Assigned: arthurcc)


Gonk (Firefox OS)

Firefox Tracking Flags

(blocking-b2g:leo+, b2g18 verified, b2g18-v1.0.1 unaffected)



(1 attachment)

Master build : 2013-04-03-03-09-39
project name="mozilla-central" revision="97cfc16ba5dc"
project name="integration/gaia-central" revision="87f388cd8a2b"
"gecko.git" revision="c9029081bedc93372d0e15e66d89c81bf74c1fd0"
"gaia.git" revision="30f22a3f669779b30efdc09c6ad3f9e6476b988f"

Gecko  http://hg.mozilla.org/releases/mozilla-b2g18/rev/d467369d1b0c
Gaia   06e0e5ce42bdfb62bdbe38271de6b5b2d9e40e75
BuildID 20130403070204
Version 18.0

## Repro :
1. launch email app w/ an email account setup
2. select an email in the list
3. tap on the email address that's not in the contacts app
4. select Save contact
5. hit home button
6. launch contact
7. look for new contact
## Expected :
contact should be found

## Actual :
contact is not found.
## Note :
1. happens both on gmail and hotmail
2. doesn't matter if contact is or is not launched.
I can't find an existing contact either... it almost seems like it's using two different databases?


5 years ago
Assignee: nobody → arthur.chen
blocking-b2g: leo? → leo+


5 years ago
status-b2g18-v1.0.1: --- → unaffected
This only occurs when the contact database does not exist, users try to access the contact database through web activity such as 'new'. After that occurs, all created contact database cannot be found by the contact app itself. Therefore users cannot find the added contacts in the next time they launch the contact app.

I'm still trying to find the root cause.
Root cause found. Forget my previous comment. 

The root cause was that when users add a contact, the contact change event makes the contact app access async storage. Since it was the first time accessing, the database of async storage needs to be created. During the creation of the database, the frame was closed due to the end of web activity and resulted in a database without object stores. Which leads to javascript error next time we try to access async storage and then the bug we have here.

A workaround would be initializing contact list (in which the async storage gets initialized) regardless the app is invoked manually or from web activity. This could almost ensure that the database of async storage created successfully.

Alberto, any ideas?
Flags: needinfo?(alberto.pastor)

Comment 4

5 years ago
I would go for avoiding adding the contact to the list if we are currently in an activity. That's a not needed operation, as the flow is going to finish after saving the contact...

What do you think?
Flags: needinfo?(alberto.pastor)
Created attachment 735574 [details]
Link to https://github.com/mozilla-b2g/gaia/pull/9075

Alberto, your suggestion makes a lot sense. However, I couldn't find a good timing to avoid the initialization of the contact list. We finish the web activity at the time of successfully adding a contact. The event of contact change fires after that, which means we cannot differentiate this case from normal ones in the "performOnContactChange" function because the "ActivityHandler.currentlyHandling" is already false.

Thus I made a simpler workaround as the pull request. Please let me know if any concerns, thanks!
Attachment #735574 - Flags: review?(alberto.pastor)

Comment 6

5 years ago
What about not registering the oncontactschange event if we start an activity?
Your suggestion is great. Pull request updated.


5 years ago
Attachment #735574 - Flags: review?(alberto.pastor) → review+
master: https://github.com/mozilla-b2g/gaia/commit/56c53e090412cf8aeb7b80a812b90229ec4d6cd6
Last Resolved: 5 years ago
Resolution: --- → FIXED
Uplifted commit 56c53e090412cf8aeb7b80a812b90229ec4d6cd6 as:
v1-train: 41e5fb95b0673b8c1b457ea8ab3b1d52319a6142
status-b2g18: affected → fixed
verified fixed on Leo with:

Gecko  http://hg.mozilla.org/releases/mozilla-b2g18/rev/0c71cbc5fe0c
Gaia   a7b0810580afc734f3d5e441914fe895f9c1923e
BuildID 20130508230207
Version 18.0
status-b2g18: fixed → verified
You need to log in before you can comment on or make changes to this bug.