mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1225219 Implement ErrorResult::CloneTo(). r=bz
This commit is contained in:
parent
beb1adfcb0
commit
051c84e08a
@ -466,6 +466,38 @@ ErrorResult::operator=(ErrorResult&& aRHS)
|
||||
return *this;
|
||||
}
|
||||
|
||||
void
|
||||
ErrorResult::CloneTo(ErrorResult& aRv) const
|
||||
{
|
||||
aRv.ClearUnionData();
|
||||
aRv.mResult = mResult;
|
||||
#ifdef DEBUG
|
||||
aRv.mMightHaveUnreportedJSException = mMightHaveUnreportedJSException;
|
||||
#endif
|
||||
|
||||
if (IsErrorWithMessage()) {
|
||||
#ifdef DEBUG
|
||||
aRv.mUnionState = HasMessage;
|
||||
#endif
|
||||
aRv.mMessage = new Message();
|
||||
aRv.mMessage->mArgs = mMessage->mArgs;
|
||||
aRv.mMessage->mErrorNumber = mMessage->mErrorNumber;
|
||||
} else if (IsDOMException()) {
|
||||
#ifdef DEBUG
|
||||
aRv.mUnionState = HasDOMExceptionInfo;
|
||||
#endif
|
||||
aRv.mDOMExceptionInfo = new DOMExceptionInfo(mDOMExceptionInfo->mRv,
|
||||
mDOMExceptionInfo->mMessage);
|
||||
} else if (IsJSException()) {
|
||||
#ifdef DEBUG
|
||||
aRv.mUnionState = HasJSException;
|
||||
#endif
|
||||
JSContext* cx = nsContentUtils::RootingCxForThread();
|
||||
JS::Rooted<JS::Value> exception(cx, mJSException);
|
||||
aRv.ThrowJSException(cx, exception);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ErrorResult::SuppressException()
|
||||
{
|
||||
|
@ -115,6 +115,11 @@ public:
|
||||
AssignErrorCode(rv);
|
||||
}
|
||||
|
||||
// Duplicate our current state on the given ErrorResult object. Any existing
|
||||
// errors or messages on the target will be suppressed before cloning. Our
|
||||
// own error state remains unchanged.
|
||||
void CloneTo(ErrorResult& aRv) const;
|
||||
|
||||
// Use SuppressException when you want to suppress any exception that might be
|
||||
// on the ErrorResult. After this call, the ErrorResult will be back a "no
|
||||
// exception thrown" state.
|
||||
|
Loading…
Reference in New Issue
Block a user