mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-06 00:10:25 +00:00
Bug 1257919 part 9. Make the asyncCause/asyncCaller getters on JSStackFrame take an explicit JSContext. r=khuey
This commit is contained in:
parent
42b3bbe27a
commit
dde5cae5bb
@ -1057,7 +1057,7 @@ StackFrameToStackEntry(JSContext* aCx, nsIStackFrame* aStackFrame,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsString cause;
|
||||
rv = aStackFrame->GetAsyncCause(cause);
|
||||
rv = aStackFrame->GetAsyncCause(aCx, cause);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!cause.IsEmpty()) {
|
||||
aStackEntry.mAsyncCause.Construct(cause);
|
||||
@ -1084,7 +1084,7 @@ ReifyStack(JSContext* aCx, nsIStackFrame* aStack,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!caller) {
|
||||
rv = stack->GetAsyncCaller(getter_AddRefs(caller));
|
||||
rv = stack->GetAsyncCaller(aCx, getter_AddRefs(caller));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
stack.swap(caller);
|
||||
|
@ -474,17 +474,17 @@ NS_IMETHODIMP JSStackFrame::GetSourceLine(nsACString& aSourceLine)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JSStackFrame::GetAsyncCause(nsAString& aAsyncCause)
|
||||
NS_IMETHODIMP JSStackFrame::GetAsyncCause(JSContext* aCx,
|
||||
nsAString& aAsyncCause)
|
||||
{
|
||||
if (!mStack) {
|
||||
aAsyncCause.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
ThreadsafeAutoJSContext cx;
|
||||
JS::Rooted<JSString*> asyncCause(cx);
|
||||
JS::Rooted<JSString*> asyncCause(aCx);
|
||||
bool canCache = false, useCachedValue = false;
|
||||
GetValueIfNotCached(cx, mStack, JS::GetSavedFrameAsyncCause,
|
||||
GetValueIfNotCached(aCx, mStack, JS::GetSavedFrameAsyncCause,
|
||||
mAsyncCauseInitialized, &canCache, &useCachedValue,
|
||||
&asyncCause);
|
||||
|
||||
@ -495,8 +495,8 @@ NS_IMETHODIMP JSStackFrame::GetAsyncCause(nsAString& aAsyncCause)
|
||||
|
||||
if (asyncCause) {
|
||||
nsAutoJSString str;
|
||||
if (!str.init(cx, asyncCause)) {
|
||||
JS_ClearPendingException(cx);
|
||||
if (!str.init(aCx, asyncCause)) {
|
||||
JS_ClearPendingException(aCx);
|
||||
aAsyncCause.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
@ -513,17 +513,17 @@ NS_IMETHODIMP JSStackFrame::GetAsyncCause(nsAString& aAsyncCause)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JSStackFrame::GetAsyncCaller(nsIStackFrame** aAsyncCaller)
|
||||
NS_IMETHODIMP JSStackFrame::GetAsyncCaller(JSContext* aCx,
|
||||
nsIStackFrame** aAsyncCaller)
|
||||
{
|
||||
if (!mStack) {
|
||||
*aAsyncCaller = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
ThreadsafeAutoJSContext cx;
|
||||
JS::Rooted<JSObject*> asyncCallerObj(cx);
|
||||
JS::Rooted<JSObject*> asyncCallerObj(aCx);
|
||||
bool canCache = false, useCachedValue = false;
|
||||
GetValueIfNotCached(cx, mStack, JS::GetSavedFrameAsyncParent,
|
||||
GetValueIfNotCached(aCx, mStack, JS::GetSavedFrameAsyncParent,
|
||||
mAsyncCallerInitialized, &canCache, &useCachedValue,
|
||||
&asyncCallerObj);
|
||||
|
||||
|
@ -26,7 +26,9 @@ interface nsIStackFrame : nsISupports
|
||||
[implicit_jscontext]
|
||||
readonly attribute int32_t columnNumber;
|
||||
readonly attribute AUTF8String sourceLine;
|
||||
[implicit_jscontext]
|
||||
readonly attribute AString asyncCause;
|
||||
[implicit_jscontext]
|
||||
readonly attribute nsIStackFrame asyncCaller;
|
||||
readonly attribute nsIStackFrame caller;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user