Closed
Bug 861462
Opened 12 years ago
Closed 12 years ago
preload contacts will be removed after factory reset
Categories
(Firefox OS Graveyard :: General, defect, P1)
Firefox OS Graveyard
General
Tracking
(blocking-b2g:tef+, firefox21 wontfix, firefox22 wontfix, firefox23 fixed, b2g18 fixed, b2g18-v1.0.0 wontfix, b2g18-v1.0.1 fixed)
VERIFIED
FIXED
blocking-b2g | tef+ |
People
(Reporter: Firefox_Mozilla, Assigned: gwagner)
References
Details
(Whiteboard: IOT, Spain, [fixed-in-birch])
Attachments
(1 file, 1 obsolete file)
2.86 KB,
patch
|
gwagner
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31
Steps to reproduce:
1)make a build with preload contacts
2) load images to the device
3) start up the device
4) make sure the preload contacts are existing
5) do factory reset by "setting->Device information->more infomation->Reset Phone"
Actual results:
After factory reset, the preload contacts will be removed
Expected results:
The preload contacts should be existing after factory reset.
Reporter | ||
Comment 1•12 years ago
|
||
Since the database of preload contacts is stored in the user data partition, which will be formated during factory reset, so the preload contacts will lost.
Comment 2•12 years ago
|
||
Hi,
This issue will be blocking for the certification. marking p1/tef? and adding dep with meta bug.
Thks!
David
blocking-b2g: --- → tef?
Priority: -- → P1
Updated•12 years ago
|
blocking-b2g: tef? → tef+
Comment 3•12 years ago
|
||
yuren, mind taking a look at this? thanks
Assignee: nobody → yurenju.mozilla
![]() |
||
Updated•12 years ago
|
QA Contact: atsai
![]() |
||
Updated•12 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
![]() |
||
Updated•12 years ago
|
Comment 4•12 years ago
|
||
I can repoduce it, investigating...
Updated•12 years ago
|
Whiteboard: [status: under investigation]
Comment 5•12 years ago
|
||
root cause is factory reset will earse all data in /data/local, and indexedDB for contact store there.
there are two options to fix it:
1. store to another place and copy to /data/local after recoveried (should be implemented in B2G/recovery/recovery.c)
2. use same way as browser machanism to do customization.
I don't like those two options but I have no other ideas for that.
Tim, do you have any idea?
Flags: needinfo?(timdream)
Comment 6•12 years ago
|
||
also needinfo? to this feature's author. Albert, do you have any idea?
Flags: needinfo?(acperez)
Comment 7•12 years ago
|
||
I would recommend a Gecko fix, similar to the behavior of Settings DB; in which,
1) A set of defaults will be stored in /system/b2g/defaults/contacts.json, which will survive the recovery.
2) No IndexedDB should be built for the Gaia build process
3) Gecko will build the new contacts DB with default contacts if it finds no databases exists in the profile.
(not sure is will be out of scope of tef+ though, but it shouldn't be.)
Flags: needinfo?(timdream)
Comment 8•12 years ago
|
||
Tim is right, this is how to do it. Cc-ing the contact people...
Updated•12 years ago
|
Whiteboard: [status: under investigation] → IOT, Spain, [status: under investigation]
Comment 9•12 years ago
|
||
Agree Tim's comment.
We have contact.json on gaia-distribution-sample
https://github.com/yurenju/gaia-distribution-sample/blob/master/contacts.json
we may use this format and move build/contacts.js to gecko and create preload contacts when first time running gecko with preload contacts.
here are something we need to do:
1. [gaia] if we have contacts.json in GAIA_DISTRIBUTION_DIR or GAIA_DIR/distribution/, copy it to /system/b2g/
2. [gecko] if /system/b2g/contacts exists on first time run, create preload contacts -- we can move GAIA_DIR/build/contacts.js to gecko.
deassign and waiting next triage to assign to gecko's guys.
Assignee: yurenju.mozilla → nobody
Assignee | ||
Comment 10•12 years ago
|
||
We should just copy the behavior from the settingsDB.
Assignee | ||
Updated•12 years ago
|
Assignee: nobody → anygregor
Assignee | ||
Comment 11•12 years ago
|
||
Do we have a sample JSON file I can use for testing?
Comment 12•12 years ago
|
||
Thanks Gregor for taking the bug.
(In reply to Gregor Wagner [:gwagner] from comment #11)
> Do we have a sample JSON file I can use for testing?
I think a file is available in the zip here:
https://wiki.mozilla.org/B2G/MarketCustomizations#Customization_Overview
Or you could ask Yuren to give you one directly.
Note that we will still need a Gaia build system fix. Gregor, do you intend to fix that altogether in this bug, or we should clone a bug for Gaia and have someone else to fix that?
Comment 13•12 years ago
|
||
https://github.com/telefonicaid/firefoxos-gaia-spain/blob/master/contacts.json
Ah, there is one right here.
Comment 14•12 years ago
|
||
https://github.com/mozilla-b2g/gaia/blob/master/build/contacts.js
The code to fill the database from JSON file can be moved from here in Gaia.
Comment 15•12 years ago
|
||
I'm agree, Tim's proposal is the best approach, like preloaded APNs.
Flags: needinfo?(acperez)
Assignee | ||
Comment 16•12 years ago
|
||
Assignee | ||
Updated•12 years ago
|
Attachment #738097 -
Flags: review?(bent.mozilla)
Updated•12 years ago
|
Whiteboard: IOT, Spain, [status: under investigation] → IOT, Spain, [status: needs review bent]
Comment on attachment 738097 [details] [diff] [review]
patch
Review of attachment 738097 [details] [diff] [review]:
-----------------------------------------------------------------
r=me!
::: dom/contacts/fallback/ContactDB.jsm
@@ +309,5 @@
> +
> + // Add default contacts
> + if (aOldVersion == 0) {
> + Cu.import("resource://gre/modules/FileUtils.jsm");
> + Cu.import("resource://gre/modules/NetUtil.jsm");
Let's put this on a temporary object just to be safe.
@@ +313,5 @@
> + Cu.import("resource://gre/modules/NetUtil.jsm");
> + // Loading resource://app/defaults/contacts.json doesn't work because
> + // contacts.json is not in the omnijar.
> + // So we look for the app dir instead and go from here...
> + let contactsFile = FileUtils.getFile("DefRt", ["contacts.json"], false);
One of these days this JSON-loading code should be factored out into a helper somewhere so that settings can use it too. I don't think we should care now but let's get a bug on file for it.
@@ +338,5 @@
> + } catch(e) {
> + if (DEBUG) debug("Error parsing " + contactsFile.path + " : " + e);
> + return;
> + }
> + stream.close();
Let's move this right after the ConvertToUnicode call.
@@ +341,5 @@
> + }
> + stream.close();
> + let idService = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
> + if (!objectStore) {
> + objectStore = aTransaction.objectStore(STORE_NAME);
Relying on the upgrade loop to always leave the correct objectStore set seems fragile. Let's always set here rather than using whatever is left over.
@@ +346,5 @@
> + }
> + for (let i = 0; i < contacts.length; i++) {
> + let contact = {};
> + contact.properties = contacts[i];
> + contact.id = idService.generateUUID().toString().replace('-', '', 'g').replace('{', '').replace('}', '');
Nit: This is pretty ugly, can you break this into multiple lines?
Attachment #738097 -
Flags: review?(bent.mozilla) → review+
Assignee | ||
Comment 18•12 years ago
|
||
Attachment #738097 -
Attachment is obsolete: true
Attachment #739000 -
Flags: review+
Assignee | ||
Updated•12 years ago
|
Whiteboard: IOT, Spain, [status: needs review bent] → IOT, Spain, checkin-needed
Comment 19•12 years ago
|
||
Comment on attachment 739000 [details] [diff] [review]
patch
Review of attachment 739000 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/contacts/fallback/ContactDB.jsm
@@ +349,5 @@
> + let contact = {};
> + contact.properties = contacts[i];
> + contact.id = idService.generateUUID().toString().replace('-', '', 'g')
> + .replace('{', '')
> + .replace('}', '');
Nit: " instead of ', and you can do do replace(/[{}-]/g, "").
Assignee | ||
Comment 20•12 years ago
|
||
(In reply to Reuben Morais [:reuben] from comment #19)
> Comment on attachment 739000 [details] [diff] [review]
> patch
>
> Review of attachment 739000 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: dom/contacts/fallback/ContactDB.jsm
> @@ +349,5 @@
> > + let contact = {};
> > + contact.properties = contacts[i];
> > + contact.id = idService.generateUUID().toString().replace('-', '', 'g')
> > + .replace('{', '')
> > + .replace('}', '');
>
> Nit: " instead of ', and you can do do replace(/[{}-]/g, "").
I don't trust our regexp implementation to be faster in this case :)
Comment 21•12 years ago
|
||
Whiteboard: IOT, Spain, checkin-needed → IOT, Spain, [fixed-in-birch]
Comment 22•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Comment 23•12 years ago
|
||
https://hg.mozilla.org/releases/mozilla-b2g18/rev/42f118fcbcea
https://hg.mozilla.org/releases/mozilla-b2g18_v1_0_1/rev/4cdd542efe79
Comment 24•12 years ago
|
||
Inari
Gaia v1.0.1: 2bcc625aecce5f111b70f7cf4d17523a09cb7d6c
Verified.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•