зеркало из https://github.com/mozilla/gecko-dev.git
Bug 457310 - Don't potentially run code with an exception still on cx. r+sr=jst
This commit is contained in:
Родитель
f1c3c0f46e
Коммит
2f53c5e0d7
|
@ -931,13 +931,15 @@ class JSAutoTempValueRooter
|
|||
JS_POP_TEMP_ROOT(mContext, &mTvr);
|
||||
}
|
||||
|
||||
protected:
|
||||
JSContext *mContext;
|
||||
|
||||
private:
|
||||
#ifndef AIX
|
||||
static void *operator new(size_t);
|
||||
static void operator delete(void *, size_t);
|
||||
#endif
|
||||
|
||||
JSContext *mContext;
|
||||
JSTempValueRooter mTvr;
|
||||
};
|
||||
|
||||
|
|
|
@ -1397,6 +1397,25 @@ XPCConvert::ConstructException(nsresult rv, const char* message,
|
|||
|
||||
/********************************/
|
||||
|
||||
class AutoExceptionRestorer : public JSAutoTempValueRooter
|
||||
{
|
||||
public:
|
||||
AutoExceptionRestorer(JSContext *cx, jsval v)
|
||||
: JSAutoTempValueRooter(cx, v),
|
||||
mVal(v)
|
||||
{
|
||||
JS_ClearPendingException(mContext);
|
||||
}
|
||||
|
||||
~AutoExceptionRestorer()
|
||||
{
|
||||
JS_SetPendingException(mContext, mVal);
|
||||
}
|
||||
|
||||
private:
|
||||
jsval mVal;
|
||||
};
|
||||
|
||||
// static
|
||||
nsresult
|
||||
XPCConvert::JSValToXPCException(XPCCallContext& ccx,
|
||||
|
@ -1406,6 +1425,7 @@ XPCConvert::JSValToXPCException(XPCCallContext& ccx,
|
|||
nsIException** exceptn)
|
||||
{
|
||||
JSContext* cx = ccx.GetJSContext();
|
||||
AutoExceptionRestorer aer(cx, s);
|
||||
|
||||
if(!JSVAL_IS_PRIMITIVE(s))
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче