Closed Bug 1071469 Opened 10 years ago Closed 10 years ago

don't use 'jsval' in nsITelephonyService.idl

Categories

(Firefox OS Graveyard :: RIL, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2.1 S8 (7Nov)

People

(Reporter: vicamo, Assigned: jessica)

References

()

Details

Attachments

(4 files, 5 obsolete files)

+++ This bug was initially created as a clone of Bug #889737 +++

See bug 889737 comment 196.
Assignee: nobody → szchen
Great - Thanks for jumping on this Szu-Yu!
Per offline discussion, I will take it from here, it'd very similar to bug 1047196. :)
Assignee: szchen → jjong
Summary: don't use __exposedProps__ in MobileConnectionService.js → don't use 'jsval' in nsITelephonyService.idl
Attachment #8493587 - Attachment is obsolete: true
Attachment #8493587 - Flags: review?(vicamo)
Hi Hsinyi, may I have your review on this? Thanks.
Attachment #8514080 - Flags: review?(htsai)
Attached patch Part 2: dom changes, v1. (obsolete) — Splinter Review
Attached patch Part 3: ipc changes, v1. (obsolete) — Splinter Review
Attached patch Part 4: gonk changes, v1. (obsolete) — Splinter Review
Comment on attachment 8514080 [details] [diff] [review]
Part 1: idl changes, v1.

Review of attachment 8514080 [details] [diff] [review]:
-----------------------------------------------------------------

Sweet !
Attachment #8514080 - Flags: review?(htsai) → review+
Comment on attachment 8514095 [details] [diff] [review]
Part 2: dom changes, v1.

Hi Olli, this is to remove jsval in nsITelephonyService.idl, very similar to what we've done in bug 1047196.
After bug 1031175 is landed, we'll remove notifySendCancelMmi*() stuff in MobileConnection, see Bug 1070831.

May I have your review? Thanks.
Attachment #8514095 - Flags: review?(bugs)
Comment on attachment 8514096 [details] [diff] [review]
Part 3: ipc changes, v1.

Hi Olli, this is to remove jsval in nsITelephonyService.idl, very similar to what we've done in bug 1047196.
After bug 1031175 is landed, we'll remove notifySendCancelMmi*() stuff in MobileConnection, see Bug 1070831.

May I have your review? Thanks.
Attachment #8514096 - Flags: review?(bugs)
Comment on attachment 8514097 [details] [diff] [review]
Part 4: gonk changes, v1.

Edgar, may I have your review on this? Thanks.
Attachment #8514097 - Flags: review?(echen)
Comment on attachment 8514096 [details] [diff] [review]
Part 3: ipc changes, v1.

>-using struct IPC::MozCallForwardingOptions from "mozilla/dom/mobileconnection/MobileConnectionIPCSerializer.h";
>+using nsMobileCallForwardingOptions from "mozilla/dom/mobileconnection/MobileConnectionIPCSerializer.h";
Looks like I had missed in some earlier review that nsMobileCallForwardingOptions is now some odd typedef.

All those typedef nsIFoo* nsFoo;
should be changed to something else.
Perhaps
typedef nsIFoo* nsIFooPtr;
That can be done in a separate bug.
Attachment #8514096 - Flags: review?(bugs) → review+
Comment on attachment 8514095 [details] [diff] [review]
Part 2: dom changes, v1.

It is not quite clear to me why we need this all, but using less
jsval is always good!

>+  nsTArray<MozCallForwardingOptions> additionalInformation;
>+  for (uint32_t i = 0; i < aCount; i++)
>+  {
{ should be in the previous line

>+    MozCallForwardingOptions options;
>+    int16_t pShort;
>+    nsString pString;
nsAutoString

>+    bool pBool;
give proper names for these pFoo.
And declare just before using them (no need to reuse pShort for different things, just declare a new variable for each different case int16_t is use. That would be easier to read, I believe).
And initialize int16_t and bool variables to something (nsAutoString is initialized to empty string by default).
In theory nsIMobileCallForwardingOptions::GetActive and such might not set the out param to anything
if the method throws.

Those fixed, r+
Attachment #8514095 - Flags: review?(bugs) → review+
(In reply to Olli Pettay [:smaug] from comment #12)
> Comment on attachment 8514096 [details] [diff] [review]
> Part 3: ipc changes, v1.
> 
> >-using struct IPC::MozCallForwardingOptions from "mozilla/dom/mobileconnection/MobileConnectionIPCSerializer.h";
> >+using nsMobileCallForwardingOptions from "mozilla/dom/mobileconnection/MobileConnectionIPCSerializer.h";
> Looks like I had missed in some earlier review that
> nsMobileCallForwardingOptions is now some odd typedef.
> 
> All those typedef nsIFoo* nsFoo;
> should be changed to something else.
> Perhaps
> typedef nsIFoo* nsIFooPtr;
> That can be done in a separate bug.

Sure, filed bug 1093441.
(In reply to Olli Pettay [:smaug] from comment #13)
> Comment on attachment 8514095 [details] [diff] [review]
> Part 2: dom changes, v1.
> 
> It is not quite clear to me why we need this all, but using less
> jsval is always good!

The original purpose of this bug was to remove the use of '__exposedProps__', but since partner is requesting us to remove the use of 'jsval' in idls (see bug 1047196 comment 6), we decided to do it here directly. Doing this also avoids junk scope usage (see bug 1072710), so it's good overall.

> 
> >+  nsTArray<MozCallForwardingOptions> additionalInformation;
> >+  for (uint32_t i = 0; i < aCount; i++)
> >+  {
> { should be in the previous line
> 
> >+    MozCallForwardingOptions options;
> >+    int16_t pShort;
> >+    nsString pString;
> nsAutoString
> 
> >+    bool pBool;
> give proper names for these pFoo.
> And declare just before using them (no need to reuse pShort for different
> things, just declare a new variable for each different case int16_t is use.
> That would be easier to read, I believe).
> And initialize int16_t and bool variables to something (nsAutoString is
> initialized to empty string by default).
> In theory nsIMobileCallForwardingOptions::GetActive and such might not set
> the out param to anything
> if the method throws.
> 
> Those fixed, r+

Thanks, will do.
Comment on attachment 8514097 [details] [diff] [review]
Part 4: gonk changes, v1.

Review of attachment 8514097 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with below comments addressed, thank you.

::: dom/telephony/gonk/TelephonyService.js
@@ +143,1 @@
>  }

nit: };

@@ +712,5 @@
>                                                              response.timeSeconds,
>                                                              response.serviceClass);
>          }
>  
>          if (response.additionalInformation != null) {

!== null, here and http://dxr.mozilla.org/mozilla-central/source/dom/telephony/gonk/TelephonyService.js#687

@@ +722,5 @@
>          }
>        }
>  
> +      // No additional information
> +      if (response.additionalInformation == undefined) {

=== undefined, then we won't have to worry about 0 equaling undefined.

@@ +742,5 @@
> +                                                  array.length, array);
> +        return;
> +      }
> +
> +      throw Cr.NS_ERROR_UNEXPECTED;

don't need to throw an exception in sendWorkerMessage callback.
Attachment #8514097 - Flags: review?(echen) → review+
Thanks Edgar for the review.

(In reply to Edgar Chen [:edgar][:echen] from comment #16)
> Comment on attachment 8514097 [details] [diff] [review]
> Part 4: gonk changes, v1.
> 
> Review of attachment 8514097 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> r=me with below comments addressed, thank you.
> 
> ::: dom/telephony/gonk/TelephonyService.js
> @@ +143,1 @@
> >  }
> 
> nit: };

Will do.

> 
> @@ +712,5 @@
> >                                                              response.timeSeconds,
> >                                                              response.serviceClass);
> >          }
> >  
> >          if (response.additionalInformation != null) {
> 
> !== null, here and
> http://dxr.mozilla.org/mozilla-central/source/dom/telephony/gonk/
> TelephonyService.js#687

Hmm, 0 is not equalto (==) null, and if we use '!== null' here, if response.additionalInformation is undefined, it will meet this condition. Or we could change it to '!== undefined', as it is unlikely for it to be 'null'.

> 
> @@ +722,5 @@
> >          }
> >        }
> >  
> > +      // No additional information
> > +      if (response.additionalInformation == undefined) {
> 
> === undefined, then we won't have to worry about 0 equaling undefined.

same here.

> 
> @@ +742,5 @@
> > +                                                  array.length, array);
> > +        return;
> > +      }
> > +
> > +      throw Cr.NS_ERROR_UNEXPECTED;
> 
> don't need to throw an exception in sendWorkerMessage callback.

will call notifyDialMMISuccess(...) instead, what do you think?
(In reply to Jessica Jong [:jjong] [:jessica] from comment #17)
> Thanks Edgar for the review.
> 
> (In reply to Edgar Chen [:edgar][:echen] from comment #16)
> > Comment on attachment 8514097 [details] [diff] [review]
> > Part 4: gonk changes, v1.
> > 
> > Review of attachment 8514097 [details] [diff] [review]:
> > -----------------------------------------------------------------
> > 
> > r=me with below comments addressed, thank you.
> > 
> > ::: dom/telephony/gonk/TelephonyService.js
> > @@ +143,1 @@
> > >  }
> > 
> > nit: };
> 
> Will do.
> 
> > 
> > @@ +712,5 @@
> > >                                                              response.timeSeconds,
> > >                                                              response.serviceClass);
> > >          }
> > >  
> > >          if (response.additionalInformation != null) {
> > 
> > !== null, here and
> > http://dxr.mozilla.org/mozilla-central/source/dom/telephony/gonk/
> > TelephonyService.js#687
> 
> Hmm, 0 is not equalto (==) null, and if we use '!== null' here, if
> response.additionalInformation is undefined, it will meet this condition. Or
> we could change it to '!== undefined', as it is unlikely for it to be 'null'.

Yes, you are right, 0 isn't equaling null. I am okay with `!= null` now. Thank you. :)

> 
> > 
> > @@ +742,5 @@
> > > +                                                  array.length, array);
> > > +        return;
> > > +      }
> > > +
> > > +      throw Cr.NS_ERROR_UNEXPECTED;
> > 
> > don't need to throw an exception in sendWorkerMessage callback.
> 
> will call notifyDialMMISuccess(...) instead, what do you think?

Sounds good, go for it.
Changes since v1, see comment 13:
- s/nsAutoString/nsString/ in NotifyDialMMISuccessWithCallForwardingOptions()
- give proper variable names in NotifyDialMMISuccessWithCallForwardingOptions(), declare just before using them, initialize them and do not reuse them.
- add r=smaug
Attachment #8514095 - Attachment is obsolete: true
Attachment #8517278 - Flags: review+
Add r=smaug
Attachment #8514096 - Attachment is obsolete: true
Attachment #8517280 - Flags: review+
Attached patch Part 4: gonk changes, v2. (obsolete) — Splinter Review
- Add missing semicolon
- no need to throw an exception in sendWorkerMessage callback, call notifyDialMMISuccess(...) instead.
- Add r=echen
Attachment #8514097 - Attachment is obsolete: true
Attachment #8517282 - Flags: review+
Upload correct patch.
Attachment #8517282 - Attachment is obsolete: true
Attachment #8517301 - Flags: review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: