Closed
Bug 787477
Opened 13 years ago
Closed 13 years ago
B2G RIL: Add error handling for getICCContacts
Categories
(Core :: DOM: Device Interfaces, defect)
Tracking
()
RESOLVED
FIXED
mozilla18
People
(Reporter: allstars.chh, Assigned: allstars.chh)
References
Details
Attachments
(3 files, 6 obsolete files)
1.66 KB,
patch
|
philikon
:
review+
sicking
:
superreview+
|
Details | Diff | Splinter Review |
3.57 KB,
patch
|
gwagner
:
review+
|
Details | Diff | Splinter Review |
4.13 KB,
patch
|
Details | Diff | Splinter Review |
Currently in nsIRadioInterfaceLayer.getICCContacts, there's no way to tell error happens, we need to revise this.
Assignee | ||
Comment 1•13 years ago
|
||
Attachment #659195 -
Flags: review?(philipp)
Assignee | ||
Comment 2•13 years ago
|
||
Attachment #659196 -
Flags: review?(anygregor)
Assignee | ||
Comment 3•13 years ago
|
||
Attachment #659198 -
Flags: review?(philipp)
Assignee | ||
Comment 4•13 years ago
|
||
update error message
Attachment #659198 -
Attachment is obsolete: true
Attachment #659198 -
Flags: review?(philipp)
Assignee | ||
Comment 5•13 years ago
|
||
remove trailing ws
Attachment #659203 -
Attachment is obsolete: true
Assignee | ||
Updated•13 years ago
|
Attachment #659204 -
Flags: review?(philipp)
Comment 6•13 years ago
|
||
Comment on attachment 659195 [details] [diff] [review]
Part 1: Update IDL of getICCContacts.
Review of attachment 659195 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/system/gonk/nsIRadioInterfaceLayer.idl
@@ +310,4 @@
> */
> + void getICCContacts(in DOMString contactType,
> + in nsIRILContactCallback callback,
> + in nsIRILContactErrorCallback errorCallback);
Do we really need an extra callback for errors? Why not follow the node.js convention of (error, result) in the callback signature? Or in this case, (error, contactType, contacts). Use `null` when values don't apply.
Attachment #659195 -
Flags: review?(philipp)
Comment 7•13 years ago
|
||
Comment on attachment 659204 [details] [diff] [review]
Part 3: Update RIL implementations. v2
Review of attachment 659204 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/system/gonk/RadioInterfaceLayer.js
@@ +439,5 @@
> +
> + delete this._contactsCallbacks[message.requestId];
> + if (message.success) {
> + cbObj.callback.receiveContactsList(message.contactType,
> + message.contacts);
You can just call `cbObj.callback()` since you declared nsIRILContactCallback to be a [function] interface.
::: dom/system/gonk/ril_worker.js
@@ +1498,5 @@
> delete options.callback;
> delete options.onerror;
> options.rilMessageType = "icccontacts";
> + options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
> + options.success = false;
You can also do
options.success = options.rilRequestError == ERROR_SUCCESS;
before we invoke the success/error callbacks. That way you don't have to set `options.success` in every place.
Attachment #659204 -
Flags: review?(philipp)
Comment 8•13 years ago
|
||
(In reply to Philipp von Weitershausen [:philikon] from comment #6)
> Comment on attachment 659195 [details] [diff] [review]
> Part 1: Update IDL of getICCContacts.
>
> Review of attachment 659195 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: dom/system/gonk/nsIRadioInterfaceLayer.idl
> @@ +310,4 @@
> > */
> > + void getICCContacts(in DOMString contactType,
> > + in nsIRILContactCallback callback,
> > + in nsIRILContactErrorCallback errorCallback);
>
> Do we really need an extra callback for errors? Why not follow the node.js
> convention of (error, result) in the callback signature? Or in this case,
> (error, contactType, contacts). Use `null` when values don't apply.
Yeah we could handle the error case in the regular callback. But I guess most of our new function have successCB and errorCB.
If we want to fire the errorcallback from multiple locations it would make more sense to use a dedicated argument for it.
Assignee | ||
Comment 9•13 years ago
|
||
(In reply to Philipp von Weitershausen [:philikon] from comment #6)
> Comment on attachment 659195 [details] [diff] [review]
> Part 1: Update IDL of getICCContacts.
>
> Review of attachment 659195 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: dom/system/gonk/nsIRadioInterfaceLayer.idl
> @@ +310,4 @@
> > */
> > + void getICCContacts(in DOMString contactType,
> > + in nsIRILContactCallback callback,
> > + in nsIRILContactErrorCallback errorCallback);
>
> Do we really need an extra callback for errors? Why not follow the node.js
> convention of (error, result) in the callback signature? Or in this case,
> (error, contactType, contacts). Use `null` when values don't apply.
Hi philikon,
Since this function is used in ContactService, so I use the same style in ContactService and ContactDB.
Which style do you prefer? node.js or the one in ContactService ?
Thanks
Comment 10•13 years ago
|
||
The convention used in ContactsDB (and other IndexedDB consumers) has different reasons. I'd prefer a simple callback interface for the RIL here.
Assignee | ||
Comment 11•13 years ago
|
||
(In reply to Philipp von Weitershausen [:philikon] from comment #10)
> The convention used in ContactsDB (and other IndexedDB consumers) has
> different reasons. I'd prefer a simple callback interface for the RIL here.
Thanks, then I'll use the (error, contactType, contacts) style here.
Assignee | ||
Updated•13 years ago
|
Attachment #659196 -
Flags: review?(anygregor)
Assignee | ||
Comment 12•13 years ago
|
||
With philikon's comments addressed,
Didn't introduce another error callback and use node.js style for error notification.
Attachment #659195 -
Attachment is obsolete: true
Assignee | ||
Comment 13•13 years ago
|
||
Accommodated to IDL's update.
Attachment #659196 -
Attachment is obsolete: true
Assignee | ||
Comment 14•13 years ago
|
||
Attachment #659204 -
Attachment is obsolete: true
Assignee | ||
Comment 15•13 years ago
|
||
Comment on attachment 660773 [details] [diff] [review]
Part 1: Update IDL of getICCContacts. v2
Hi, philikon
I added another parameter errorMsg according to your suggestions,
would you help to review this?
Thanks
Attachment #660773 -
Flags: review?(philipp)
Assignee | ||
Comment 16•13 years ago
|
||
Comment on attachment 660776 [details] [diff] [review]
Part 2: Update ContactManager and ContactService v2
Hi, gwagner
Could you review this patch for error handling of importing SIM contact?
Thanks
Attachment #660776 -
Flags: review?(anygregor)
Assignee | ||
Comment 17•13 years ago
|
||
Comment on attachment 660777 [details] [diff] [review]
Part 3: Update RIL implementations. v3
Hi, philikon
Since now ril_worker will report the error message to RadioInterfaceLayer, so I didn't introduction another property 'success' in options here.
Also I noticed that when I call the callback in RadioInterfaceLayer.js, I still have to use callback.receiveContactsList here as I found its type is still object, not function.
Thanks
Attachment #660777 -
Flags: review?(philipp)
Comment 18•13 years ago
|
||
Comment on attachment 660776 [details] [diff] [review]
Part 2: Update ContactManager and ContactService v2
>+ mRIL.getICCContacts(
>+ msg.options.contactType,
>+ function (aErrorMsg, aType, aContacts) {
>+ if (aErrorMsg) {
>+ mm.sendAsyncMessage("Contacts:GetSimContacts:Return:KO",
>+ {requestID: msg.requestID,
>+ errorMsg: aErrorMsg});
>+ } else {
>+ mm.sendAsyncMessage("Contacts:GetSimContacts:Return:OK",
>+ {requestID: msg.requestID,
>+ contacts: aContacts});
>+ }
>+ }.bind(this));
Huh I am not a big fan of this style but it works.
Attachment #660776 -
Flags: review?(anygregor) → review+
Comment 19•13 years ago
|
||
(In reply to Yoshi Huang[:yoshi][:allstars.chh] from comment #17)
> Since now ril_worker will report the error message to RadioInterfaceLayer,
> so I didn't introduction another property 'success' in options here.
Sounds good.
> Also I noticed that when I call the callback in RadioInterfaceLayer.js, I
> still have to use callback.receiveContactsList here as I found its type is
> still object, not function.
Ah, looks like I got confused a little then. Thanks for verifying.
Updated•13 years ago
|
Attachment #660773 -
Flags: review?(philipp) → review+
Updated•13 years ago
|
Attachment #660777 -
Flags: review?(philipp) → review+
Assignee | ||
Comment 20•13 years ago
|
||
Comment on attachment 660773 [details] [diff] [review]
Part 1: Update IDL of getICCContacts. v2
Hi, sicking
Currently in ContactDB, there is no way to tell error cause when importing SIM contact, (i.e. SIM absent)
So this patch is about adding error message in getting SIM contact,
as philikon suggested in comment 6 and comment 10.
Would you review this for me?
Thanks
Attachment #660773 -
Flags: superreview?(jonas)
Attachment #660773 -
Flags: superreview?(jonas) → superreview+
Assignee | ||
Comment 21•13 years ago
|
||
just updated comments.
Attachment #660777 -
Attachment is obsolete: true
Assignee | ||
Comment 22•13 years ago
|
||
Assignee | ||
Comment 23•13 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/08dad2228e8b
https://hg.mozilla.org/integration/mozilla-inbound/rev/f3544d53ea06
https://hg.mozilla.org/integration/mozilla-inbound/rev/3ba159322e73
Target Milestone: --- → mozilla18
Comment 24•13 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/08dad2228e8b
https://hg.mozilla.org/mozilla-central/rev/f3544d53ea06
https://hg.mozilla.org/mozilla-central/rev/3ba159322e73
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•