mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 1626100 - Replace SetPendingExceptionAndStack with a ExceptionStack version. r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D69667 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
b94a359d66
commit
763682c095
@ -214,8 +214,7 @@ void WorkletNodeEngine::SendProcessorError(AudioNodeTrack* aTrack,
|
||||
SendErrorToMainThread(aTrack, details);
|
||||
// Set the exception and stack back to have it in the console with a stack
|
||||
// trace.
|
||||
JS::SetPendingExceptionAndStack(aCx, exnStack.exception(),
|
||||
exnStack.stack());
|
||||
JS::SetPendingExceptionStack(aCx, exnStack);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -234,8 +233,7 @@ void WorkletNodeEngine::SendProcessorError(AudioNodeTrack* aTrack,
|
||||
|
||||
// Set the exception and stack back to have it in the console with a stack
|
||||
// trace.
|
||||
JS::SetPendingExceptionAndStack(aCx, exnStack.exception(),
|
||||
exnStack.stack());
|
||||
JS::SetPendingExceptionStack(aCx, exnStack);
|
||||
} else {
|
||||
NS_WARNING("No exception, but processor errored out?");
|
||||
}
|
||||
|
@ -527,8 +527,7 @@ void AutoJSAPI::ReportException() {
|
||||
// because it may want to put it in its error events and has no other way
|
||||
// to get hold of it. After we invoke ReportError, clear the exception on
|
||||
// cx(), just in case ReportError didn't.
|
||||
JS::SetPendingExceptionAndStack(cx(), exnStack.exception(),
|
||||
exnStack.stack());
|
||||
JS::SetPendingExceptionStack(cx(), exnStack);
|
||||
ccjscx->ReportError(jsReport.report(), jsReport.toStringResult());
|
||||
ClearException();
|
||||
}
|
||||
|
@ -59,6 +59,11 @@ extern JS_PUBLIC_API bool GetPendingExceptionStack(
|
||||
extern JS_PUBLIC_API bool StealPendingExceptionStack(
|
||||
JSContext* cx, JS::ExceptionStack* exceptionStack);
|
||||
|
||||
// Set both the exception value and its associated stack on the context as
|
||||
// the current pending exception.
|
||||
extern JS_PUBLIC_API void SetPendingExceptionStack(
|
||||
JSContext* cx, const JS::ExceptionStack& exceptionStack);
|
||||
|
||||
} // namespace JS
|
||||
|
||||
#endif // js_Exception_h
|
||||
|
@ -4938,24 +4938,6 @@ JS_PUBLIC_API void JS_ClearPendingException(JSContext* cx) {
|
||||
cx->clearPendingException();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API void JS::SetPendingExceptionAndStack(JSContext* cx,
|
||||
HandleValue value,
|
||||
HandleObject stack) {
|
||||
AssertHeapIsIdle();
|
||||
CHECK_THREAD(cx);
|
||||
// We don't check the compartments of `value` and `stack` here,
|
||||
// because we're not doing anything with them other than storing
|
||||
// them, and stored exception values can be in an abitrary
|
||||
// compartment while stored stack values are always the unwrapped
|
||||
// object anyway.
|
||||
|
||||
RootedSavedFrame nstack(cx);
|
||||
if (stack) {
|
||||
nstack = &UncheckedUnwrap(stack)->as<SavedFrame>();
|
||||
}
|
||||
cx->setPendingException(value, nstack);
|
||||
}
|
||||
|
||||
JS::AutoSaveExceptionState::AutoSaveExceptionState(JSContext* cx)
|
||||
: context(cx),
|
||||
wasPropagatingForcedReturn(cx->propagatingForcedReturn_),
|
||||
|
@ -2647,10 +2647,6 @@ class JS_PUBLIC_API AutoSaveExceptionState {
|
||||
void restore();
|
||||
};
|
||||
|
||||
// Set both the exception and its associated stack on the context. The stack
|
||||
// must be a SavedFrame.
|
||||
JS_PUBLIC_API void SetPendingExceptionAndStack(JSContext* cx, HandleValue value,
|
||||
HandleObject stack);
|
||||
} /* namespace JS */
|
||||
|
||||
/**
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "jsapi.h" // AssertHeapIsIdle
|
||||
#include "vm/JSContext.h"
|
||||
#include "vm/SavedFrame.h"
|
||||
|
||||
using namespace js;
|
||||
|
||||
@ -39,3 +40,21 @@ bool JS::GetPendingExceptionStack(JSContext* cx,
|
||||
exceptionStack->init(exception, stack);
|
||||
return true;
|
||||
}
|
||||
|
||||
void JS::SetPendingExceptionStack(JSContext* cx,
|
||||
const JS::ExceptionStack& exceptionStack) {
|
||||
AssertHeapIsIdle();
|
||||
CHECK_THREAD(cx);
|
||||
|
||||
// We don't check the compartments of `exception` and `stack` here,
|
||||
// because we're not doing anything with them other than storing
|
||||
// them, and stored exception values can be in an abitrary
|
||||
// compartment while stored stack values are always the unwrapped
|
||||
// object anyway.
|
||||
|
||||
RootedSavedFrame nstack(cx);
|
||||
if (exceptionStack.stack()) {
|
||||
nstack = &UncheckedUnwrap(exceptionStack.stack())->as<SavedFrame>();
|
||||
}
|
||||
cx->setPendingException(exceptionStack.exception(), nstack);
|
||||
}
|
||||
|
@ -305,8 +305,7 @@ static void MaybeSanitizeException(JSContext* cx,
|
||||
{ // Scope for AutoJSAPI
|
||||
AutoJSAPI jsapi;
|
||||
if (jsapi.Init(unwrappedFun)) {
|
||||
JS::SetPendingExceptionAndStack(cx, exnStack.exception(),
|
||||
exnStack.stack());
|
||||
JS::SetPendingExceptionStack(cx, exnStack);
|
||||
}
|
||||
// If Init() fails, we can't report the exception, but oh, well.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user