diff options
author | dan sinclair <dsinclair@chromium.org> | 2017-12-04 15:42:36 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-12-04 15:42:36 +0000 |
commit | f2d7656f335cf38dfafb97370ffac38b9d4e3fc0 (patch) | |
tree | a25d698c3ef75fedba78cc42c9c01195dc352720 /fxjs/cfxjse_value.cpp | |
parent | 53190d99102c9b3a5e0a8751e2f4f957d7736ccf (diff) | |
download | pdfium-f2d7656f335cf38dfafb97370ffac38b9d4e3fc0.tar.xz |
XFA JS method cleanup
Change-Id: I182388970e422bd31d011628a4f1b905d12b0da0
Reviewed-on: https://pdfium-review.googlesource.com/20193
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/cfxjse_value.cpp')
-rw-r--r-- | fxjs/cfxjse_value.cpp | 73 |
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; |