mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 856410 - Implement futures - Part 0: ErrorResult::StealJSException. r=bz
This commit is contained in:
parent
21b3447e37
commit
5bd0488290
@ -160,6 +160,19 @@ ErrorResult::ReportJSException(JSContext* cx)
|
||||
JS_RemoveValueRoot(cx, &mJSException);
|
||||
}
|
||||
|
||||
void
|
||||
ErrorResult::StealJSException(JSContext* cx,
|
||||
JS::MutableHandle<JS::Value> value)
|
||||
{
|
||||
MOZ_ASSERT(!mMightHaveUnreportedJSException,
|
||||
"Must call WouldReportJSException unconditionally in all codepaths that might call StealJSException");
|
||||
MOZ_ASSERT(IsJSException(), "No exception to steal");
|
||||
|
||||
value.set(mJSException);
|
||||
JS_RemoveValueRoot(cx, &mJSException);
|
||||
mResult = NS_OK;
|
||||
}
|
||||
|
||||
namespace dom {
|
||||
|
||||
bool
|
||||
|
@ -64,11 +64,18 @@ public:
|
||||
// Facilities for throwing a preexisting JS exception value via this
|
||||
// ErrorResult. The contract is that any code which might end up calling
|
||||
// ThrowJSException() must call MightThrowJSException() even if no exception
|
||||
// is being thrown. Code that would call ReportJSException as needed must
|
||||
// first call WouldReportJSException even if this ErrorResult has not failed.
|
||||
// is being thrown. Code that would call ReportJSException or
|
||||
// StealJSException as needed must first call WouldReportJSException even if
|
||||
// this ErrorResult has not failed.
|
||||
void ThrowJSException(JSContext* cx, JS::Handle<JS::Value> exn);
|
||||
void ReportJSException(JSContext* cx);
|
||||
bool IsJSException() const { return ErrorCode() == NS_ERROR_DOM_JS_EXCEPTION; }
|
||||
|
||||
// StealJSException steals the JS Exception from the object. This method must
|
||||
// be called only if IsJSException() returns true. This method also resets the
|
||||
// ErrorCode() to NS_OK.
|
||||
void StealJSException(JSContext* cx, JS::MutableHandle<JS::Value> value);
|
||||
|
||||
void MOZ_ALWAYS_INLINE MightThrowJSException()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user