This commit is contained in:
lvfulong
2021-03-22 19:32:28 +08:00
parent e32ab4cd9f
commit 1f6af9ab2a
30 changed files with 137 additions and 54 deletions
@@ -104,20 +104,27 @@ namespace laya
JSStringRef jsLinePropertyName = JSStringCreateWithUTF8CString("line");
JSStringRef jsColumnPropertyName = JSStringCreateWithUTF8CString("column");
JSStringRef jsUrlPropertyName = JSStringCreateWithUTF8CString("sourceURL");
JSStringRef jsStackPropertyName = JSStringCreateWithUTF8CString("stack");
JSObjectRef exObject = JSValueToObject( pContext, exception, NULL );
JSValueRef line = JSObjectGetProperty( pContext, exObject, jsLinePropertyName, NULL );
JSValueRef column = JSObjectGetProperty( pContext, exObject, jsColumnPropertyName, NULL );
JSValueRef url = JSObjectGetProperty( pContext, exObject, jsUrlPropertyName, NULL );
JSValueRef stack = JSObjectGetProperty( pContext, exObject, jsStackPropertyName, NULL );
char *pEx = __ToCppString(exception,pContext);
char *pLine = __ToCppString(line,pContext);
char *pColumn = __ToCppString(column,pContext);
char *pUrl = __ToCppString(url,pContext);
if (stack != NULL && JSValueGetType(pContext, stack) == kJSTypeString)
{
pStack = __ToCppString(stack,pContext);
}
//通知全局错误处理脚本
std::string kBuf = "if(conch.onerror){conch.onerror('";
kBuf += UrlEncode(pEx);
kBuf += "','undefined','";
kBuf += "','";
kBuf += UrlEncode(pStack.c_str());
kBuf += "','";
kBuf += UrlEncode(pLine);
kBuf += "','";
kBuf += UrlEncode(pColumn);
@@ -142,6 +149,7 @@ namespace laya
JSStringRelease(jsLinePropertyName);
JSStringRelease(jsColumnPropertyName);
JSStringRelease(jsUrlPropertyName);
JSStringRelease(jsStackPropertyName);
}
}