Loading js/src/xpconnect/src/xpcwrappedjsclass.cpp +28 −28 Original line number Diff line number Diff line Loading @@ -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, Loading Loading @@ -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)) Loading Loading @@ -1721,9 +1721,6 @@ pre_call_clean_up: } } if(popPrincipal) ssm->PopContextPrincipal(ccx); if(!success) { PRBool forceReport; Loading Loading @@ -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 Loading
js/src/xpconnect/src/xpcwrappedjsclass.cpp +28 −28 Original line number Diff line number Diff line Loading @@ -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, Loading Loading @@ -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)) Loading Loading @@ -1721,9 +1721,6 @@ pre_call_clean_up: } } if(popPrincipal) ssm->PopContextPrincipal(ccx); if(!success) { PRBool forceReport; Loading Loading @@ -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