mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-27 09:37:31 +09:00
Bug 1411415.
This commit is contained in:
parent
8ffcc15d3f
commit
66bf4fa8f9
10 changed files with 91 additions and 33 deletions
|
|
@ -259,8 +259,8 @@ TErrorResult<CleanupPolicy>::ThrowJSException(JSContext* cx, JS::Handle<JS::Valu
|
|||
// Make sure mJSException is initialized _before_ we try to root it. But
|
||||
// don't set it to exn yet, because we don't want to do that until after we
|
||||
// root.
|
||||
mJSException.setUndefined();
|
||||
if (!js::AddRawValueRoot(cx, &mJSException, "TErrorResult::mJSException")) {
|
||||
mJSException.asValueRef().setUndefined();
|
||||
if (!js::AddRawValueRoot(cx, &mJSException.asValueRef(), "TErrorResult::mJSException")) {
|
||||
// Don't use NS_ERROR_DOM_JS_EXCEPTION, because that indicates we have
|
||||
// in fact rooted mJSException.
|
||||
mResult = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
@ -289,7 +289,7 @@ TErrorResult<CleanupPolicy>::SetPendingJSException(JSContext* cx)
|
|||
mJSException = exception;
|
||||
// If JS_WrapValue failed, not much we can do about it... No matter
|
||||
// what, go ahead and unroot mJSException.
|
||||
js::RemoveRawValueRoot(cx, &mJSException);
|
||||
js::RemoveRawValueRoot(cx, &mJSException.asValueRef());
|
||||
|
||||
mResult = NS_OK;
|
||||
#ifdef DEBUG
|
||||
|
|
@ -395,8 +395,8 @@ TErrorResult<CleanupPolicy>::ClearUnionData()
|
|||
if (IsJSException()) {
|
||||
JSContext* cx = dom::danger::GetJSContext();
|
||||
MOZ_ASSERT(cx);
|
||||
mJSException.setUndefined();
|
||||
js::RemoveRawValueRoot(cx, &mJSException);
|
||||
mJSException.asValueRef().setUndefined();
|
||||
js::RemoveRawValueRoot(cx, &mJSException.asValueRef());
|
||||
#ifdef DEBUG
|
||||
mUnionState = HasNothing;
|
||||
#endif // DEBUG
|
||||
|
|
@ -439,13 +439,13 @@ TErrorResult<CleanupPolicy>::operator=(TErrorResult<CleanupPolicy>&& aRHS)
|
|||
} else if (aRHS.IsJSException()) {
|
||||
JSContext* cx = dom::danger::GetJSContext();
|
||||
MOZ_ASSERT(cx);
|
||||
mJSException.setUndefined();
|
||||
if (!js::AddRawValueRoot(cx, &mJSException, "TErrorResult::mJSException")) {
|
||||
mJSException.asValueRef().setUndefined();
|
||||
if (!js::AddRawValueRoot(cx, &mJSException.asValueRef(), "TErrorResult::mJSException")) {
|
||||
MOZ_CRASH("Could not root mJSException, we're about to OOM");
|
||||
}
|
||||
mJSException = aRHS.mJSException;
|
||||
aRHS.mJSException.setUndefined();
|
||||
js::RemoveRawValueRoot(cx, &aRHS.mJSException);
|
||||
aRHS.mJSException.asValueRef().setUndefined();
|
||||
js::RemoveRawValueRoot(cx, &aRHS.mJSException.asValueRef());
|
||||
} else if (aRHS.IsDOMException()) {
|
||||
mDOMExceptionInfo = aRHS.mDOMExceptionInfo;
|
||||
aRHS.mDOMExceptionInfo = nullptr;
|
||||
|
|
@ -497,7 +497,7 @@ TErrorResult<CleanupPolicy>::CloneTo(TErrorResult& aRv) const
|
|||
aRv.mUnionState = HasJSException;
|
||||
#endif
|
||||
JSContext* cx = dom::danger::GetJSContext();
|
||||
JS::Rooted<JS::Value> exception(cx, mJSException);
|
||||
JS::Rooted<JS::Value> exception(cx, mJSException.asValueRef());
|
||||
aRv.ThrowJSException(cx, exception);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue