Closed Bug 890463 Opened 11 years ago Closed 11 years ago

Follow up of Use MMIResult for get IMEI - default case

Categories

(Firefox OS Graveyard :: Gaia::Dialer, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(blocking-b2g:leo+, b2g18 fixed, b2g-v1.1hd fixed)

RESOLVED FIXED
blocking-b2g leo+
Tracking Status
b2g18 --- fixed
b2g-v1.1hd --- fixed

People

(Reporter: ferjm, Assigned: ferjm)

References

Details

(Whiteboard: [u=commsapps-user c=dialer p=0], [LeoVB+])

Attachments

(1 file, 1 obsolete file)

As mentioned in https://bugzilla.mozilla.org/show_bug.cgi?id=888904#c6 we don't handle the default case properly.
blocking-b2g: --- → leo?
Attached patch v1 (obsolete) — Splinter Review
Assignee: nobody → ferjmoreno
Attachment #771579 - Flags: review?(anthony)
Blocking to allow for localization.
blocking-b2g: leo? → leo+
Whiteboard: [u=commsapps-user c=dialer p=0]
Attachment #771579 - Flags: review?(etienne)
Flags: in-testsuite-
Comment on attachment 771579 [details] [diff] [review]
v1

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

I'll let you decide, but it may be more readable to just have something like this and don't worry about calling LazyL10n.get each time (it's pretty cheap):

```
  send: function mm_send(message) {
    if (!this.ready) {
      this.init();
    }

    LazyL10n.get((function localized(_) {
      this._ = _;
      if (this._conn) {
        var request = this._pendingRequest = this._conn.sendMMI(message);
        request.onsuccess = this.notifySuccess.bind(this);
        request.onerror = this.notifyError.bind(this);
        this.openUI();
      }
    }).bind(this));
  },

```

Either way, we need to fix the double |_send()| call :)

::: apps/communications/dialer/js/mmi.js
@@ +53,5 @@
> +    if (!self._) {
> +      LazyL10n.get((function localized(_) {
> +        self._ = _;
> +        _send();
> +      }).bind(self));

no need for the bind since you're referencing self and not this inside.

@@ +58,3 @@
>      }
> +
> +    _send();

aren't you missing an early return in the |if (!self._)|?
Looks like we're going to call |_send()| twice here...

::: apps/communications/dialer/test/unit/mmi_test.js
@@ +60,4 @@
>  
>      test('Check empty request result', function(done) {
>        setTimeout(function() {
> +        assert.equal(MmiManager._ui._messageReceived, undefined);

nit: chai has a assert.isUndefined()
Attachment #771579 - Flags: review?(etienne)
Attachment #771579 - Flags: review?(anthony)
Attachment #771579 - Flags: review-
(In reply to Etienne Segonzac (:etienne) from comment #4)
> 
> @@ +58,3 @@
> >      }
> > +
> > +    _send();
> 
> aren't you missing an early return in the |if (!self._)|?
> Looks like we're going to call |_send()| twice here...

You are damn right! Thanks for noticing :). Fixing it.
Attached patch v2Splinter Review
Attachment #771579 - Attachment is obsolete: true
Attachment #773842 - Flags: review?(etienne)
Comment on attachment 773842 [details] [diff] [review]
v2

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

Perfect, thanks!
Attachment #773842 - Flags: review?(etienne) → review+
Thanks Etienne!

https://github.com/ferjm/gaia/commit/5841c7d539f5d4d24f863a9ab3e23046dde96372
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
(In reply to Fernando Jiménez Moreno [:ferjm] (needinfo instead of CC, please) from comment #8)
> Thanks Etienne!
> 
> https://github.com/ferjm/gaia/commit/5841c7d539f5d4d24f863a9ab3e23046dde96372

Do you have a commit ID for this commit on mozilla-b2g/gaia?
Isn't 5841c7d539f5d4d24f863a9ab3e23046dde96372 the commit ID?
Uplifted 5841c7d539f5d4d24f863a9ab3e23046dde96372 to:
v1-train: 7b79edb93d53f5fa956d3cbd0553d252c4e1c241
Whiteboard: [u=commsapps-user c=dialer p=0] → [u=commsapps-user c=dialer p=0], [LeoVB+]
v1.1.0hd: 7b79edb93d53f5fa956d3cbd0553d252c4e1c241
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: