mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-05 02:52:39 +08:00
Avoid useless function check in executeFunctionWithOwner and useless js parameter construction in websocket
This commit is contained in:
@@ -1670,24 +1670,25 @@ bool ScriptingCore::executeFunctionWithOwner(JS::HandleValue owner, const char *
|
||||
JS::RootedValue ownerval(cx, owner);
|
||||
JS::RootedObject obj(cx);
|
||||
if (ownerval.isObject())
|
||||
obj = ownerval.toObjectOrNull();
|
||||
|
||||
do
|
||||
{
|
||||
if (JS_HasProperty(cx, obj, name, &hasFunc) && hasFunc) {
|
||||
if (!JS_GetProperty(cx, obj, name, &funcVal)) {
|
||||
break;
|
||||
obj = ownerval.toObjectOrNull();
|
||||
do
|
||||
{
|
||||
if (JS_HasProperty(cx, obj, name, &hasFunc) && hasFunc) {
|
||||
if (!JS_GetProperty(cx, obj, name, &funcVal)) {
|
||||
break;
|
||||
}
|
||||
if (funcVal.isNullOrUndefined()) {
|
||||
break;
|
||||
}
|
||||
|
||||
bRet = JS_CallFunctionValue(cx, obj, funcVal, args, retVal);
|
||||
if (JS_IsExceptionPending(cx)) {
|
||||
handlePendingException(cx);
|
||||
}
|
||||
}
|
||||
if (funcVal.isNullOrUndefined()) {
|
||||
break;
|
||||
}
|
||||
|
||||
bRet = JS_CallFunctionValue(cx, obj, funcVal, args, retVal);
|
||||
if (JS_IsExceptionPending(cx)) {
|
||||
handlePendingException(cx);
|
||||
}
|
||||
}
|
||||
}while(0);
|
||||
} while(0);
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user