Closed Bug 928782 Opened 11 years ago Closed 11 years ago

B2G RIL: "Import SIM Contact" failed after when Contact API is WebIDLized.

Categories

(Firefox OS Graveyard :: RIL, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: allstars.chh, Assigned: allstars.chh)

References

Details

Attachments

(1 file, 2 obsolete files)

STR:
Insert some SIM with some SIM contacts on it.

Contact App -> Settings -> Import Contacts -> SIM card

Now we got the following message.

10-21 11:31:42.294: E/GeckoConsole(704): [JavaScript Error: "'toJSON' called on an object that does not implement interface mozContact." {file: "jar:file:///system/b2g/omni.ja!/components/RILContentHelper.js" line: 1467}]
I'll check if it's something wrong from RIL first.
And discuss the correct way to fix this with Reuben.
Assignee: nobody → allstars.chh
Sorry I forgot to mention I have enabled the DEBUG_ALL flag in dom/system/gonk/ril_consts.js. 
If I set it to false, now the Gaia part will meet this error.

10-21 14:55:02.601: E/GeckoConsole(1408): [JavaScript Error: "TypeError: Argument 1 of ContactManager.save does not implement interface mozContact." {file: "app://communications.gaiamobile.org/contacts/js/utilities/import_sim_contacts.js" line: 184}]
Now I try to remove the ObjectWrapper added from Bug 842981, now Gaia got some error.

10-21 15:36:34.602: E/GeckoConsole(1898): [JavaScript Error: "TypeError: Value being assigned to ContactField.type is not an object." {file: "app://communications.gaiamobile.org/contacts/js/utilities/import_sim_contacts.js" line: 153}]
Doing Comment 3 also removes the error from Comment 2.
So now the error is in Comment 3 whether the DEBUG is on or off in RILContentHelper.js
Yes, this is incorrect usage of the mozContact interface. Comment 2 means you're trying to do something like |navigator.mozContacts.save({name: ["foo"]});| or whatever. You have to create a mozContact object first:

  var c = new mozContact({name: ["foo"]});
  navigator.mozContacts.save(c);

Comment 3 means you're trying to set .type to something that's incompatible with the interface (it needs to be an array of strings).
Attachment #820165 - Flags: review?(vyang) → review+
Attached patch Patch. v2 (obsolete) — Splinter Review
rebase
Attachment #820165 - Attachment is obsolete: true
Attachment #822148 - Flags: review+
Attached patch Patch. v3Splinter Review
Seems somebody commited before me, rebase again
Attachment #822148 - Attachment is obsolete: true
Attachment #822229 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/eb3cc0b4cc43
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Blocks: 1157082
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: