Closed Bug 1615022 Opened 4 years ago Closed 4 years ago

Make CopyableErrorResult safer to use

Categories

(Core :: DOM: Bindings (WebIDL), defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(3 files)

Right now, CopyableErrorResult will cast to ErrorResult&, which means someone could throw a JS exception on it, which is not desirable. We should be able to prevent this.

We need the explicit constructor because otherwise which conversion operator to
use when constructing an ErrorResult from a CopyableErrorResult&& is
ambiguous. And we want the conversion operator to allow passing
CopyableErrorResult& to functions that expect ErrorResult&&.

The rejection process consumes the ErrorResult, so an rvalue reference is the honest thing here.

This keeps us from passing it to functions that are planning to throw on the
ErrorResult and might throw a JS exception on it.

Blocks: 1615035
Priority: -- → P1
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8592b157cb28
part 1. Allow move-constructing ErrorResult from CopyableErrorResult. r=farre
https://hg.mozilla.org/integration/autoland/rev/43951ee85845
part 2.  Require an rvalue reference to reject a Promise with an ErrorResult. r=farre,kvark
https://hg.mozilla.org/integration/autoland/rev/5d563581134e
part 3.  Disallow conversion of CopyableErrorResult to ErrorResult&. r=farre
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: