зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1248948 - Don't pass non-SavedFrame objects to SavedFrame JSAPI functions; r=tromey r=evilpie
This commit is contained in:
Родитель
e725884022
Коммит
01cfd1d6c6
|
@ -62,7 +62,8 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
if (!JS::CopyAsyncStack(aCx, asyncStack, asyncCause, &parentFrame, 0)) {
|
||||
if (JS::IsSavedFrame(asyncStack) &&
|
||||
!JS::CopyAsyncStack(aCx, asyncStack, asyncCause, &parentFrame, 0)) {
|
||||
JS_ClearPendingException(aCx);
|
||||
} else {
|
||||
stackFrame.mAsyncParent = parentFrame;
|
||||
|
|
|
@ -5996,6 +5996,13 @@ GetSavedFrameParent(JSContext* cx, HandleObject savedFrame, MutableHandleObject
|
|||
extern JS_PUBLIC_API(bool)
|
||||
BuildStackString(JSContext* cx, HandleObject stack, MutableHandleString stringp, size_t indent = 0);
|
||||
|
||||
/**
|
||||
* Return true iff the given object is either a SavedFrame object or wrapper
|
||||
* around a SavedFrame object, and it is not the SavedFrame.prototype object.
|
||||
*/
|
||||
extern JS_PUBLIC_API(bool)
|
||||
IsSavedFrame(JSObject* obj);
|
||||
|
||||
} /* namespace JS */
|
||||
|
||||
|
||||
|
|
|
@ -930,6 +930,19 @@ BuildStackString(JSContext* cx, HandleObject stack, MutableHandleString stringp,
|
|||
return true;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
IsSavedFrame(JSObject* obj)
|
||||
{
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
JSObject* unwrapped = CheckedUnwrap(obj);
|
||||
if (!unwrapped)
|
||||
return false;
|
||||
|
||||
return js::SavedFrame::isSavedFrameAndNotProto(*unwrapped);
|
||||
}
|
||||
|
||||
} /* namespace JS */
|
||||
|
||||
namespace js {
|
||||
|
|
Загрузка…
Ссылка в новой задаче