Closed Bug 899546 Opened 6 years ago Closed 6 years ago

ENSURE_SUCCESS macro for ErrorResult

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: baku, Assigned: baku)

Details

Attachments

(1 file, 5 obsolete files)

This macro would be nice to have in order to avoid:

if (rv.Failed()) {
  NS_WARNING(something);
  return somethingelse;
}

Converting IDB components to WebIDL I had to replace many NS_ENSURE_SUCCESS/TRUE to a if statement. Maybe a macro can be useful.
Attached patch patch (obsolete) — Splinter Review
Attachment #783127 - Flags: review?(bzbarsky)
Attached patch macro.patch (obsolete) — Splinter Review
I prefer to split the patch in 2.
Attachment #783127 - Attachment is obsolete: true
Attachment #783127 - Flags: review?(bzbarsky)
Attachment #783140 - Flags: review?(bzbarsky)
Attached patch macro.patch (obsolete) — Splinter Review
Attachment #783140 - Attachment is obsolete: true
Attachment #783140 - Flags: review?(bzbarsky)
Attachment #783189 - Flags: review?(bzbarsky)
Attached patch macro.patch (obsolete) — Splinter Review
better approach
Attachment #783189 - Attachment is obsolete: true
Attachment #783189 - Flags: review?(bzbarsky)
Attachment #783190 - Flags: review?(bzbarsky)
Comment on attachment 783190 [details] [diff] [review]
macro.patch

r=me
Attachment #783190 - Flags: review?(bzbarsky) → review+
Keywords: checkin-needed
Attached patch macro.patch (obsolete) — Splinter Review
Attachment #783190 - Attachment is obsolete: true
Keywords: checkin-needed
Attached patch macro.patchSplinter Review
I cannot use nsCPrintfString because webRTC uses ErrorResult.h and it's external-linked. This new version uses nsCString and ApppendPrintf and it works.
Attachment #783420 - Attachment is obsolete: true
Attachment #783589 - Flags: review?(bzbarsky)
Comment on attachment 783589 [details] [diff] [review]
macro.patch

r=me
Attachment #783589 - Flags: review?(bzbarsky) → review+
https://hg.mozilla.org/mozilla-central/rev/42dffbbe9e57
Assignee: nobody → amarchesini
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.