Closed Bug 1306540 Opened 3 years ago Closed 3 years ago

Convert FindEnumStringIndex to JSAPI signature convention.

Categories

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

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: arai, Assigned: Waldo)

References

Details

Attachments

(1 file)

(In reply to Jeff Walden [:Waldo] (remove +bmo to email) from bug 1289050 comment #43)
> >  template<bool InvalidValueFatal>
> >  inline int
> >  FindEnumStringIndex(JSContext* cx, JS::Handle<JS::Value> v, const EnumEntry* values,
> >                      const char* type, const char* sourceDescription, bool* ok)
> 
> It would be good to file a followup bug to convert this to the JSAPI
> signature convention of returning false on failure, filling the index in an
> outparam.  This is in a bunch of JSAPI-using code, and the oddball
> convention makes the code harder to read -- plus you have oddities like
> being forced to set an outparam *and* return a value that should never be
> examined (like |return 0| when ToString fails is a perfectly reasonable
> return value, but you have to know the caller will never look at it because
> of the |*ok = false;| to know it's fine).
Attached patch PatchSplinter Review
Assignee: nobody → jwalden+bmo
Status: NEW → ASSIGNED
Component: JavaScript Engine → DOM
Attachment #8796427 - Attachment description: Unbuilt patch → Patch
Attachment #8796427 - Flags: review?(peterv)
Comment on attachment 8796427 [details] [diff] [review]
Patch

r=me
Attachment #8796427 - Flags: review?(peterv) → review+
Pushed by jwalden@mit.edu:
https://hg.mozilla.org/integration/mozilla-inbound/rev/83fd09630531
FindEnumStringIndex should follow JSAPI interface conventions.  r=bz
https://hg.mozilla.org/mozilla-central/rev/83fd09630531
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.