mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix bug 554449. r=jst sr=peterv
This commit is contained in:
parent
1051194298
commit
e11777b779
@ -1324,6 +1324,31 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex,
|
||||
xpcc->SetException(nsnull);
|
||||
ccx.GetThreadData()->SetException(nsnull);
|
||||
|
||||
if(XPCPerThreadData::IsMainThread(ccx))
|
||||
{
|
||||
ssm = XPCWrapper::GetSecurityManager();
|
||||
if(ssm)
|
||||
{
|
||||
nsCOMPtr<nsIPrincipal> objPrincipal;
|
||||
ssm->GetObjectPrincipal(ccx, obj, getter_AddRefs(objPrincipal));
|
||||
if(objPrincipal)
|
||||
{
|
||||
JSStackFrame* fp = nsnull;
|
||||
nsresult rv =
|
||||
ssm->PushContextPrincipal(ccx, JS_FrameIterator(ccx, &fp),
|
||||
objPrincipal);
|
||||
if(NS_FAILED(rv))
|
||||
{
|
||||
JS_ReportOutOfMemory(ccx);
|
||||
retval = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto pre_call_clean_up;
|
||||
}
|
||||
|
||||
popPrincipal = JS_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We use js_AllocStack, js_Invoke, and js_FreeStack so that the gcthings
|
||||
// we use as args will be rooted by the engine as we do conversions and
|
||||
// prepare to do the function call. This adds a fair amount of complexity,
|
||||
@ -1660,31 +1685,6 @@ pre_call_clean_up:
|
||||
|
||||
JS_ClearPendingException(cx);
|
||||
|
||||
if(XPCPerThreadData::IsMainThread(ccx))
|
||||
{
|
||||
ssm = XPCWrapper::GetSecurityManager();
|
||||
if(ssm)
|
||||
{
|
||||
nsCOMPtr<nsIPrincipal> objPrincipal;
|
||||
ssm->GetObjectPrincipal(ccx, obj, getter_AddRefs(objPrincipal));
|
||||
if(objPrincipal)
|
||||
{
|
||||
JSStackFrame* fp = nsnull;
|
||||
nsresult rv =
|
||||
ssm->PushContextPrincipal(ccx, JS_FrameIterator(ccx, &fp),
|
||||
objPrincipal);
|
||||
if(NS_FAILED(rv))
|
||||
{
|
||||
JS_ReportOutOfMemory(ccx);
|
||||
retval = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto done;
|
||||
}
|
||||
|
||||
popPrincipal = JS_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(XPT_MD_IS_GETTER(info->flags))
|
||||
success = JS_GetProperty(cx, obj, name, &result);
|
||||
else if(XPT_MD_IS_SETTER(info->flags))
|
||||
@ -1721,9 +1721,6 @@ pre_call_clean_up:
|
||||
}
|
||||
}
|
||||
|
||||
if(popPrincipal)
|
||||
ssm->PopContextPrincipal(ccx);
|
||||
|
||||
if(!success)
|
||||
{
|
||||
PRBool forceReport;
|
||||
@ -1939,6 +1936,9 @@ done:
|
||||
if(sp)
|
||||
js_FreeStack(cx, mark);
|
||||
|
||||
if(popPrincipal)
|
||||
ssm->PopContextPrincipal(ccx);
|
||||
|
||||
#ifdef DEBUG_stats_jband
|
||||
endTime = PR_IntervalNow();
|
||||
printf("%s::%s %d ( c->js ) \n", GetInterfaceName(), info->GetName(), PR_IntervalToMilliseconds(endTime-startTime));
|
||||
|
Loading…
Reference in New Issue
Block a user