Remove CFXJSE_Arguments.
Abstracting V8 doesn't buy very much and has a readability burden.
-- Pass actual v8 info struct plus a return value pointer instead.
-- Make V8 helper methods public.
Change-Id: Ie1081d9b9513e5fadcdc3ce37b914d5eb313c97d
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/67274
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/BUILD.gn b/fxjs/BUILD.gn
index 2fb819c..f4fbe5f 100644
--- a/fxjs/BUILD.gn
+++ b/fxjs/BUILD.gn
@@ -112,8 +112,6 @@
if (pdf_enable_xfa) {
sources += [
- "xfa/cfxjse_arguments.cpp",
- "xfa/cfxjse_arguments.h",
"xfa/cfxjse_class.cpp",
"xfa/cfxjse_class.h",
"xfa/cfxjse_context.cpp",
diff --git a/fxjs/cfx_v8.h b/fxjs/cfx_v8.h
index d46c368..210df7e 100644
--- a/fxjs/cfx_v8.h
+++ b/fxjs/cfx_v8.h
@@ -15,6 +15,17 @@
class CFX_V8 {
public:
+ static int ReentrantToInt32Helper(v8::Isolate* pIsolate,
+ v8::Local<v8::Value> pValue);
+ static bool ReentrantToBooleanHelper(v8::Isolate* pIsolate,
+ v8::Local<v8::Value> pValue);
+ static double ReentrantToDoubleHelper(v8::Isolate* pIsolate,
+ v8::Local<v8::Value> pValue);
+ static WideString ReentrantToWideStringHelper(v8::Isolate* pIsolate,
+ v8::Local<v8::Value> pValue);
+ static ByteString ReentrantToByteStringHelper(v8::Isolate* pIsolate,
+ v8::Local<v8::Value> pValue);
+
explicit CFX_V8(v8::Isolate* pIsolate);
virtual ~CFX_V8();
@@ -61,20 +72,6 @@
void DisposeIsolate();
private:
- friend class CFXJSE_Arguments;
- friend class CFXJSE_Value;
-
- static int ReentrantToInt32Helper(v8::Isolate* pIsolate,
- v8::Local<v8::Value> pValue);
- static bool ReentrantToBooleanHelper(v8::Isolate* pIsolate,
- v8::Local<v8::Value> pValue);
- static double ReentrantToDoubleHelper(v8::Isolate* pIsolate,
- v8::Local<v8::Value> pValue);
- static WideString ReentrantToWideStringHelper(v8::Isolate* pIsolate,
- v8::Local<v8::Value> pValue);
- static ByteString ReentrantToByteStringHelper(v8::Isolate* pIsolate,
- v8::Local<v8::Value> pValue);
-
UnownedPtr<v8::Isolate> m_pIsolate;
};
diff --git a/fxjs/xfa/cfxjse_arguments.cpp b/fxjs/xfa/cfxjse_arguments.cpp
deleted file mode 100644
index f878154..0000000
--- a/fxjs/xfa/cfxjse_arguments.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "fxjs/xfa/cfxjse_arguments.h"
-
-#include "fxjs/cfx_v8.h"
-#include "fxjs/xfa/cfxjse_context.h"
-#include "fxjs/xfa/cfxjse_value.h"
-#include "third_party/base/ptr_util.h"
-
-CFXJSE_Arguments::CFXJSE_Arguments(
- const v8::FunctionCallbackInfo<v8::Value>* pInfo,
- CFXJSE_Value* pRetValue)
- : m_pInfo(pInfo), m_pRetValue(pRetValue) {}
-
-CFXJSE_Arguments::~CFXJSE_Arguments() {}
-
-int32_t CFXJSE_Arguments::GetLength() const {
- return m_pInfo->Length();
-}
-
-std::unique_ptr<CFXJSE_Value> CFXJSE_Arguments::GetValue(int32_t index) const {
- auto pArgValue = pdfium::MakeUnique<CFXJSE_Value>(v8::Isolate::GetCurrent());
- pArgValue->ForceSetValue((*m_pInfo)[index]);
- return pArgValue;
-}
-
-bool CFXJSE_Arguments::GetBoolean(int32_t index) const {
- return CFX_V8::ReentrantToBooleanHelper(m_pInfo->GetIsolate(),
- (*m_pInfo)[index]);
-}
-
-int32_t CFXJSE_Arguments::GetInt32(int32_t index) const {
- return CFX_V8::ReentrantToInt32Helper(m_pInfo->GetIsolate(),
- (*m_pInfo)[index]);
-}
-
-float CFXJSE_Arguments::GetFloat(int32_t index) const {
- return static_cast<float>(CFX_V8::ReentrantToDoubleHelper(
- m_pInfo->GetIsolate(), (*m_pInfo)[index]));
-}
-
-ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const {
- return CFX_V8::ReentrantToByteStringHelper(m_pInfo->GetIsolate(),
- (*m_pInfo)[index]);
-}
-
-CFXJSE_Value* CFXJSE_Arguments::GetReturnValue() const {
- return m_pRetValue.Get();
-}
diff --git a/fxjs/xfa/cfxjse_arguments.h b/fxjs/xfa/cfxjse_arguments.h
deleted file mode 100644
index e048bc2..0000000
--- a/fxjs/xfa/cfxjse_arguments.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FXJS_XFA_CFXJSE_ARGUMENTS_H_
-#define FXJS_XFA_CFXJSE_ARGUMENTS_H_
-
-#include <memory>
-
-#include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/unowned_ptr.h"
-#include "v8/include/v8.h"
-
-class CFXJSE_Value;
-
-class CFXJSE_Arguments {
- public:
- CFXJSE_Arguments(const v8::FunctionCallbackInfo<v8::Value>* pInfo,
- CFXJSE_Value* pRetValue);
- ~CFXJSE_Arguments();
-
- int32_t GetLength() const;
- std::unique_ptr<CFXJSE_Value> GetValue(int32_t index) const;
- bool GetBoolean(int32_t index) const;
- int32_t GetInt32(int32_t index) const;
- float GetFloat(int32_t index) const;
- ByteString GetUTF8String(int32_t index) const;
- CFXJSE_Value* GetReturnValue() const;
-
- private:
- UnownedPtr<const v8::FunctionCallbackInfo<v8::Value>> const m_pInfo;
- UnownedPtr<CFXJSE_Value> const m_pRetValue;
-};
-
-#endif // FXJS_XFA_CFXJSE_ARGUMENTS_H_
diff --git a/fxjs/xfa/cfxjse_class.cpp b/fxjs/xfa/cfxjse_class.cpp
index 2934a85..d3a83be 100644
--- a/fxjs/xfa/cfxjse_class.cpp
+++ b/fxjs/xfa/cfxjse_class.cpp
@@ -11,7 +11,6 @@
#include "fxjs/cjs_result.h"
#include "fxjs/js_resources.h"
-#include "fxjs/xfa/cfxjse_arguments.h"
#include "fxjs/xfa/cfxjse_context.h"
#include "fxjs/xfa/cfxjse_isolatetracker.h"
#include "fxjs/xfa/cfxjse_value.h"
@@ -43,8 +42,8 @@
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
auto lpRetValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
- CFXJSE_Arguments impl(&info, lpRetValue.get());
- lpFunctionInfo->callbackProc(lpThisValue.get(), szFunctionName, impl);
+ lpFunctionInfo->callbackProc(lpThisValue.get(), szFunctionName, info,
+ lpRetValue.get());
if (!lpRetValue->DirectGetValue().IsEmpty())
info.GetReturnValue().Set(lpRetValue->DirectGetValue());
}
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index 604f679..f436c9a 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -14,7 +14,6 @@
#include "core/fxcrt/cfx_widetextbuf.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_random.h"
-#include "fxjs/xfa/cfxjse_arguments.h"
#include "fxjs/xfa/cfxjse_class.h"
#include "fxjs/xfa/cfxjse_context.h"
#include "fxjs/xfa/cfxjse_engine.h"
@@ -1360,17 +1359,19 @@
};
// static
-void CFXJSE_FormCalcContext::Abs(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
+void CFXJSE_FormCalcContext::Abs(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Abs");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
+ auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (ValueIsNull(pThis, argOne.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -1378,16 +1379,18 @@
if (dValue < 0)
dValue = -dValue;
- args.GetReturnValue()->SetDouble(dValue);
+ pRetValue->SetDouble(dValue);
}
// static
-void CFXJSE_FormCalcContext::Avg(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Avg(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 1) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -1395,7 +1398,8 @@
uint32_t uCount = 0;
double dSum = 0.0;
for (int32_t i = 0; i < argc; i++) {
- std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i);
+ auto argValue =
+ pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[i]);
if (argValue->IsNull())
continue;
@@ -1441,40 +1445,45 @@
}
}
if (uCount == 0) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
- args.GetReturnValue()->SetDouble(dSum / uCount);
+ pRetValue->SetDouble(dSum / uCount);
}
// static
-void CFXJSE_FormCalcContext::Ceil(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
+void CFXJSE_FormCalcContext::Ceil(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Ceil");
return;
}
- std::unique_ptr<CFXJSE_Value> argValue = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argValue = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argValue.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
- args.GetReturnValue()->SetFloat(ceil(ValueToFloat(pThis, argValue.get())));
+ pRetValue->SetFloat(ceil(ValueToFloat(pThis, argValue.get())));
}
// static
-void CFXJSE_FormCalcContext::Count(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Count(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
int32_t iCount = 0;
- for (int32_t i = 0; i < args.GetLength(); i++) {
- std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i);
+ for (int32_t i = 0; i < info.Length(); i++) {
+ auto argValue =
+ pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[i]);
if (argValue->IsNull())
continue;
@@ -1517,37 +1526,42 @@
iCount++;
}
}
- args.GetReturnValue()->SetInteger(iCount);
+ pRetValue->SetInteger(iCount);
}
// static
-void CFXJSE_FormCalcContext::Floor(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
+void CFXJSE_FormCalcContext::Floor(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Floor");
return;
}
- std::unique_ptr<CFXJSE_Value> argValue = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argValue = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argValue.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
- args.GetReturnValue()->SetFloat(floor(ValueToFloat(pThis, argValue.get())));
+ pRetValue->SetFloat(floor(ValueToFloat(pThis, argValue.get())));
}
// static
-void CFXJSE_FormCalcContext::Max(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Max(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
uint32_t uCount = 0;
double dMaxValue = 0.0;
- for (int32_t i = 0; i < args.GetLength(); i++) {
- std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i);
+ for (int32_t i = 0; i < info.Length(); i++) {
+ auto argValue =
+ pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[i]);
if (argValue->IsNull())
continue;
@@ -1605,23 +1619,26 @@
}
}
if (uCount == 0) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
- args.GetReturnValue()->SetDouble(dMaxValue);
+ pRetValue->SetDouble(dMaxValue);
}
// static
-void CFXJSE_FormCalcContext::Min(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Min(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
uint32_t uCount = 0;
double dMinValue = 0.0;
- for (int32_t i = 0; i < args.GetLength(); i++) {
- std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i);
+ for (int32_t i = 0; i < info.Length(); i++) {
+ auto argValue =
+ pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[i]);
if (argValue->IsNull())
continue;
@@ -1679,27 +1696,29 @@
}
}
if (uCount == 0) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
- args.GetReturnValue()->SetDouble(dMinValue);
+ pRetValue->SetDouble(dMinValue);
}
// static
-void CFXJSE_FormCalcContext::Mod(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Mod(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 2) {
+ if (info.Length() != 2) {
pContext->ThrowParamCountMismatchException(L"Mod");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
- std::unique_ptr<CFXJSE_Value> argTwo = args.GetValue(1);
+ auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argTwo = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[1]);
if (argOne->IsNull() || argTwo->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -1717,24 +1736,25 @@
return;
}
- args.GetReturnValue()->SetDouble(dDividend -
- dDivisor * (int32_t)(dDividend / dDivisor));
+ pRetValue->SetDouble(dDividend - dDivisor * (int32_t)(dDividend / dDivisor));
}
// static
-void CFXJSE_FormCalcContext::Round(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Round(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- int32_t argc = args.GetLength();
+ int32_t argc = info.Length();
if (argc < 1 || argc > 2) {
pContext->ThrowParamCountMismatchException(L"Round");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
+ auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (argOne->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -1747,9 +1767,9 @@
uint8_t uPrecision = 0;
if (argc > 1) {
- std::unique_ptr<CFXJSE_Value> argTwo = args.GetValue(1);
+ auto argTwo = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[1]);
if (argTwo->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -1764,16 +1784,18 @@
}
CFGAS_Decimal decimalValue(static_cast<float>(dValue), uPrecision);
- args.GetReturnValue()->SetDouble(decimalValue.ToDouble());
+ pRetValue->SetDouble(decimalValue.ToDouble());
}
// static
-void CFXJSE_FormCalcContext::Sum(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Sum(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc == 0) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -1782,7 +1804,8 @@
uint32_t uCount = 0;
double dSum = 0.0;
for (int32_t i = 0; i < argc; i++) {
- std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i);
+ auto argValue =
+ pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[i]);
if (argValue->IsNull())
continue;
@@ -1835,18 +1858,20 @@
}
}
if (uCount == 0) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
- args.GetReturnValue()->SetDouble(dSum);
+ pRetValue->SetDouble(dSum);
}
// static
-void CFXJSE_FormCalcContext::Date(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 0) {
+void CFXJSE_FormCalcContext::Date(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 0) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Date");
return;
}
@@ -1855,34 +1880,36 @@
FXSYS_time(¤tTime);
struct tm* pTmStruct = gmtime(¤tTime);
- args.GetReturnValue()->SetInteger(DateString2Num(
+ pRetValue->SetInteger(DateString2Num(
ByteString::Format("%d%02d%02d", pTmStruct->tm_year + 1900,
pTmStruct->tm_mon + 1, pTmStruct->tm_mday)
.AsStringView()));
}
// static
-void CFXJSE_FormCalcContext::Date2Num(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Date2Num(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 1 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Date2Num");
return;
}
- std::unique_ptr<CFXJSE_Value> dateValue = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> dateValue = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, dateValue.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
ByteString bsDate = ValueToUTF8String(dateValue.get());
ByteString bsFormat;
if (argc > 1) {
- std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, info, 1);
if (ValueIsNull(pThis, formatValue.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsFormat = ValueToUTF8String(formatValue.get());
@@ -1890,9 +1917,9 @@
ByteString bsLocale;
if (argc > 2) {
- std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, localeValue.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsLocale = ValueToUTF8String(localeValue.get());
@@ -1901,14 +1928,16 @@
ByteString bsIsoDate =
Local2IsoDate(pThis, bsDate.AsStringView(), bsFormat.AsStringView(),
bsLocale.AsStringView());
- args.GetReturnValue()->SetInteger(DateString2Num(bsIsoDate.AsStringView()));
+ pRetValue->SetInteger(DateString2Num(bsIsoDate.AsStringView()));
}
// static
-void CFXJSE_FormCalcContext::DateFmt(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::DateFmt(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Date2Num");
return;
@@ -1916,22 +1945,22 @@
int32_t iStyle = 0;
if (argc > 0) {
- std::unique_ptr<CFXJSE_Value> argStyle = GetSimpleValue(pThis, args, 0);
- if (argStyle->IsNull()) {
- args.GetReturnValue()->SetNull();
+ std::unique_ptr<CFXJSE_Value> infotyle = GetSimpleValue(pThis, info, 0);
+ if (infotyle->IsNull()) {
+ pRetValue->SetNull();
return;
}
- iStyle = (int32_t)ValueToFloat(pThis, argStyle.get());
+ iStyle = (int32_t)ValueToFloat(pThis, infotyle.get());
if (iStyle < 0 || iStyle > 4)
iStyle = 0;
}
ByteString bsLocale;
if (argc > 1) {
- std::unique_ptr<CFXJSE_Value> argLocale = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argLocale = GetSimpleValue(pThis, info, 1);
if (argLocale->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsLocale = ValueToUTF8String(argLocale.get());
@@ -1939,39 +1968,43 @@
ByteString bsFormat =
GetStandardDateFormat(pThis, iStyle, bsLocale.AsStringView());
- args.GetReturnValue()->SetString(bsFormat.AsStringView());
+ pRetValue->SetString(bsFormat.AsStringView());
}
// static
-void CFXJSE_FormCalcContext::IsoDate2Num(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
+void CFXJSE_FormCalcContext::IsoDate2Num(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"IsoDate2Num");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (argOne->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
ByteString bsArg = ValueToUTF8String(argOne.get());
- args.GetReturnValue()->SetInteger(DateString2Num(bsArg.AsStringView()));
+ pRetValue->SetInteger(DateString2Num(bsArg.AsStringView()));
}
// static
-void CFXJSE_FormCalcContext::IsoTime2Num(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::IsoTime2Num(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 1) {
+ if (info.Length() != 1) {
pContext->ThrowParamCountMismatchException(L"IsoTime2Num");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -1980,7 +2013,7 @@
ByteString bsArg = ValueToUTF8String(argOne.get());
auto pos = bsArg.Find('T', 0);
if (!pos.has_value() || pos.value() == bsArg.GetLength() - 1) {
- args.GetReturnValue()->SetInteger(0);
+ pRetValue->SetInteger(0);
return;
}
bsArg = bsArg.Last(bsArg.GetLength() - (pos.value() + 1));
@@ -1988,7 +2021,7 @@
CXFA_LocaleValue timeValue(XFA_VT_TIME,
WideString::FromUTF8(bsArg.AsStringView()), pMgr);
if (!timeValue.IsValid()) {
- args.GetReturnValue()->SetInteger(0);
+ pRetValue->SetInteger(0);
return;
}
@@ -2009,15 +2042,17 @@
hour = mins / 60;
min = mins % 60;
- args.GetReturnValue()->SetInteger(hour * 3600000 + min * 60000 +
- second * 1000 + milSecond + 1);
+ pRetValue->SetInteger(hour * 3600000 + min * 60000 + second * 1000 +
+ milSecond + 1);
}
// static
-void CFXJSE_FormCalcContext::LocalDateFmt(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::LocalDateFmt(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"LocalDateFmt");
return;
@@ -2025,21 +2060,21 @@
int32_t iStyle = 0;
if (argc > 0) {
- std::unique_ptr<CFXJSE_Value> argStyle = GetSimpleValue(pThis, args, 0);
- if (argStyle->IsNull()) {
- args.GetReturnValue()->SetNull();
+ std::unique_ptr<CFXJSE_Value> infotyle = GetSimpleValue(pThis, info, 0);
+ if (infotyle->IsNull()) {
+ pRetValue->SetNull();
return;
}
- iStyle = (int32_t)ValueToFloat(pThis, argStyle.get());
+ iStyle = (int32_t)ValueToFloat(pThis, infotyle.get());
if (iStyle > 4 || iStyle < 0)
iStyle = 0;
}
ByteString bsLocale;
if (argc > 1) {
- std::unique_ptr<CFXJSE_Value> argLocale = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argLocale = GetSimpleValue(pThis, info, 1);
if (argLocale->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsLocale = ValueToUTF8String(argLocale.get());
@@ -2047,14 +2082,16 @@
ByteString bsFormat =
GetLocalDateFormat(pThis, iStyle, bsLocale.AsStringView(), false);
- args.GetReturnValue()->SetString(bsFormat.AsStringView());
+ pRetValue->SetString(bsFormat.AsStringView());
}
// static
-void CFXJSE_FormCalcContext::LocalTimeFmt(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::LocalTimeFmt(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"LocalTimeFmt");
return;
@@ -2062,21 +2099,21 @@
int32_t iStyle = 0;
if (argc > 0) {
- std::unique_ptr<CFXJSE_Value> argStyle = GetSimpleValue(pThis, args, 0);
- if (argStyle->IsNull()) {
- args.GetReturnValue()->SetNull();
+ std::unique_ptr<CFXJSE_Value> infotyle = GetSimpleValue(pThis, info, 0);
+ if (infotyle->IsNull()) {
+ pRetValue->SetNull();
return;
}
- iStyle = (int32_t)ValueToFloat(pThis, argStyle.get());
+ iStyle = (int32_t)ValueToFloat(pThis, infotyle.get());
if (iStyle > 4 || iStyle < 0)
iStyle = 0;
}
ByteString bsLocale;
if (argc > 1) {
- std::unique_ptr<CFXJSE_Value> argLocale = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argLocale = GetSimpleValue(pThis, info, 1);
if (argLocale->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsLocale = ValueToUTF8String(argLocale.get());
@@ -2084,35 +2121,37 @@
ByteString bsFormat =
GetLocalTimeFormat(pThis, iStyle, bsLocale.AsStringView(), false);
- args.GetReturnValue()->SetString(bsFormat.AsStringView());
+ pRetValue->SetString(bsFormat.AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Num2Date(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Num2Date(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 1 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Num2Date");
return;
}
- std::unique_ptr<CFXJSE_Value> dateValue = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> dateValue = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, dateValue.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
int32_t dDate = (int32_t)ValueToFloat(pThis, dateValue.get());
if (dDate < 1) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
ByteString bsFormat;
if (argc > 1) {
- std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, info, 1);
if (ValueIsNull(pThis, formatValue.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsFormat = ValueToUTF8String(formatValue.get());
@@ -2120,9 +2159,9 @@
ByteString bsLocale;
if (argc > 2) {
- std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, localeValue.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsLocale = ValueToUTF8String(localeValue.get());
@@ -2224,35 +2263,37 @@
pThis,
ByteString::Format("%d%02d%02d", iYear + i, iMonth, iDay).AsStringView(),
bsFormat.AsStringView(), bsLocale.AsStringView());
- args.GetReturnValue()->SetString(bsLocalDate.AsStringView());
+ pRetValue->SetString(bsLocalDate.AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Num2GMTime(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Num2GMTime(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 1 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Num2GMTime");
return;
}
- std::unique_ptr<CFXJSE_Value> timeValue = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> timeValue = GetSimpleValue(pThis, info, 0);
if (timeValue->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
int32_t iTime = (int32_t)ValueToFloat(pThis, timeValue.get());
if (abs(iTime) < 1.0) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
ByteString bsFormat;
if (argc > 1) {
- std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, info, 1);
if (formatValue->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsFormat = ValueToUTF8String(formatValue.get());
@@ -2260,9 +2301,9 @@
ByteString bsLocale;
if (argc > 2) {
- std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, info, 2);
if (localeValue->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsLocale = ValueToUTF8String(localeValue.get());
@@ -2270,35 +2311,37 @@
ByteString bsGMTTime = Num2AllTime(pThis, iTime, bsFormat.AsStringView(),
bsLocale.AsStringView(), true);
- args.GetReturnValue()->SetString(bsGMTTime.AsStringView());
+ pRetValue->SetString(bsGMTTime.AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Num2Time(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Num2Time(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 1 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Num2Time");
return;
}
- std::unique_ptr<CFXJSE_Value> timeValue = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> timeValue = GetSimpleValue(pThis, info, 0);
if (timeValue->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
float fTime = ValueToFloat(pThis, timeValue.get());
if (fabs(fTime) < 1.0) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
ByteString bsFormat;
if (argc > 1) {
- std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, info, 1);
if (formatValue->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsFormat = ValueToUTF8String(formatValue.get());
@@ -2306,9 +2349,9 @@
ByteString bsLocale;
if (argc > 2) {
- std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, info, 2);
if (localeValue->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsLocale = ValueToUTF8String(localeValue.get());
@@ -2317,49 +2360,52 @@
ByteString bsLocalTime =
Num2AllTime(pThis, static_cast<int32_t>(fTime), bsFormat.AsStringView(),
bsLocale.AsStringView(), false);
- args.GetReturnValue()->SetString(bsLocalTime.AsStringView());
+ pRetValue->SetString(bsLocalTime.AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Time(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 0) {
+void CFXJSE_FormCalcContext::Time(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 0) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Time");
return;
}
time_t now;
FXSYS_time(&now);
-
struct tm* pGmt = gmtime(&now);
- args.GetReturnValue()->SetInteger(
+ pRetValue->SetInteger(
(pGmt->tm_hour * 3600 + pGmt->tm_min * 60 + pGmt->tm_sec) * 1000);
}
// static
-void CFXJSE_FormCalcContext::Time2Num(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Time2Num(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 1 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Time2Num");
return;
}
ByteString bsTime;
- std::unique_ptr<CFXJSE_Value> timeValue = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> timeValue = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, timeValue.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsTime = ValueToUTF8String(timeValue.get());
ByteString bsFormat;
if (argc > 1) {
- std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, info, 1);
if (ValueIsNull(pThis, formatValue.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsFormat = ValueToUTF8String(formatValue.get());
@@ -2367,9 +2413,9 @@
ByteString bsLocale;
if (argc > 2) {
- std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, localeValue.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsLocale = ValueToUTF8String(localeValue.get());
@@ -2397,7 +2443,7 @@
WideString::FromUTF8(bsTime.AsStringView()),
wsFormat, pLocale, pMgr);
if (!localeValue.IsValid()) {
- args.GetReturnValue()->SetInteger(0);
+ pRetValue->SetInteger(0);
return;
}
@@ -2417,15 +2463,17 @@
hour = mins / 60;
min = mins % 60;
- args.GetReturnValue()->SetInteger(hour * 3600000 + min * 60000 +
- second * 1000 + milSecond + 1);
+ pRetValue->SetInteger(hour * 3600000 + min * 60000 + second * 1000 +
+ milSecond + 1);
}
// static
-void CFXJSE_FormCalcContext::TimeFmt(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::TimeFmt(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"TimeFmt");
return;
@@ -2433,21 +2481,21 @@
int32_t iStyle = 0;
if (argc > 0) {
- std::unique_ptr<CFXJSE_Value> argStyle = GetSimpleValue(pThis, args, 0);
- if (argStyle->IsNull()) {
- args.GetReturnValue()->SetNull();
+ std::unique_ptr<CFXJSE_Value> infotyle = GetSimpleValue(pThis, info, 0);
+ if (infotyle->IsNull()) {
+ pRetValue->SetNull();
return;
}
- iStyle = (int32_t)ValueToFloat(pThis, argStyle.get());
+ iStyle = (int32_t)ValueToFloat(pThis, infotyle.get());
if (iStyle > 4 || iStyle < 0)
iStyle = 0;
}
ByteString bsLocale;
if (argc > 1) {
- std::unique_ptr<CFXJSE_Value> argLocale = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argLocale = GetSimpleValue(pThis, info, 1);
if (argLocale->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsLocale = ValueToUTF8String(argLocale.get());
@@ -2455,7 +2503,7 @@
ByteString bsFormat =
GetStandardTimeFormat(pThis, iStyle, bsLocale.AsStringView());
- args.GetReturnValue()->SetString(bsFormat.AsStringView());
+ pRetValue->SetString(bsFormat.AsStringView());
}
// static
@@ -2597,21 +2645,23 @@
}
// static
-void CFXJSE_FormCalcContext::Apr(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Apr(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 3) {
+ if (info.Length() != 3) {
pContext->ThrowParamCountMismatchException(L"Apr");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
+ std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -2635,7 +2685,7 @@
(r * nTemp * nPeriods * (nTemp / (1 + r)))) /
((nTemp - 1) * (nTemp - 1));
if (nDerivative == 0) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -2646,25 +2696,27 @@
}
nRet = r * nTemp / (nTemp - 1) - nPayment / nPrincipal;
}
- args.GetReturnValue()->SetDouble(r * 12);
+ pRetValue->SetDouble(r * 12);
}
// static
-void CFXJSE_FormCalcContext::CTerm(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::CTerm(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 3) {
+ if (info.Length() != 3) {
pContext->ThrowParamCountMismatchException(L"CTerm");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
+ std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -2676,26 +2728,27 @@
return;
}
- args.GetReturnValue()->SetFloat(log((float)(nFutureValue / nInitAmount)) /
- log((float)(1 + nRate)));
+ pRetValue->SetFloat(log((float)(nFutureValue / nInitAmount)) /
+ log((float)(1 + nRate)));
}
// static
void CFXJSE_FormCalcContext::FV(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 3) {
+ if (info.Length() != 3) {
pContext->ThrowParamCountMismatchException(L"FV");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
+ std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -2718,28 +2771,30 @@
dResult = nAmount * nPeriod;
}
- args.GetReturnValue()->SetDouble(dResult);
+ pRetValue->SetDouble(dResult);
}
// static
-void CFXJSE_FormCalcContext::IPmt(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::IPmt(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 5) {
+ if (info.Length() != 5) {
pContext->ThrowParamCountMismatchException(L"IPmt");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
- std::unique_ptr<CFXJSE_Value> argFour = GetSimpleValue(pThis, args, 3);
- std::unique_ptr<CFXJSE_Value> argFive = GetSimpleValue(pThis, args, 4);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
+ std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
+ std::unique_ptr<CFXJSE_Value> argFour = GetSimpleValue(pThis, info, 3);
+ std::unique_ptr<CFXJSE_Value> argFive = GetSimpleValue(pThis, info, 4);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get()) || ValueIsNull(pThis, argFour.get()) ||
ValueIsNull(pThis, argFive.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -2762,7 +2817,7 @@
int32_t iEnd = std::min((int32_t)(nFirstMonth + nNumberOfMonths - 1), iNums);
if (nPayment < nPrincipalAmount * nRateOfMonth) {
- args.GetReturnValue()->SetFloat(0);
+ pRetValue->SetFloat(0);
return;
}
@@ -2775,15 +2830,17 @@
nSum += nPrincipalAmount * nRateOfMonth;
nPrincipalAmount -= nPayment - nPrincipalAmount * nRateOfMonth;
}
- args.GetReturnValue()->SetFloat(nSum);
+ pRetValue->SetFloat(nSum);
}
// static
-void CFXJSE_FormCalcContext::NPV(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::NPV(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- int32_t argc = args.GetLength();
+ int32_t argc = info.Length();
if (argc < 3) {
pContext->ThrowParamCountMismatchException(L"NPV");
return;
@@ -2791,9 +2848,9 @@
std::vector<std::unique_ptr<CFXJSE_Value>> argValues;
for (int32_t i = 0; i < argc; i++) {
- argValues.push_back(GetSimpleValue(pThis, args, i));
+ argValues.push_back(GetSimpleValue(pThis, info, i));
if (ValueIsNull(pThis, argValues[i].get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
}
@@ -2818,25 +2875,27 @@
double nNum = data[iIndex++];
nSum += nNum / nTemp;
}
- args.GetReturnValue()->SetDouble(nSum);
+ pRetValue->SetDouble(nSum);
}
// static
-void CFXJSE_FormCalcContext::Pmt(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Pmt(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 3) {
+ if (info.Length() != 3) {
pContext->ThrowParamCountMismatchException(L"Pmt");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
+ std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -2853,28 +2912,30 @@
for (int32_t i = 0; i < nPeriods - 1; ++i)
nSum *= nTmp;
- args.GetReturnValue()->SetFloat((nPrincipal * nRate * nSum) / (nSum - 1));
+ pRetValue->SetFloat((nPrincipal * nRate * nSum) / (nSum - 1));
}
// static
-void CFXJSE_FormCalcContext::PPmt(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::PPmt(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 5) {
+ if (info.Length() != 5) {
pContext->ThrowParamCountMismatchException(L"PPmt");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
- std::unique_ptr<CFXJSE_Value> argFour = GetSimpleValue(pThis, args, 3);
- std::unique_ptr<CFXJSE_Value> argFive = GetSimpleValue(pThis, args, 4);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
+ std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
+ std::unique_ptr<CFXJSE_Value> argFour = GetSimpleValue(pThis, info, 3);
+ std::unique_ptr<CFXJSE_Value> argFive = GetSimpleValue(pThis, info, 4);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get()) || ValueIsNull(pThis, argFour.get()) ||
ValueIsNull(pThis, argFive.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -2911,25 +2972,26 @@
nSum += nTemp;
nPrincipalAmount -= nTemp;
}
- args.GetReturnValue()->SetFloat(nSum);
+ pRetValue->SetFloat(nSum);
}
// static
void CFXJSE_FormCalcContext::PV(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 3) {
+ if (info.Length() != 3) {
pContext->ThrowParamCountMismatchException(L"PV");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
+ std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -2946,25 +3008,27 @@
nTemp *= 1 + nRate;
nTemp = 1 / nTemp;
- args.GetReturnValue()->SetDouble(nAmount * ((1 - nTemp) / nRate));
+ pRetValue->SetDouble(nAmount * ((1 - nTemp) / nRate));
}
// static
-void CFXJSE_FormCalcContext::Rate(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Rate(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 3) {
+ if (info.Length() != 3) {
pContext->ThrowParamCountMismatchException(L"Rate");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
+ std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -2976,26 +3040,28 @@
return;
}
- args.GetReturnValue()->SetFloat(
+ pRetValue->SetFloat(
FXSYS_pow((float)(nFuture / nPresent), (float)(1 / nTotalNumber)) - 1);
}
// static
-void CFXJSE_FormCalcContext::Term(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Term(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 3) {
+ if (info.Length() != 3) {
pContext->ThrowParamCountMismatchException(L"Term");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
- std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
+ std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -3007,30 +3073,32 @@
return;
}
- args.GetReturnValue()->SetFloat(log((float)(nFuture / nMount * nRate) + 1) /
- log((float)(1 + nRate)));
+ pRetValue->SetFloat(log((float)(nFuture / nMount * nRate) + 1) /
+ log((float)(1 + nRate)));
}
// static
-void CFXJSE_FormCalcContext::Choose(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Choose(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- int32_t argc = args.GetLength();
+ int32_t argc = info.Length();
if (argc < 2) {
pContext->ThrowParamCountMismatchException(L"Choose");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
+ auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (ValueIsNull(pThis, argOne.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
int32_t iIndex = (int32_t)ValueToFloat(pThis, argOne.get());
if (iIndex < 1) {
- args.GetReturnValue()->SetString("");
+ pRetValue->SetString("");
return;
}
@@ -3040,7 +3108,8 @@
int32_t iValueIndex = 0;
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
while (!bFound && !bStopCounterFlags && (iArgIndex < argc)) {
- std::unique_ptr<CFXJSE_Value> argIndexValue = args.GetValue(iArgIndex);
+ auto argIndexValue =
+ pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[iArgIndex]);
if (argIndexValue->IsArray()) {
auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
argIndexValue->GetObjectProperty("length", lengthValue.get());
@@ -3063,139 +3132,149 @@
propertyValue->ToString().AsStringView(), newPropertyValue.get());
}
ByteString bsChosen = ValueToUTF8String(newPropertyValue.get());
- args.GetReturnValue()->SetString(bsChosen.AsStringView());
+ pRetValue->SetString(bsChosen.AsStringView());
bFound = true;
}
} else {
iValueIndex++;
if (iValueIndex == iIndex) {
ByteString bsChosen = ValueToUTF8String(argIndexValue.get());
- args.GetReturnValue()->SetString(bsChosen.AsStringView());
+ pRetValue->SetString(bsChosen.AsStringView());
bFound = true;
}
}
iArgIndex++;
}
if (!bFound)
- args.GetReturnValue()->SetString("");
+ pRetValue->SetString("");
}
// static
-void CFXJSE_FormCalcContext::Exists(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
+void CFXJSE_FormCalcContext::Exists(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Exists");
return;
}
- args.GetReturnValue()->SetInteger(args.GetValue(0)->IsObject());
+ auto temp = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ pRetValue->SetInteger(temp->IsObject());
}
// static
-void CFXJSE_FormCalcContext::HasValue(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
+void CFXJSE_FormCalcContext::HasValue(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"HasValue");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (!argOne->IsString()) {
- args.GetReturnValue()->SetInteger(argOne->IsNumber() ||
- argOne->IsBoolean());
+ pRetValue->SetInteger(argOne->IsNumber() || argOne->IsBoolean());
return;
}
ByteString bsValue = argOne->ToString();
bsValue.TrimLeft();
- args.GetReturnValue()->SetInteger(!bsValue.IsEmpty());
+ pRetValue->SetInteger(!bsValue.IsEmpty());
}
// static
-void CFXJSE_FormCalcContext::Oneof(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() < 2) {
+void CFXJSE_FormCalcContext::Oneof(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() < 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Oneof");
return;
}
bool bFlags = false;
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- for (const auto& value : unfoldArgs(pThis, args)) {
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ for (const auto& value : unfoldArgs(pThis, info)) {
if (simpleValueCompare(pThis, argOne.get(), value.get())) {
bFlags = true;
break;
}
}
- args.GetReturnValue()->SetInteger(bFlags);
+ pRetValue->SetInteger(bFlags);
}
// static
-void CFXJSE_FormCalcContext::Within(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 3) {
+void CFXJSE_FormCalcContext::Within(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Within");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (argOne->IsNull()) {
- args.GetReturnValue()->SetUndefined();
+ pRetValue->SetUndefined();
return;
}
- std::unique_ptr<CFXJSE_Value> argLow = GetSimpleValue(pThis, args, 1);
- std::unique_ptr<CFXJSE_Value> argHigh = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> argLow = GetSimpleValue(pThis, info, 1);
+ std::unique_ptr<CFXJSE_Value> argHigh = GetSimpleValue(pThis, info, 2);
if (argOne->IsNumber()) {
float oneNumber = ValueToFloat(pThis, argOne.get());
float lowNumber = ValueToFloat(pThis, argLow.get());
float heightNumber = ValueToFloat(pThis, argHigh.get());
- args.GetReturnValue()->SetInteger((oneNumber >= lowNumber) &&
- (oneNumber <= heightNumber));
+ pRetValue->SetInteger((oneNumber >= lowNumber) &&
+ (oneNumber <= heightNumber));
return;
}
ByteString bsOne = ValueToUTF8String(argOne.get());
ByteString bsLow = ValueToUTF8String(argLow.get());
ByteString bsHeight = ValueToUTF8String(argHigh.get());
- args.GetReturnValue()->SetInteger(
- (bsOne.Compare(bsLow.AsStringView()) >= 0) &&
- (bsOne.Compare(bsHeight.AsStringView()) <= 0));
+ pRetValue->SetInteger((bsOne.Compare(bsLow.AsStringView()) >= 0) &&
+ (bsOne.Compare(bsHeight.AsStringView()) <= 0));
}
// static
void CFXJSE_FormCalcContext::If(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 3) {
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"If");
return;
}
- args.GetReturnValue()->Assign(GetSimpleValue(pThis, args, 0)->ToBoolean()
- ? GetSimpleValue(pThis, args, 1).get()
- : GetSimpleValue(pThis, args, 2).get());
+ pRetValue->Assign(GetSimpleValue(pThis, info, 0)->ToBoolean()
+ ? GetSimpleValue(pThis, info, 1).get()
+ : GetSimpleValue(pThis, info, 2).get());
}
// static
-void CFXJSE_FormCalcContext::Eval(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Eval(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 1) {
+ if (info.Length() != 1) {
pContext->ThrowParamCountMismatchException(L"Eval");
return;
}
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
- std::unique_ptr<CFXJSE_Value> scriptValue = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> scriptValue = GetSimpleValue(pThis, info, 0);
ByteString bsUtf8Script = ValueToUTF8String(scriptValue.get());
if (bsUtf8Script.IsEmpty()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -3215,21 +3294,23 @@
FX_UTF8Encode(wsJavaScriptBuf.AsStringView()).c_str(), returnValue.get(),
nullptr);
- args.GetReturnValue()->Assign(returnValue.get());
+ pRetValue->Assign(returnValue.get());
}
// static
-void CFXJSE_FormCalcContext::Ref(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Ref(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
- if (args.GetLength() != 1) {
+ if (info.Length() != 1) {
pContext->ThrowParamCountMismatchException(L"Ref");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
+ auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (!argOne->IsArray() && !argOne->IsObject() && !argOne->IsBoolean() &&
!argOne->IsString() && !argOne->IsNull() && !argOne->IsNumber()) {
pContext->ThrowArgumentMismatchException();
@@ -3237,7 +3318,7 @@
}
if (argOne->IsBoolean() || argOne->IsString() || argOne->IsNumber()) {
- args.GetReturnValue()->Assign(argOne.get());
+ pRetValue->Assign(argOne.get());
return;
}
@@ -3273,27 +3354,29 @@
values[0]->SetInteger(intVal);
values[1]->SetNull();
- args.GetReturnValue()->SetArray(values);
+ pRetValue->SetArray(values);
}
// static
-void CFXJSE_FormCalcContext::UnitType(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
+void CFXJSE_FormCalcContext::UnitType(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"UnitType");
return;
}
- std::unique_ptr<CFXJSE_Value> unitspanValue = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> unitspanValue = GetSimpleValue(pThis, info, 0);
if (unitspanValue->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
ByteString bsUnitspan = ValueToUTF8String(unitspanValue.get());
if (bsUnitspan.IsEmpty()) {
- args.GetReturnValue()->SetString("in");
+ pRetValue->SetString("in");
return;
}
@@ -3366,43 +3449,45 @@
}
switch (eParserStatus) {
case VALUETYPE_ISCM:
- args.GetReturnValue()->SetString("cm");
+ pRetValue->SetString("cm");
break;
case VALUETYPE_ISMM:
- args.GetReturnValue()->SetString("mm");
+ pRetValue->SetString("mm");
break;
case VALUETYPE_ISPT:
- args.GetReturnValue()->SetString("pt");
+ pRetValue->SetString("pt");
break;
case VALUETYPE_ISMP:
- args.GetReturnValue()->SetString("mp");
+ pRetValue->SetString("mp");
break;
default:
- args.GetReturnValue()->SetString("in");
+ pRetValue->SetString("in");
break;
}
}
// static
-void CFXJSE_FormCalcContext::UnitValue(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::UnitValue(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 1 || argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"UnitValue");
return;
}
- std::unique_ptr<CFXJSE_Value> unitspanValue = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> unitspanValue = GetSimpleValue(pThis, info, 0);
if (unitspanValue->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
ByteString bsUnitspan = ValueToUTF8String(unitspanValue.get());
const char* pData = bsUnitspan.c_str();
if (!pData) {
- args.GetReturnValue()->SetInteger(0);
+ pRetValue->SetInteger(0);
return;
}
@@ -3434,7 +3519,7 @@
ByteString bsUnit;
if (argc > 1) {
- std::unique_ptr<CFXJSE_Value> unitValue = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> unitValue = GetSimpleValue(pThis, info, 1);
ByteString bsUnitTemp = ValueToUTF8String(unitValue.get());
const char* pChar = bsUnitTemp.c_str();
size_t uVal = 0;
@@ -3519,41 +3604,44 @@
else
dResult = dFirstNumber / 72000;
}
- args.GetReturnValue()->SetDouble(dResult);
+ pRetValue->SetDouble(dResult);
}
// static
void CFXJSE_FormCalcContext::At(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 2) {
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"At");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
ByteString stringTwo = ValueToUTF8String(argTwo.get());
if (stringTwo.IsEmpty()) {
- args.GetReturnValue()->SetInteger(1);
+ pRetValue->SetInteger(1);
return;
}
ByteString stringOne = ValueToUTF8String(argOne.get());
auto pos = stringOne.Find(stringTwo.AsStringView());
- args.GetReturnValue()->SetInteger(pos.has_value() ? pos.value() + 1 : 0);
+ pRetValue->SetInteger(pos.has_value() ? pos.value() + 1 : 0);
}
// static
-void CFXJSE_FormCalcContext::Concat(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Concat(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Concat");
return;
@@ -3562,7 +3650,7 @@
ByteString bsResult;
bool bAllNull = true;
for (int32_t i = 0; i < argc; i++) {
- std::unique_ptr<CFXJSE_Value> value = GetSimpleValue(pThis, args, i);
+ std::unique_ptr<CFXJSE_Value> value = GetSimpleValue(pThis, info, i);
if (ValueIsNull(pThis, value.get()))
continue;
@@ -3571,42 +3659,43 @@
}
if (bAllNull) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
- args.GetReturnValue()->SetString(bsResult.AsStringView());
+ pRetValue->SetString(bsResult.AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Decode(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Decode(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 1 || argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Decode");
return;
}
if (argc == 1) {
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
WideString decoded = DecodeURL(
WideString::FromUTF8(ValueToUTF8String(argOne.get()).AsStringView()));
- args.GetReturnValue()->SetString(
- FX_UTF8Encode(decoded.AsStringView()).AsStringView());
+ pRetValue->SetString(FX_UTF8Encode(decoded.AsStringView()).AsStringView());
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -3623,37 +3712,37 @@
else
decoded = DecodeURL(wsToDecode);
- args.GetReturnValue()->SetString(
- FX_UTF8Encode(decoded.AsStringView()).AsStringView());
+ pRetValue->SetString(FX_UTF8Encode(decoded.AsStringView()).AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Encode(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Encode(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 1 || argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Encode");
return;
}
if (argc == 1) {
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
WideString encoded = EncodeURL(ValueToUTF8String(argOne.get()));
- args.GetReturnValue()->SetString(
- FX_UTF8Encode(encoded.AsStringView()).AsStringView());
+ pRetValue->SetString(FX_UTF8Encode(encoded.AsStringView()).AsStringView());
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -3667,24 +3756,25 @@
else
encoded = EncodeURL(bsToEncode);
- args.GetReturnValue()->SetString(
- FX_UTF8Encode(encoded.AsStringView()).AsStringView());
+ pRetValue->SetString(FX_UTF8Encode(encoded.AsStringView()).AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Format(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Format(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() < 2) {
+ if (info.Length() < 2) {
pContext->ThrowParamCountMismatchException(L"Format");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
ByteString bsPattern = ValueToUTF8String(argOne.get());
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
ByteString bsValue = ValueToUTF8String(argTwo.get());
CXFA_Document* pDoc = pContext->GetDocument();
@@ -3702,7 +3792,7 @@
case XFA_VT_DATETIME: {
auto iTChar = wsPattern.Find(L'T');
if (!iTChar.has_value()) {
- args.GetReturnValue()->SetString("");
+ pRetValue->SetString("");
return;
}
WideString wsDatePattern(L"date{");
@@ -3744,67 +3834,73 @@
WideString wsRet;
if (!localeValue.FormatPatterns(wsRet, wsPattern, pLocale,
XFA_VALUEPICTURE_Display)) {
- args.GetReturnValue()->SetString("");
+ pRetValue->SetString("");
return;
}
- args.GetReturnValue()->SetString(wsRet.ToUTF8().AsStringView());
+ pRetValue->SetString(wsRet.ToUTF8().AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Left(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 2) {
+void CFXJSE_FormCalcContext::Left(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Left");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
if ((ValueIsNull(pThis, argOne.get())) ||
(ValueIsNull(pThis, argTwo.get()))) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
ByteString bsSource = ValueToUTF8String(argOne.get());
int32_t count = std::max(0, ValueToInteger(pThis, argTwo.get()));
- args.GetReturnValue()->SetString(bsSource.First(count).AsStringView());
+ pRetValue->SetString(bsSource.First(count).AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Len(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
+void CFXJSE_FormCalcContext::Len(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Len");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
ByteString bsSource = ValueToUTF8String(argOne.get());
- args.GetReturnValue()->SetInteger(bsSource.GetLength());
+ pRetValue->SetInteger(bsSource.GetLength());
}
// static
-void CFXJSE_FormCalcContext::Lower(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Lower(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 1 || argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Lower");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -3820,44 +3916,47 @@
}
szLowBuf.AppendChar(0);
- args.GetReturnValue()->SetString(
- FX_UTF8Encode(szLowBuf.AsStringView()).AsStringView());
+ pRetValue->SetString(FX_UTF8Encode(szLowBuf.AsStringView()).AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Ltrim(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
+void CFXJSE_FormCalcContext::Ltrim(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Ltrim");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
ByteString bsSource = ValueToUTF8String(argOne.get());
bsSource.TrimLeft();
- args.GetReturnValue()->SetString(bsSource.AsStringView());
+ pRetValue->SetString(bsSource.AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Parse(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Parse(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 2) {
+ if (info.Length() != 2) {
pContext->ThrowParamCountMismatchException(L"Parse");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
if (ValueIsNull(pThis, argTwo.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -3877,11 +3976,10 @@
CXFA_LocaleValue localeValue(dwPatternType, wsValue, wsPattern, pLocale,
pMgr);
if (!localeValue.IsValid()) {
- args.GetReturnValue()->SetString("");
+ pRetValue->SetString("");
return;
}
- args.GetReturnValue()->SetString(
- localeValue.GetValue().ToUTF8().AsStringView());
+ pRetValue->SetString(localeValue.GetValue().ToUTF8().AsStringView());
return;
}
@@ -3889,7 +3987,7 @@
case XFA_VT_DATETIME: {
auto iTChar = wsPattern.Find(L'T');
if (!iTChar.has_value()) {
- args.GetReturnValue()->SetString("");
+ pRetValue->SetString("");
return;
}
WideString wsDatePattern(L"date{" + wsPattern.First(iTChar.value()) +
@@ -3901,11 +3999,10 @@
CXFA_LocaleValue localeValue(dwPatternType, wsValue, wsPattern, pLocale,
pMgr);
if (!localeValue.IsValid()) {
- args.GetReturnValue()->SetString("");
+ pRetValue->SetString("");
return;
}
- args.GetReturnValue()->SetString(
- localeValue.GetValue().ToUTF8().AsStringView());
+ pRetValue->SetString(localeValue.GetValue().ToUTF8().AsStringView());
return;
}
case XFA_VT_DATE: {
@@ -3913,11 +4010,10 @@
CXFA_LocaleValue localeValue(dwPatternType, wsValue, wsPattern, pLocale,
pMgr);
if (!localeValue.IsValid()) {
- args.GetReturnValue()->SetString("");
+ pRetValue->SetString("");
return;
}
- args.GetReturnValue()->SetString(
- localeValue.GetValue().ToUTF8().AsStringView());
+ pRetValue->SetString(localeValue.GetValue().ToUTF8().AsStringView());
return;
}
case XFA_VT_TIME: {
@@ -3925,11 +4021,10 @@
CXFA_LocaleValue localeValue(dwPatternType, wsValue, wsPattern, pLocale,
pMgr);
if (!localeValue.IsValid()) {
- args.GetReturnValue()->SetString("");
+ pRetValue->SetString("");
return;
}
- args.GetReturnValue()->SetString(
- localeValue.GetValue().ToUTF8().AsStringView());
+ pRetValue->SetString(localeValue.GetValue().ToUTF8().AsStringView());
return;
}
case XFA_VT_TEXT: {
@@ -3937,11 +4032,10 @@
CXFA_LocaleValue localeValue(XFA_VT_TEXT, wsValue, wsPattern, pLocale,
pMgr);
if (!localeValue.IsValid()) {
- args.GetReturnValue()->SetString("");
+ pRetValue->SetString("");
return;
}
- args.GetReturnValue()->SetString(
- localeValue.GetValue().ToUTF8().AsStringView());
+ pRetValue->SetString(localeValue.GetValue().ToUTF8().AsStringView());
return;
}
case XFA_VT_FLOAT: {
@@ -3949,10 +4043,10 @@
CXFA_LocaleValue localeValue(XFA_VT_FLOAT, wsValue, wsPattern, pLocale,
pMgr);
if (!localeValue.IsValid()) {
- args.GetReturnValue()->SetString("");
+ pRetValue->SetString("");
return;
}
- args.GetReturnValue()->SetDouble(localeValue.GetDoubleNum());
+ pRetValue->SetDouble(localeValue.GetDoubleNum());
return;
}
default: {
@@ -3961,7 +4055,7 @@
CXFA_LocaleValue localeValue(XFA_VT_FLOAT, wsValue, wsTestPattern,
pLocale, pMgr);
if (localeValue.IsValid()) {
- args.GetReturnValue()->SetDouble(localeValue.GetDoubleNum());
+ pRetValue->SetDouble(localeValue.GetDoubleNum());
return;
}
}
@@ -3971,29 +4065,30 @@
CXFA_LocaleValue localeValue(XFA_VT_TEXT, wsValue, wsTestPattern,
pLocale, pMgr);
if (localeValue.IsValid()) {
- args.GetReturnValue()->SetString(
- localeValue.GetValue().ToUTF8().AsStringView());
+ pRetValue->SetString(localeValue.GetValue().ToUTF8().AsStringView());
return;
}
}
- args.GetReturnValue()->SetString("");
+ pRetValue->SetString("");
return;
}
}
}
// static
-void CFXJSE_FormCalcContext::Replace(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Replace(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 2 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Replace");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
ByteString bsOne;
ByteString bsTwo;
if (!ValueIsNull(pThis, argOne.get()) && !ValueIsNull(pThis, argTwo.get())) {
@@ -4003,7 +4098,7 @@
ByteString bsThree;
if (argc > 2) {
- std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
bsThree = ValueToUTF8String(argThree.get());
}
@@ -4038,63 +4133,69 @@
}
}
szResult << '\0';
- args.GetReturnValue()->SetString(ByteStringView(szResult.str().c_str()));
+ pRetValue->SetString(ByteStringView(szResult.str().c_str()));
}
// static
-void CFXJSE_FormCalcContext::Right(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 2) {
+void CFXJSE_FormCalcContext::Right(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Right");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
if ((ValueIsNull(pThis, argOne.get())) ||
(ValueIsNull(pThis, argTwo.get()))) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
ByteString bsSource = ValueToUTF8String(argOne.get());
int32_t count = std::max(0, ValueToInteger(pThis, argTwo.get()));
- args.GetReturnValue()->SetString(bsSource.Last(count).AsStringView());
+ pRetValue->SetString(bsSource.Last(count).AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Rtrim(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
+void CFXJSE_FormCalcContext::Rtrim(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Rtrim");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
ByteString bsSource = ValueToUTF8String(argOne.get());
bsSource.TrimRight();
- args.GetReturnValue()->SetString(bsSource.AsStringView());
+ pRetValue->SetString(bsSource.AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Space(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
+void CFXJSE_FormCalcContext::Space(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Space");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (argOne->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -4106,36 +4207,38 @@
index++;
}
spaceString << '\0';
- args.GetReturnValue()->SetString(ByteStringView(spaceString.str().c_str()));
+ pRetValue->SetString(ByteStringView(spaceString.str().c_str()));
}
// static
-void CFXJSE_FormCalcContext::Str(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Str(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 1 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Str");
return;
}
- std::unique_ptr<CFXJSE_Value> numberValue = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> numberValue = GetSimpleValue(pThis, info, 0);
if (numberValue->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
float fNumber = ValueToFloat(pThis, numberValue.get());
int32_t iWidth = 10;
if (argc > 1) {
- std::unique_ptr<CFXJSE_Value> widthValue = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> widthValue = GetSimpleValue(pThis, info, 1);
iWidth = static_cast<int32_t>(ValueToFloat(pThis, widthValue.get()));
}
int32_t iPrecision = 0;
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> precisionValue =
- GetSimpleValue(pThis, args, 2);
+ GetSimpleValue(pThis, info, 2);
iPrecision = std::max(
0, static_cast<int32_t>(ValueToFloat(pThis, precisionValue.get())));
}
@@ -4166,7 +4269,7 @@
++i;
}
resultBuf << '\0';
- args.GetReturnValue()->SetString(ByteStringView(resultBuf.str().c_str()));
+ pRetValue->SetString(ByteStringView(resultBuf.str().c_str()));
return;
}
@@ -4185,7 +4288,7 @@
}
resultBuf << pData;
}
- args.GetReturnValue()->SetString(ByteStringView(resultBuf.str().c_str()));
+ pRetValue->SetString(ByteStringView(resultBuf.str().c_str()));
return;
}
@@ -4221,14 +4324,16 @@
++i;
}
resultBuf << '\0';
- args.GetReturnValue()->SetString(ByteStringView(resultBuf.str().c_str()));
+ pRetValue->SetString(ByteStringView(resultBuf.str().c_str()));
}
// static
-void CFXJSE_FormCalcContext::Stuff(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Stuff(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 3 || argc > 4) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Stuff");
return;
@@ -4239,9 +4344,9 @@
int32_t iLength = 0;
int32_t iStart = 0;
int32_t iDelete = 0;
- std::unique_ptr<CFXJSE_Value> sourceValue = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> startValue = GetSimpleValue(pThis, args, 1);
- std::unique_ptr<CFXJSE_Value> deleteValue = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> sourceValue = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> startValue = GetSimpleValue(pThis, info, 1);
+ std::unique_ptr<CFXJSE_Value> deleteValue = GetSimpleValue(pThis, info, 2);
if (!sourceValue->IsNull() && !startValue->IsNull() &&
!deleteValue->IsNull()) {
bsSource = ValueToUTF8String(sourceValue.get());
@@ -4254,7 +4359,7 @@
}
if (argc > 3) {
- std::unique_ptr<CFXJSE_Value> insertValue = GetSimpleValue(pThis, args, 3);
+ std::unique_ptr<CFXJSE_Value> insertValue = GetSimpleValue(pThis, info, 3);
bsInsert = ValueToUTF8String(insertValue.get());
}
@@ -4272,32 +4377,34 @@
++i;
}
szResult << '\0';
- args.GetReturnValue()->SetString(ByteStringView(szResult.str().c_str()));
+ pRetValue->SetString(ByteStringView(szResult.str().c_str()));
}
// static
-void CFXJSE_FormCalcContext::Substr(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 3) {
+void CFXJSE_FormCalcContext::Substr(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Substr");
return;
}
- std::unique_ptr<CFXJSE_Value> string_value = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> start_value = GetSimpleValue(pThis, args, 1);
- std::unique_ptr<CFXJSE_Value> end_value = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> string_value = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> start_value = GetSimpleValue(pThis, info, 1);
+ std::unique_ptr<CFXJSE_Value> end_value = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, string_value.get()) ||
ValueIsNull(pThis, start_value.get()) ||
ValueIsNull(pThis, end_value.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
ByteString bsSource = ValueToUTF8String(string_value.get());
size_t iLength = bsSource.GetLength();
if (iLength == 0) {
- args.GetReturnValue()->SetString("");
+ pRetValue->SetString("");
return;
}
@@ -4305,22 +4412,23 @@
// than 1, per spec. Subtract 1 since |iStart| is 0-based.
size_t iStart = std::max(ValueToInteger(pThis, start_value.get()), 1) - 1;
if (iStart >= iLength) {
- args.GetReturnValue()->SetString("");
+ pRetValue->SetString("");
return;
}
// Negative values are treated as 0. Can't clamp() due to sign mismatches.
size_t iCount = std::max(ValueToInteger(pThis, end_value.get()), 0);
iCount = std::min(iCount, iLength - iStart);
- args.GetReturnValue()->SetString(
- bsSource.Substr(iStart, iCount).AsStringView());
+ pRetValue->SetString(bsSource.Substr(iStart, iCount).AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Uuid(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Uuid(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 0 || argc > 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Uuid");
return;
@@ -4328,25 +4436,27 @@
int32_t iNum = 0;
if (argc > 0) {
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
iNum = static_cast<int32_t>(ValueToFloat(pThis, argOne.get()));
}
- args.GetReturnValue()->SetString(GUIDString(!!iNum).AsStringView());
+ pRetValue->SetString(GUIDString(!!iNum).AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Upper(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::Upper(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 1 || argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Upper");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -4367,23 +4477,25 @@
}
upperStringBuf.AppendChar(0);
- args.GetReturnValue()->SetString(
+ pRetValue->SetString(
FX_UTF8Encode(upperStringBuf.AsStringView()).AsStringView());
}
// static
-void CFXJSE_FormCalcContext::WordNum(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- int32_t argc = args.GetLength();
+void CFXJSE_FormCalcContext::WordNum(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ int32_t argc = info.Length();
if (argc < 1 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"WordNum");
return;
}
- std::unique_ptr<CFXJSE_Value> numberValue = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> numberValue = GetSimpleValue(pThis, info, 0);
if (numberValue->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
float fNumber = ValueToFloat(pThis, numberValue.get());
@@ -4391,9 +4503,9 @@
int32_t iIdentifier = 0;
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> identifierValue =
- GetSimpleValue(pThis, args, 1);
+ GetSimpleValue(pThis, info, 1);
if (identifierValue->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
iIdentifier =
@@ -4402,9 +4514,9 @@
ByteString bsLocale;
if (argc > 2) {
- std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, info, 2);
if (localeValue->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
bsLocale = ValueToUTF8String(localeValue.get());
@@ -4412,20 +4524,22 @@
if (std::isnan(fNumber) || fNumber < 0.0f ||
fNumber > 922337203685477550.0f) {
- args.GetReturnValue()->SetString("*");
+ pRetValue->SetString("*");
return;
}
- args.GetReturnValue()->SetString(
+ pRetValue->SetString(
WordUS(ByteString::Format("%.2f", fNumber), iIdentifier).AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Get(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Get(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 1) {
+ if (info.Length() != 1) {
pContext->ThrowParamCountMismatchException(L"Get");
return;
}
@@ -4438,7 +4552,7 @@
if (!pAppProvider)
return;
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
ByteString bsUrl = ValueToUTF8String(argOne.get());
RetainPtr<IFX_SeekableReadStream> pFile =
pAppProvider->DownloadURL(WideString::FromUTF8(bsUrl.AsStringView()));
@@ -4448,15 +4562,17 @@
int32_t size = pFile->GetSize();
std::vector<uint8_t> dataBuf(size);
pFile->ReadBlock(dataBuf.data(), size);
- args.GetReturnValue()->SetString(ByteStringView(dataBuf));
+ pRetValue->SetString(ByteStringView(dataBuf));
}
// static
-void CFXJSE_FormCalcContext::Post(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Post(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- int32_t argc = args.GetLength();
+ int32_t argc = info.Length();
if (argc < 2 || argc > 5) {
pContext->ThrowParamCountMismatchException(L"Post");
return;
@@ -4470,27 +4586,27 @@
if (!pAppProvider)
return;
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
ByteString bsURL = ValueToUTF8String(argOne.get());
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
ByteString bsData = ValueToUTF8String(argTwo.get());
ByteString bsContentType;
if (argc > 2) {
- std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
bsContentType = ValueToUTF8String(argThree.get());
}
ByteString bsEncode;
if (argc > 3) {
- std::unique_ptr<CFXJSE_Value> argFour = GetSimpleValue(pThis, args, 3);
+ std::unique_ptr<CFXJSE_Value> argFour = GetSimpleValue(pThis, info, 3);
bsEncode = ValueToUTF8String(argFour.get());
}
ByteString bsHeader;
if (argc > 4) {
- std::unique_ptr<CFXJSE_Value> argFive = GetSimpleValue(pThis, args, 4);
+ std::unique_ptr<CFXJSE_Value> argFive = GetSimpleValue(pThis, info, 4);
bsHeader = ValueToUTF8String(argFive.get());
}
@@ -4504,15 +4620,17 @@
pContext->ThrowServerDeniedException();
return;
}
- args.GetReturnValue()->SetString(decodedResponse.ToUTF8().AsStringView());
+ pRetValue->SetString(decodedResponse.ToUTF8().AsStringView());
}
// static
-void CFXJSE_FormCalcContext::Put(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::Put(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- int32_t argc = args.GetLength();
+ int32_t argc = info.Length();
if (argc < 2 || argc > 3) {
pContext->ThrowParamCountMismatchException(L"Put");
return;
@@ -4526,15 +4644,15 @@
if (!pAppProvider)
return;
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
ByteString bsURL = ValueToUTF8String(argOne.get());
- std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
ByteString bsData = ValueToUTF8String(argTwo.get());
ByteString bsEncode;
if (argc > 2) {
- std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2);
+ std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
bsEncode = ValueToUTF8String(argThree.get());
}
@@ -4546,21 +4664,23 @@
return;
}
- args.GetReturnValue()->SetString("");
+ pRetValue->SetString("");
}
// static
-void CFXJSE_FormCalcContext::assign_value_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::assign_value_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 2) {
+ if (info.Length() != 2) {
pContext->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> lValue = args.GetValue(0);
- std::unique_ptr<CFXJSE_Value> rValue = GetSimpleValue(pThis, args, 1);
+ auto lValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ std::unique_ptr<CFXJSE_Value> rValue = GetSimpleValue(pThis, info, 1);
if (lValue->IsArray()) {
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
auto leftLengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
@@ -4590,122 +4710,127 @@
return;
}
}
- args.GetReturnValue()->Assign(rValue.get());
+ pRetValue->Assign(rValue.get());
}
// static
-void CFXJSE_FormCalcContext::logical_or_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 2) {
+void CFXJSE_FormCalcContext::logical_or_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1);
- if (argFirst->IsNull() && argSecond->IsNull()) {
- args.GetReturnValue()->SetNull();
+ std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> infoecond = GetSimpleValue(pThis, info, 1);
+ if (argFirst->IsNull() && infoecond->IsNull()) {
+ pRetValue->SetNull();
return;
}
float first = ValueToFloat(pThis, argFirst.get());
- float second = ValueToFloat(pThis, argSecond.get());
- args.GetReturnValue()->SetInteger((first || second) ? 1 : 0);
+ float second = ValueToFloat(pThis, infoecond.get());
+ pRetValue->SetInteger((first || second) ? 1 : 0);
}
// static
-void CFXJSE_FormCalcContext::logical_and_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 2) {
+void CFXJSE_FormCalcContext::logical_and_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1);
- if (argFirst->IsNull() && argSecond->IsNull()) {
- args.GetReturnValue()->SetNull();
+ std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> infoecond = GetSimpleValue(pThis, info, 1);
+ if (argFirst->IsNull() && infoecond->IsNull()) {
+ pRetValue->SetNull();
return;
}
float first = ValueToFloat(pThis, argFirst.get());
- float second = ValueToFloat(pThis, argSecond.get());
- args.GetReturnValue()->SetInteger((first && second) ? 1 : 0);
+ float second = ValueToFloat(pThis, infoecond.get());
+ pRetValue->SetInteger((first && second) ? 1 : 0);
}
// static
-void CFXJSE_FormCalcContext::equality_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 2) {
+void CFXJSE_FormCalcContext::equality_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
- if (fm_ref_equal(pThis, args)) {
- args.GetReturnValue()->SetInteger(1);
+ if (fm_ref_equal(pThis, info)) {
+ pRetValue->SetInteger(1);
return;
}
- std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1);
- if (argFirst->IsNull() || argSecond->IsNull()) {
- args.GetReturnValue()->SetInteger(
- (argFirst->IsNull() && argSecond->IsNull()) ? 1 : 0);
+ std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> infoecond = GetSimpleValue(pThis, info, 1);
+ if (argFirst->IsNull() || infoecond->IsNull()) {
+ pRetValue->SetInteger((argFirst->IsNull() && infoecond->IsNull()) ? 1 : 0);
return;
}
- if (argFirst->IsString() && argSecond->IsString()) {
- args.GetReturnValue()->SetInteger(argFirst->ToString() ==
- argSecond->ToString());
+ if (argFirst->IsString() && infoecond->IsString()) {
+ pRetValue->SetInteger(argFirst->ToString() == infoecond->ToString());
return;
}
double first = ValueToDouble(pThis, argFirst.get());
- double second = ValueToDouble(pThis, argSecond.get());
- args.GetReturnValue()->SetInteger((first == second) ? 1 : 0);
+ double second = ValueToDouble(pThis, infoecond.get());
+ pRetValue->SetInteger((first == second) ? 1 : 0);
}
// static
-void CFXJSE_FormCalcContext::notequality_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 2) {
+void CFXJSE_FormCalcContext::notequality_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
- if (fm_ref_equal(pThis, args)) {
- args.GetReturnValue()->SetInteger(0);
+ if (fm_ref_equal(pThis, info)) {
+ pRetValue->SetInteger(0);
return;
}
- std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1);
- if (argFirst->IsNull() || argSecond->IsNull()) {
- args.GetReturnValue()->SetInteger(
- (argFirst->IsNull() && argSecond->IsNull()) ? 0 : 1);
+ std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> infoecond = GetSimpleValue(pThis, info, 1);
+ if (argFirst->IsNull() || infoecond->IsNull()) {
+ pRetValue->SetInteger((argFirst->IsNull() && infoecond->IsNull()) ? 0 : 1);
return;
}
- if (argFirst->IsString() && argSecond->IsString()) {
- args.GetReturnValue()->SetInteger(argFirst->ToString() !=
- argSecond->ToString());
+ if (argFirst->IsString() && infoecond->IsString()) {
+ pRetValue->SetInteger(argFirst->ToString() != infoecond->ToString());
return;
}
double first = ValueToDouble(pThis, argFirst.get());
- double second = ValueToDouble(pThis, argSecond.get());
- args.GetReturnValue()->SetInteger(first != second);
+ double second = ValueToDouble(pThis, infoecond.get());
+ pRetValue->SetInteger(first != second);
}
// static
-bool CFXJSE_FormCalcContext::fm_ref_equal(CFXJSE_Value* pThis,
- CFXJSE_Arguments& args) {
- std::unique_ptr<CFXJSE_Value> argFirst = args.GetValue(0);
- std::unique_ptr<CFXJSE_Value> argSecond = args.GetValue(1);
+bool CFXJSE_FormCalcContext::fm_ref_equal(
+ CFXJSE_Value* pThis,
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
+ auto argFirst = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argSecond = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[1]);
if (!argFirst->IsArray() || !argSecond->IsArray())
return false;
@@ -4728,197 +4853,211 @@
}
// static
-void CFXJSE_FormCalcContext::less_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 2) {
+void CFXJSE_FormCalcContext::less_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, info, 1);
if (argFirst->IsNull() || argSecond->IsNull()) {
- args.GetReturnValue()->SetInteger(0);
+ pRetValue->SetInteger(0);
return;
}
if (argFirst->IsString() && argSecond->IsString()) {
int result =
argFirst->ToString().Compare(argSecond->ToString().AsStringView()) < 0;
- args.GetReturnValue()->SetInteger(result);
+ pRetValue->SetInteger(result);
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, argSecond.get());
- args.GetReturnValue()->SetInteger((first < second) ? 1 : 0);
+ pRetValue->SetInteger((first < second) ? 1 : 0);
}
// static
-void CFXJSE_FormCalcContext::lessequal_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 2) {
+void CFXJSE_FormCalcContext::lessequal_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, info, 1);
if (argFirst->IsNull() || argSecond->IsNull()) {
- args.GetReturnValue()->SetInteger(
- (argFirst->IsNull() && argSecond->IsNull()) ? 1 : 0);
+ pRetValue->SetInteger((argFirst->IsNull() && argSecond->IsNull()) ? 1 : 0);
return;
}
if (argFirst->IsString() && argSecond->IsString()) {
int result =
argFirst->ToString().Compare(argSecond->ToString().AsStringView()) <= 0;
- args.GetReturnValue()->SetInteger(result);
+ pRetValue->SetInteger(result);
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, argSecond.get());
- args.GetReturnValue()->SetInteger((first <= second) ? 1 : 0);
+ pRetValue->SetInteger((first <= second) ? 1 : 0);
}
// static
-void CFXJSE_FormCalcContext::greater_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 2) {
+void CFXJSE_FormCalcContext::greater_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, info, 1);
if (argFirst->IsNull() || argSecond->IsNull()) {
- args.GetReturnValue()->SetInteger(0);
+ pRetValue->SetInteger(0);
return;
}
if (argFirst->IsString() && argSecond->IsString()) {
int result =
argFirst->ToString().Compare(argSecond->ToString().AsStringView()) > 0;
- args.GetReturnValue()->SetInteger(result);
+ pRetValue->SetInteger(result);
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, argSecond.get());
- args.GetReturnValue()->SetInteger((first > second) ? 1 : 0);
+ pRetValue->SetInteger((first > second) ? 1 : 0);
}
// static
-void CFXJSE_FormCalcContext::greaterequal_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 2) {
+void CFXJSE_FormCalcContext::greaterequal_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, info, 1);
if (argFirst->IsNull() || argSecond->IsNull()) {
- args.GetReturnValue()->SetInteger(
- (argFirst->IsNull() && argSecond->IsNull()) ? 1 : 0);
+ pRetValue->SetInteger((argFirst->IsNull() && argSecond->IsNull()) ? 1 : 0);
return;
}
if (argFirst->IsString() && argSecond->IsString()) {
int result =
argFirst->ToString().Compare(argSecond->ToString().AsStringView()) >= 0;
- args.GetReturnValue()->SetInteger(result);
+ pRetValue->SetInteger(result);
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, argSecond.get());
- args.GetReturnValue()->SetInteger((first >= second) ? 1 : 0);
+ pRetValue->SetInteger((first >= second) ? 1 : 0);
}
// static
-void CFXJSE_FormCalcContext::plus_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 2) {
+void CFXJSE_FormCalcContext::plus_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> argFirst = args.GetValue(0);
- std::unique_ptr<CFXJSE_Value> argSecond = args.GetValue(1);
+ auto argFirst = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argSecond = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[1]);
if (ValueIsNull(pThis, argFirst.get()) &&
ValueIsNull(pThis, argSecond.get())) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, argSecond.get());
- args.GetReturnValue()->SetDouble(first + second);
+ pRetValue->SetDouble(first + second);
}
// static
-void CFXJSE_FormCalcContext::minus_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 2) {
+void CFXJSE_FormCalcContext::minus_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, info, 1);
if (argFirst->IsNull() && argSecond->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, argSecond.get());
- args.GetReturnValue()->SetDouble(first - second);
+ pRetValue->SetDouble(first - second);
}
// static
-void CFXJSE_FormCalcContext::multiple_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 2) {
+void CFXJSE_FormCalcContext::multiple_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, info, 1);
if (argFirst->IsNull() && argSecond->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, argSecond.get());
- args.GetReturnValue()->SetDouble(first * second);
+ pRetValue->SetDouble(first * second);
}
// static
-void CFXJSE_FormCalcContext::divide_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::divide_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 2) {
+ if (info.Length() != 2) {
pContext->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0);
- std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1);
+ std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, info, 0);
+ std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, info, 1);
if (argFirst->IsNull() && argSecond->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
@@ -4929,87 +5068,99 @@
}
double first = ValueToDouble(pThis, argFirst.get());
- args.GetReturnValue()->SetDouble(first / second);
+ pRetValue->SetDouble(first / second);
}
// static
-void CFXJSE_FormCalcContext::positive_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
+void CFXJSE_FormCalcContext::positive_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (argOne->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
- args.GetReturnValue()->SetDouble(0.0 + ValueToDouble(pThis, argOne.get()));
+ pRetValue->SetDouble(0.0 + ValueToDouble(pThis, argOne.get()));
}
// static
-void CFXJSE_FormCalcContext::negative_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
+void CFXJSE_FormCalcContext::negative_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (argOne->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
- args.GetReturnValue()->SetDouble(0.0 - ValueToDouble(pThis, argOne.get()));
+ pRetValue->SetDouble(0.0 - ValueToDouble(pThis, argOne.get()));
}
// static
-void CFXJSE_FormCalcContext::logical_not_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
+void CFXJSE_FormCalcContext::logical_not_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (argOne->IsNull()) {
- args.GetReturnValue()->SetNull();
+ pRetValue->SetNull();
return;
}
double first = ValueToDouble(pThis, argOne.get());
- args.GetReturnValue()->SetInteger((first == 0.0) ? 1 : 0);
+ pRetValue->SetInteger((first == 0.0) ? 1 : 0);
}
// static
-void CFXJSE_FormCalcContext::dot_accessor(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- DotAccessorCommon(pThis, bsFuncName, args, /*bDotAccessor=*/true);
+void CFXJSE_FormCalcContext::dot_accessor(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ DotAccessorCommon(pThis, bsFuncName, info, pRetValue, /*bDotAccessor=*/true);
}
// static
-void CFXJSE_FormCalcContext::dotdot_accessor(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- DotAccessorCommon(pThis, bsFuncName, args, /*bDotAccessor=*/false);
+void CFXJSE_FormCalcContext::dotdot_accessor(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ DotAccessorCommon(pThis, bsFuncName, info, pRetValue, /*bDotAccessor=*/false);
}
// static
-void CFXJSE_FormCalcContext::eval_translation(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::eval_translation(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 1) {
+ if (info.Length() != 1) {
pContext->ThrowParamCountMismatchException(L"Eval");
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
+ std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
ByteString bsArg = ValueToUTF8String(argOne.get());
if (bsArg.IsEmpty()) {
pContext->ThrowArgumentMismatchException();
@@ -5024,47 +5175,53 @@
return;
}
- args.GetReturnValue()->SetString(
+ pRetValue->SetString(
FX_UTF8Encode(wsJavaScriptBuf.AsStringView()).AsStringView());
}
// static
-void CFXJSE_FormCalcContext::is_fm_object(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
- args.GetReturnValue()->SetBoolean(false);
+void CFXJSE_FormCalcContext::is_fm_object(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
+ pRetValue->SetBoolean(false);
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
- args.GetReturnValue()->SetBoolean(argOne->IsObject());
+ auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ pRetValue->SetBoolean(argOne->IsObject());
}
// static
-void CFXJSE_FormCalcContext::is_fm_array(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
- args.GetReturnValue()->SetBoolean(false);
+void CFXJSE_FormCalcContext::is_fm_array(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
+ pRetValue->SetBoolean(false);
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
- args.GetReturnValue()->SetBoolean(argOne->IsArray());
+ auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ pRetValue->SetBoolean(argOne->IsArray());
}
// static
-void CFXJSE_FormCalcContext::get_fm_value(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::get_fm_value(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 1) {
+ if (info.Length() != 1) {
pContext->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
+ auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (argOne->IsArray()) {
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
@@ -5072,35 +5229,37 @@
argOne->GetObjectPropertyByIdx(1, propertyValue.get());
argOne->GetObjectPropertyByIdx(2, jsObjectValue.get());
if (propertyValue->IsNull()) {
- GetObjectDefaultValue(jsObjectValue.get(), args.GetReturnValue());
+ GetObjectDefaultValue(jsObjectValue.get(), pRetValue);
return;
}
jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(),
- args.GetReturnValue());
+ pRetValue);
return;
}
if (argOne->IsObject()) {
- GetObjectDefaultValue(argOne.get(), args.GetReturnValue());
+ GetObjectDefaultValue(argOne.get(), pRetValue);
return;
}
- args.GetReturnValue()->Assign(argOne.get());
+ pRetValue->Assign(argOne.get());
}
// static
-void CFXJSE_FormCalcContext::get_fm_jsobj(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
- if (args.GetLength() != 1) {
+void CFXJSE_FormCalcContext::get_fm_jsobj(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
+ if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
- std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
+ auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (!argOne->IsArray()) {
- args.GetReturnValue()->Assign(argOne.get());
+ pRetValue->Assign(argOne.get());
return;
}
@@ -5112,24 +5271,26 @@
ASSERT(lengthValue->ToInteger() >= 3);
#endif
- argOne->GetObjectPropertyByIdx(2, args.GetReturnValue());
+ argOne->GetObjectPropertyByIdx(2, pRetValue);
}
// static
-void CFXJSE_FormCalcContext::fm_var_filter(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::fm_var_filter(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
- if (args.GetLength() != 1) {
+ if (info.Length() != 1) {
pContext->ThrowCompilerErrorException();
return;
}
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
- std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
+ auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (!argOne->IsArray()) {
- std::unique_ptr<CFXJSE_Value> simpleValue = GetSimpleValue(pThis, args, 0);
- args.GetReturnValue()->Assign(simpleValue.get());
+ std::unique_ptr<CFXJSE_Value> simpleValue = GetSimpleValue(pThis, info, 0);
+ pRetValue->Assign(simpleValue.get());
return;
}
@@ -5143,8 +5304,8 @@
argOne->GetObjectPropertyByIdx(0, flagsValue.get());
int32_t iFlags = flagsValue->ToInteger();
if (iFlags != 3 && iFlags != 4) {
- std::unique_ptr<CFXJSE_Value> simpleValue = GetSimpleValue(pThis, args, 0);
- args.GetReturnValue()->Assign(simpleValue.get());
+ std::unique_ptr<CFXJSE_Value> simpleValue = GetSimpleValue(pThis, info, 0);
+ pRetValue->Assign(simpleValue.get());
return;
}
@@ -5156,7 +5317,7 @@
values[0]->SetInteger(3);
values[1]->SetNull();
values[2]->SetNull();
- args.GetReturnValue()->SetArray(values);
+ pRetValue->SetArray(values);
return;
}
@@ -5166,17 +5327,19 @@
pContext->ThrowCompilerErrorException();
return;
}
- args.GetReturnValue()->Assign(argOne.get());
+ pRetValue->Assign(argOne.get());
}
// static
-void CFXJSE_FormCalcContext::concat_fm_object(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args) {
+void CFXJSE_FormCalcContext::concat_fm_object(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue) {
v8::Isolate* pIsolate = ToFormCalcContext(pThis)->GetScriptRuntime();
std::vector<std::unique_ptr<CFXJSE_Value>> returnValues;
- for (int32_t i = 0; i < args.GetLength(); ++i) {
- std::unique_ptr<CFXJSE_Value> argValue = args.GetValue(i);
+ for (int32_t i = 0; i < info.Length(); ++i) {
+ auto argValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate, info[i]);
if (argValue->IsArray()) {
auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
argValue->GetObjectProperty("length", lengthValue.get());
@@ -5189,18 +5352,19 @@
returnValues.push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
returnValues.back()->Assign(argValue.get());
}
- args.GetReturnValue()->SetArray(returnValues);
+ pRetValue->SetArray(returnValues);
}
// static
std::unique_ptr<CFXJSE_Value> CFXJSE_FormCalcContext::GetSimpleValue(
CFXJSE_Value* pThis,
- CFXJSE_Arguments& args,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
uint32_t index) {
v8::Isolate* pIsolate = ToFormCalcContext(pThis)->GetScriptRuntime();
- ASSERT(index < (uint32_t)args.GetLength());
+ ASSERT(index < (uint32_t)info.Length());
- std::unique_ptr<CFXJSE_Value> argIndex = args.GetValue(index);
+ auto argIndex =
+ pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[index]);
if (!argIndex->IsArray() && !argIndex->IsObject())
return argIndex;
@@ -5307,11 +5471,11 @@
// static
std::vector<std::unique_ptr<CFXJSE_Value>> CFXJSE_FormCalcContext::unfoldArgs(
CFXJSE_Value* pThis,
- CFXJSE_Arguments& args) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
std::vector<std::unique_ptr<CFXJSE_Value>> results;
v8::Isolate* pIsolate = ToFormCalcContext(pThis)->GetScriptRuntime();
- for (int32_t i = 1; i < args.GetLength(); ++i) {
- std::unique_ptr<CFXJSE_Value> arg = args.GetValue(i);
+ for (int32_t i = 1; i < info.Length(); ++i) {
+ auto arg = pdfium::MakeUnique<CFXJSE_Value>(pIsolate, info[i]);
if (arg->IsArray()) {
auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
arg->GetObjectProperty("length", lengthValue.get());
@@ -5682,13 +5846,15 @@
}
// static
-void CFXJSE_FormCalcContext::DotAccessorCommon(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args,
- bool bDotAccessor) {
+void CFXJSE_FormCalcContext::DotAccessorCommon(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue,
+ bool bDotAccessor) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
- int32_t argc = args.GetLength();
+ int32_t argc = info.Length();
if (argc < 4 || argc > 5) {
pContext->ThrowCompilerErrorException();
return;
@@ -5698,15 +5864,20 @@
int32_t iIndexValue = 0;
if (argc > 4) {
bIsStar = false;
- iIndexValue = ValueToInteger(pThis, args.GetValue(4).get());
+ auto temp = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[4]);
+ iIndexValue = ValueToInteger(pThis, temp.get());
}
- const ByteString bsName = args.GetUTF8String(2);
+ const ByteString bsName =
+ CFX_V8::ReentrantToByteStringHelper(info.GetIsolate(), info[2]);
const bool bHasNoResolveName = bDotAccessor && bsName.IsEmpty();
ByteString bsSomExp = GenerateSomExpression(
- bsName.AsStringView(), args.GetInt32(3), iIndexValue, bIsStar);
+ bsName.AsStringView(),
+ CFX_V8::ReentrantToInt32Helper(info.GetIsolate(), info[3]), iIndexValue,
+ bIsStar);
- std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0);
+ auto argAccessor =
+ pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (argAccessor->IsArray()) {
auto pLengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
argAccessor->GetObjectProperty("length", pLengthValue.get());
@@ -5753,13 +5924,14 @@
values.back()->Assign(resolveValues[i][j].get());
}
}
- args.GetReturnValue()->SetArray(values);
+ pRetValue->SetArray(values);
return;
}
XFA_RESOLVENODE_RS resolveNodeRS;
bool bRet = false;
- ByteString bsAccessorName = args.GetUTF8String(1);
+ ByteString bsAccessorName =
+ CFX_V8::ReentrantToByteStringHelper(info.GetIsolate(), info[1]);
if (argAccessor->IsObject() ||
(argAccessor->IsNull() && bsAccessorName.IsEmpty())) {
bRet = ResolveObjects(pThis, argAccessor.get(), bsSomExp.AsStringView(),
@@ -5795,7 +5967,7 @@
for (size_t i = 0; i < resolveValues.size(); i++)
values[i + 2]->Assign(resolveValues[i].get());
- args.GetReturnValue()->SetArray(values);
+ pRetValue->SetArray(values);
}
void CFXJSE_FormCalcContext::ThrowNoDefaultPropertyException(
diff --git a/fxjs/xfa/cfxjse_formcalc_context.h b/fxjs/xfa/cfxjse_formcalc_context.h
index d0c1dce..6d92b75 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.h
+++ b/fxjs/xfa/cfxjse_formcalc_context.h
@@ -14,7 +14,6 @@
#include "fxjs/xfa/fxjse.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
-class CFXJSE_Arguments;
class CFXJSE_Context;
class CFX_WideTextBuf;
class CXFA_Document;
@@ -31,73 +30,96 @@
static void Abs(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Avg(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Ceil(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Count(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Floor(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Max(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Min(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Mod(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Round(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Sum(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Date(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Date2Num(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void DateFmt(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void IsoDate2Num(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void IsoTime2Num(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void LocalDateFmt(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void LocalTimeFmt(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Num2Date(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Num2GMTime(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Num2Time(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Time(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Time2Num(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void TimeFmt(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static ByteString Local2IsoDate(CFXJSE_Value* pThis,
ByteStringView bsDate,
@@ -133,211 +155,287 @@
static void Apr(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void CTerm(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void FV(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void IPmt(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void NPV(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Pmt(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void PPmt(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void PV(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Rate(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Term(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Choose(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Exists(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void HasValue(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Oneof(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Within(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void If(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Eval(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Ref(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void UnitType(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void UnitValue(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void At(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Concat(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Decode(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Encode(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Format(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Left(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Len(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Lower(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Ltrim(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Parse(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Replace(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Right(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Rtrim(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Space(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Str(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Stuff(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Substr(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Uuid(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Upper(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void WordNum(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Get(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Post(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void Put(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
- static void assign_value_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
- static void logical_or_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
- static void logical_and_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
+ static void assign_value_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
+ static void logical_or_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
+ static void logical_and_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void equality_operator(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
- static void notequality_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
- static bool fm_ref_equal(CFXJSE_Value* pThis, CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
+ static void notequality_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
+ static bool fm_ref_equal(CFXJSE_Value* pThis,
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void less_operator(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
- static void lessequal_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
+ static void lessequal_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void greater_operator(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
- static void greaterequal_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
+ static void greaterequal_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void plus_operator(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void minus_operator(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void multiple_operator(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void divide_operator(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void positive_operator(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void negative_operator(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
- static void logical_not_operator(CFXJSE_Value* pThis,
- ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
+ static void logical_not_operator(
+ CFXJSE_Value* pThis,
+ ByteStringView bsFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void dot_accessor(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void dotdot_accessor(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void eval_translation(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void is_fm_object(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void is_fm_array(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void get_fm_value(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void get_fm_jsobj(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void fm_var_filter(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static void concat_fm_object(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
static int32_t hvalue_get_array_length(CFXJSE_Value* pThis,
CFXJSE_Value* arg);
@@ -346,7 +444,7 @@
CFXJSE_Value* secondValue);
static std::vector<std::unique_ptr<CFXJSE_Value>> unfoldArgs(
CFXJSE_Value* pThis,
- CFXJSE_Arguments& args);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static ByteString GenerateSomExpression(ByteStringView bsName,
int32_t iIndexFlags,
int32_t iIndexValue,
@@ -367,9 +465,10 @@
std::vector<std::unique_ptr<CFXJSE_Value>>* resultValues,
bool* bAttribute);
- static std::unique_ptr<CFXJSE_Value> GetSimpleValue(CFXJSE_Value* pThis,
- CFXJSE_Arguments& args,
- uint32_t index);
+ static std::unique_ptr<CFXJSE_Value> GetSimpleValue(
+ CFXJSE_Value* pThis,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ uint32_t index);
static bool ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* pValue);
static int32_t ValueToInteger(CFXJSE_Value* pThis, CFXJSE_Value* pValue);
static float ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* pValue);
@@ -387,7 +486,8 @@
private:
static void DotAccessorCommon(CFXJSE_Value* pThis,
ByteStringView bsFuncName,
- CFXJSE_Arguments& args,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue,
bool bDotAccessor);
v8::Isolate* GetScriptRuntime() const { return m_pIsolate.Get(); }
diff --git a/fxjs/xfa/cfxjse_value.cpp b/fxjs/xfa/cfxjse_value.cpp
index 41e64c1..d308d43 100644
--- a/fxjs/xfa/cfxjse_value.cpp
+++ b/fxjs/xfa/cfxjse_value.cpp
@@ -70,6 +70,11 @@
CFXJSE_Value::CFXJSE_Value(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {}
+CFXJSE_Value::CFXJSE_Value(v8::Isolate* pIsolate, v8::Local<v8::Value> value)
+ : m_pIsolate(pIsolate) {
+ ForceSetValue(value);
+}
+
CFXJSE_Value::~CFXJSE_Value() {}
CFXJSE_HostObject* CFXJSE_Value::ToHostObject() const {
diff --git a/fxjs/xfa/cfxjse_value.h b/fxjs/xfa/cfxjse_value.h
index 4733dbd..5503c28 100644
--- a/fxjs/xfa/cfxjse_value.h
+++ b/fxjs/xfa/cfxjse_value.h
@@ -21,6 +21,7 @@
class CFXJSE_Value {
public:
explicit CFXJSE_Value(v8::Isolate* pIsolate);
+ CFXJSE_Value(v8::Isolate* pIsolate, v8::Local<v8::Value> value);
~CFXJSE_Value();
bool IsEmpty() const;
diff --git a/fxjs/xfa/fxjse.h b/fxjs/xfa/fxjse.h
index 5aa6b39..b9ba73a 100644
--- a/fxjs/xfa/fxjse.h
+++ b/fxjs/xfa/fxjse.h
@@ -20,7 +20,6 @@
} // namespace fxjse
} // namespace pdfium
-class CFXJSE_Arguments;
class CFXJSE_FormCalcContext;
class CFXJSE_Value;
class CJS_Result;
@@ -42,9 +41,11 @@
typedef CJS_Result (*FXJSE_MethodCallback)(
const v8::FunctionCallbackInfo<v8::Value>& info,
const WideString& functionName);
-typedef void (*FXJSE_FuncCallback)(CFXJSE_Value* pThis,
- ByteStringView szFuncName,
- CFXJSE_Arguments& args);
+typedef void (*FXJSE_FuncCallback)(
+ CFXJSE_Value* pThis,
+ ByteStringView szFuncName,
+ const v8::FunctionCallbackInfo<v8::Value>& info,
+ CFXJSE_Value* pRetValue);
typedef void (*FXJSE_PropAccessor)(CFXJSE_Value* pObject,
ByteStringView szPropName,
CFXJSE_Value* pValue);