Closed Bug 996831 Opened 10 years ago Closed 10 years ago

Add a ToJSValue overload for nsresult

Categories

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

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: nsm, Assigned: bzbarsky)

Details

Attachments

(1 file)

This should return a DOMError or exception based on the error code. Useful for non-[Throws] Promises that should be rejected by errors.
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment on attachment 8407620 [details] [diff] [review]
Add a ToJSValue overload for nsresult, to allow rejecting promises from C++ more easily.

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

r=me

::: dom/bindings/ToJSValue.h
@@ +211,5 @@
>    aValue.set(aArgument);
>    return MaybeWrapValue(aCx, aValue);
>  }
>  
> +// Accept nsresult, for use in rejections

Mention that this converts the result into an XPCOM exception object?
Attachment #8407620 - Flags: review?(bobbyholley) → review+
And b2g is _still_ unhappy, since nsresult is uint32_t over there, apparently, so those two signatures are not distinguishable.  :(
I ifdefed out the uint32_t ToJSValue for now.  https://hg.mozilla.org/integration/mozilla-inbound/rev/5d75982d37a5
https://hg.mozilla.org/mozilla-central/rev/5d75982d37a5
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.