summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_value.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs/cfxjse_value.cpp')
-rw-r--r--fxjs/cfxjse_value.cpp73
1 files changed, 0 insertions, 73 deletions
diff --git a/fxjs/cfxjse_value.cpp b/fxjs/cfxjse_value.cpp
index 0a135951d9..f5bdd54653 100644
--- a/fxjs/cfxjse_value.cpp
+++ b/fxjs/cfxjse_value.cpp
@@ -261,79 +261,6 @@ bool CFXJSE_Value::SetFunctionBind(CFXJSE_Value* lpOldFunction,
return true;
}
-#define FXJSE_INVALID_PTR ((void*)(intptr_t)-1)
-bool CFXJSE_Value::Call(CFXJSE_Value* lpReceiver,
- CFXJSE_Value* lpRetValue,
- uint32_t nArgCount,
- CFXJSE_Value** lpArgs) {
- CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
- v8::Local<v8::Value> hFunctionValue =
- v8::Local<v8::Value>::New(m_pIsolate, DirectGetValue());
- v8::Local<v8::Object> hFunctionObject =
- !hFunctionValue.IsEmpty() && hFunctionValue->IsObject()
- ? hFunctionValue.As<v8::Object>()
- : v8::Local<v8::Object>();
-
- v8::TryCatch trycatch(m_pIsolate);
- if (hFunctionObject.IsEmpty() || !hFunctionObject->IsCallable()) {
- if (lpRetValue)
- lpRetValue->ForceSetValue(FXJSE_CreateReturnValue(m_pIsolate, trycatch));
- return false;
- }
-
- v8::Local<v8::Value> hReturnValue;
- v8::Local<v8::Value>* lpLocalArgs = NULL;
- if (nArgCount) {
- lpLocalArgs = FX_Alloc(v8::Local<v8::Value>, nArgCount);
- for (uint32_t i = 0; i < nArgCount; i++) {
- new (lpLocalArgs + i) v8::Local<v8::Value>;
- CFXJSE_Value* lpArg = lpArgs[i];
- if (lpArg) {
- lpLocalArgs[i] =
- v8::Local<v8::Value>::New(m_pIsolate, lpArg->DirectGetValue());
- }
- if (lpLocalArgs[i].IsEmpty()) {
- lpLocalArgs[i] = v8::Undefined(m_pIsolate);
- }
- }
- }
-
- bool bRetValue = true;
- if (lpReceiver == FXJSE_INVALID_PTR) {
- v8::MaybeLocal<v8::Value> maybe_retvalue =
- hFunctionObject->CallAsConstructor(m_pIsolate->GetCurrentContext(),
- nArgCount, lpLocalArgs);
- hReturnValue = maybe_retvalue.FromMaybe(v8::Local<v8::Value>());
- } else {
- v8::Local<v8::Value> hReceiver;
- if (lpReceiver) {
- hReceiver =
- v8::Local<v8::Value>::New(m_pIsolate, lpReceiver->DirectGetValue());
- }
- if (hReceiver.IsEmpty() || !hReceiver->IsObject())
- hReceiver = v8::Object::New(m_pIsolate);
-
- v8::MaybeLocal<v8::Value> maybe_retvalue = hFunctionObject->CallAsFunction(
- m_pIsolate->GetCurrentContext(), hReceiver, nArgCount, lpLocalArgs);
- hReturnValue = maybe_retvalue.FromMaybe(v8::Local<v8::Value>());
- }
-
- if (trycatch.HasCaught()) {
- hReturnValue = FXJSE_CreateReturnValue(m_pIsolate, trycatch);
- bRetValue = false;
- }
-
- if (lpRetValue)
- lpRetValue->ForceSetValue(hReturnValue);
-
- if (lpLocalArgs) {
- for (uint32_t i = 0; i < nArgCount; i++)
- lpLocalArgs[i].~Local();
- FX_Free(lpLocalArgs);
- }
- return bRetValue;
-}
-
bool CFXJSE_Value::IsUndefined() const {
if (m_hValue.IsEmpty())
return false;