Closed Bug 850529 Opened 11 years ago Closed 11 years ago

B2G MMS: MmsMessage::GetAttachments() should return an empty array when it has no attachments

Categories

(Core :: DOM: Device Interfaces, enhancement, P5)

ARM
Gonk (Firefox OS)
enhancement

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: airpingu, Assigned: vicamo)

References

Details

(Whiteboard: [fixed-in-birch])

Attachments

(1 file)

Please see https://bugzilla.mozilla.org/show_bug.cgi?id=844431#c97 for Mounir's comment as below:

I think it could be better to return an empty array instead but I am not sure... Could you file a follow-up and CC jonas and I.
Hi Jonas and Mounir,

This is an issue raised by Mounir when implementing MMS DOM structure at bug 844431. I know this is not an extremely major issue but we still need your final decision to resolve this bug. Let's review the current MMS structure as below:

  dictionary MmsAttachment
  {
    DOMString? id;
    DOMString? location;
    nsIDOMBlob content;
  };

  interface nsIDOMMozMmsMessage : nsISupports
  {
    // skip...

    [implicit_jscontext]
    readonly attribute jsval attachments; // MmsAttachment[]
  };


The question is: when an MMS has no attachments, we should return a null or an empty array for the |.attachments|?
Flags: needinfo?(mounir)
Flags: needinfo?(jonas)
Blocks: 844431
No longer depends on: 844431
I would prefer an empty array. However, this is not very urgent. You guys could also fix that later when there is less pressure.
Flags: needinfo?(mounir)
Priority: -- → P5
I agree with comment 3.
Flags: needinfo?(jonas)
Severity: normal → enhancement
Attached patch patchSplinter Review
Assignee: nobody → vyang
Attachment #771567 - Flags: review?(gene.lian)
Comment on attachment 771567 [details] [diff] [review]
patch

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

Maybe add an .onsent event handler to ensure we shouldn't succeed to send anyway? The current patch looks fine to me. It's up to you. :)
Attachment #771567 - Flags: review?(gene.lian) → review+
Flags: in-testsuite+
(In reply to Gene Lian [:gene] from comment #6)
> Maybe add an .onsent event handler to ensure we shouldn't succeed to send
> anyway? The current patch looks fine to me. It's up to you. :)

We only have either a onsent or a onfailed event.  Never have both.  |tasks.next()| is only called in onfailed event handler, so if somehow we get a onsent event instead, the test case will fail with a timeout error.
Yes, I know. My point is we don't need to rely on the timeout. We can use .onsent to explicitly return error earlier.

Btw, it comes to my head that maybe using .onsending is a better alternative. In this way, we don't need to play the .onfailed trick. ;)

What do you think?
I've tried onsending before submitting for review, but onfailed is better for me, so that we don't have further impact on succeeding test cases.
https://hg.mozilla.org/mozilla-central/rev/8106727efe7a
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: