Unregress 1.73's breakage of NS_COMFALSE return from a JS method (287107, r=dbradley, sr=jst).

This commit is contained in:
brendan%mozilla.org 2005-03-23 02:39:47 +00:00
Родитель 77a64a3976
Коммит a48523b662
3 изменённых файлов: 21 добавлений и 10 удалений

Просмотреть файл

@ -486,9 +486,15 @@ pre_call_clean_up:
JS_smprintf_free(sz);
}
// Get this right away in case we do something below to cause JS code
// to run on this JSContext. And get it whether success or not so that
// scriptable methods that must return NS_COMFALSE or another non-NS_OK
// success code can do so when implemented by JS.
pending_result = xpcc->GetPendingResult();
if (!success)
{
retval = nsXPCWrappedJSClass::CheckForException(ccx, name.get(), "IDispatch");
retval = nsXPCWrappedJSClass::CheckForException(ccx, name.get(), "IDispatch", pending_result);
goto done;
}

Просмотреть файл

@ -2054,7 +2054,8 @@ public:
static nsresult CheckForException(XPCCallContext & ccx,
const char * aPropertyName,
const char * anInterfaceName);
const char * anInterfaceName,
nsresult aPendingResult);
private:
nsXPCWrappedJSClass(); // not implemented
nsXPCWrappedJSClass(XPCCallContext& ccx, REFNSIID aIID,

Просмотреть файл

@ -802,7 +802,8 @@ nsXPCWrappedJSClass::CleanupPointerTypeObject(const nsXPTType& type,
nsresult
nsXPCWrappedJSClass::CheckForException(XPCCallContext & ccx,
const char * aPropertyName,
const char * anInterfaceName)
const char * anInterfaceName,
nsresult aPendingResult)
{
XPCContext * xpcc = ccx.GetXPCContext();
JSContext * cx = ccx.GetJSContext();
@ -813,10 +814,6 @@ nsXPCWrappedJSClass::CheckForException(XPCCallContext & ccx,
if(xpc_exception)
xpcc->SetException(nsnull);
// get this right away in case we do something below to cause JS code
// to run on this JSContext
nsresult pending_result = xpcc->GetPendingResult();
jsval js_exception;
/* JS might throw an expection whether the reporter was called or not */
if(JS_GetPendingException(cx, &js_exception))
@ -934,9 +931,9 @@ nsXPCWrappedJSClass::CheckForException(XPCCallContext & ccx,
else
{
// see if JS code signaled failure result without throwing exception
if(NS_FAILED(pending_result))
if(NS_FAILED(aPendingResult))
{
return pending_result;
return aPendingResult;
}
}
return NS_ERROR_FAILURE;
@ -1368,9 +1365,16 @@ pre_call_clean_up:
}
}
// Get this right away in case we do something below to cause JS code
// to run on this JSContext. And get it whether success or not so that
// scriptable methods that must return NS_COMFALSE or another non-NS_OK
// success code can do so when implemented by JS.
pending_result = xpcc->GetPendingResult();
if (!success)
{
retval = CheckForException(ccx, name, GetInterfaceName());
retval = CheckForException(ccx, name, GetInterfaceName(),
pending_result);
goto done;
}