Remove use of CFXJSE_Value to return formcalc JS results.
Set it directly into the v8 arguments structure. V8 has its
own perfectly-fine helpers to set most basic scalar types as
a return value, so they do not need to be wrapped. Aggregate
types and strings still get a little help.
-- Also add a new string helper along the way.
Change-Id: Ie88c8ec5a7e9e86a9371679beaa13a2e4ad3e1e1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/67430
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/cfx_v8.cpp b/fxjs/cfx_v8.cpp
index ad5d25e..ec18cda 100644
--- a/fxjs/cfx_v8.cpp
+++ b/fxjs/cfx_v8.cpp
@@ -110,9 +110,7 @@
v8::Local<v8::String> CFX_V8::NewString(ByteStringView str) {
v8::Isolate* pIsolate = m_pIsolate ? GetIsolate() : v8::Isolate::GetCurrent();
- return v8::String::NewFromUtf8(pIsolate, str.unterminated_c_str(),
- v8::NewStringType::kNormal, str.GetLength())
- .ToLocalChecked();
+ return NewStringHelper(pIsolate, str);
}
v8::Local<v8::String> CFX_V8::NewString(WideStringView str) {
@@ -171,6 +169,14 @@
}
// static
+v8::Local<v8::String> CFX_V8::NewStringHelper(v8::Isolate* pIsolate,
+ ByteStringView str) {
+ return v8::String::NewFromUtf8(pIsolate, str.unterminated_c_str(),
+ v8::NewStringType::kNormal, str.GetLength())
+ .ToLocalChecked();
+}
+
+// static
int CFX_V8::ReentrantToInt32Helper(v8::Isolate* pIsolate,
v8::Local<v8::Value> pValue) {
if (pValue.IsEmpty())
diff --git a/fxjs/cfx_v8.h b/fxjs/cfx_v8.h
index 210df7e..cce64e3 100644
--- a/fxjs/cfx_v8.h
+++ b/fxjs/cfx_v8.h
@@ -15,6 +15,9 @@
class CFX_V8 {
public:
+ static v8::Local<v8::String> NewStringHelper(v8::Isolate* pIsolate,
+ ByteStringView str);
+
static int ReentrantToInt32Helper(v8::Isolate* pIsolate,
v8::Local<v8::Value> pValue);
static bool ReentrantToBooleanHelper(v8::Isolate* pIsolate,
diff --git a/fxjs/xfa/cfxjse_class.cpp b/fxjs/xfa/cfxjse_class.cpp
index ae6d8cb..f00cbed 100644
--- a/fxjs/xfa/cfxjse_class.cpp
+++ b/fxjs/xfa/cfxjse_class.cpp
@@ -40,10 +40,7 @@
auto lpThisValue =
pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info.Holder());
- auto lpRetValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
- lpFunctionInfo->callbackProc(lpThisValue.get(), info, lpRetValue.get());
- if (!lpRetValue->DirectGetValue().IsEmpty())
- info.GetReturnValue().Set(lpRetValue->DirectGetValue());
+ lpFunctionInfo->callbackProc(lpThisValue.get(), info);
}
void V8ConstructorCallback_Wrapper(
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index 1a4df5d..4b85ebb 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -1361,8 +1361,7 @@
// static
void CFXJSE_FormCalcContext::Abs(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Abs");
return;
@@ -1370,25 +1369,23 @@
auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (ValueIsNull(pThis, argOne.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
-
double dValue = ValueToDouble(pThis, argOne.get());
if (dValue < 0)
dValue = -dValue;
- pRetValue->SetDouble(dValue);
+ info.GetReturnValue().Set(dValue);
}
// static
void CFXJSE_FormCalcContext::Avg(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 1) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -1443,18 +1440,17 @@
}
}
if (uCount == 0) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
- pRetValue->SetDouble(dSum / uCount);
+ info.GetReturnValue().Set(dSum / uCount);
}
// static
void CFXJSE_FormCalcContext::Ceil(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Ceil");
return;
@@ -1462,18 +1458,17 @@
std::unique_ptr<CFXJSE_Value> argValue = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argValue.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
- pRetValue->SetFloat(ceil(ValueToFloat(pThis, argValue.get())));
+ info.GetReturnValue().Set(ceil(ValueToFloat(pThis, argValue.get())));
}
// static
void CFXJSE_FormCalcContext::Count(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
int32_t iCount = 0;
@@ -1522,14 +1517,13 @@
iCount++;
}
}
- pRetValue->SetInteger(iCount);
+ info.GetReturnValue().Set(iCount);
}
// static
void CFXJSE_FormCalcContext::Floor(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Floor");
return;
@@ -1537,18 +1531,17 @@
std::unique_ptr<CFXJSE_Value> argValue = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argValue.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
- pRetValue->SetFloat(floor(ValueToFloat(pThis, argValue.get())));
+ info.GetReturnValue().Set(floor(ValueToFloat(pThis, argValue.get())));
}
// static
void CFXJSE_FormCalcContext::Max(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
uint32_t uCount = 0;
@@ -1613,18 +1606,16 @@
}
}
if (uCount == 0) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
-
- pRetValue->SetDouble(dMaxValue);
+ info.GetReturnValue().Set(dMaxValue);
}
// static
void CFXJSE_FormCalcContext::Min(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
uint32_t uCount = 0;
@@ -1689,18 +1680,17 @@
}
}
if (uCount == 0) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
- pRetValue->SetDouble(dMinValue);
+ info.GetReturnValue().Set(dMinValue);
}
// static
void CFXJSE_FormCalcContext::Mod(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 2) {
pContext->ThrowParamCountMismatchException(L"Mod");
@@ -1710,7 +1700,7 @@
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()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -1728,14 +1718,14 @@
return;
}
- pRetValue->SetDouble(dDividend - dDivisor * (int32_t)(dDividend / dDivisor));
+ info.GetReturnValue().Set(dDividend -
+ dDivisor * (int32_t)(dDividend / dDivisor));
}
// static
void CFXJSE_FormCalcContext::Round(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
int32_t argc = info.Length();
if (argc < 1 || argc > 2) {
@@ -1745,7 +1735,7 @@
auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (argOne->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -1760,7 +1750,7 @@
if (argc > 1) {
auto argTwo = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[1]);
if (argTwo->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -1775,17 +1765,16 @@
}
CFGAS_Decimal decimalValue(static_cast<float>(dValue), uPrecision);
- pRetValue->SetDouble(decimalValue.ToDouble());
+ info.GetReturnValue().Set(decimalValue.ToDouble());
}
// static
void CFXJSE_FormCalcContext::Sum(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc == 0) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -1848,18 +1837,17 @@
}
}
if (uCount == 0) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
- pRetValue->SetDouble(dSum);
+ info.GetReturnValue().Set(dSum);
}
// static
void CFXJSE_FormCalcContext::Date(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 0) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Date");
return;
@@ -1869,7 +1857,7 @@
FXSYS_time(¤tTime);
struct tm* pTmStruct = gmtime(¤tTime);
- pRetValue->SetInteger(DateString2Num(
+ info.GetReturnValue().Set(DateString2Num(
ByteString::Format("%d%02d%02d", pTmStruct->tm_year + 1900,
pTmStruct->tm_mon + 1, pTmStruct->tm_mday)
.AsStringView()));
@@ -1878,8 +1866,7 @@
// static
void CFXJSE_FormCalcContext::Date2Num(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 1 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Date2Num");
@@ -1888,7 +1875,7 @@
std::unique_ptr<CFXJSE_Value> dateValue = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, dateValue.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -1897,7 +1884,7 @@
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, info, 1);
if (ValueIsNull(pThis, formatValue.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsFormat = ValueToUTF8String(formatValue.get());
@@ -1907,7 +1894,7 @@
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, localeValue.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsLocale = ValueToUTF8String(localeValue.get());
@@ -1916,14 +1903,13 @@
ByteString bsIsoDate =
Local2IsoDate(pThis, bsDate.AsStringView(), bsFormat.AsStringView(),
bsLocale.AsStringView());
- pRetValue->SetInteger(DateString2Num(bsIsoDate.AsStringView()));
+ info.GetReturnValue().Set(DateString2Num(bsIsoDate.AsStringView()));
}
// static
void CFXJSE_FormCalcContext::DateFmt(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Date2Num");
@@ -1934,7 +1920,7 @@
if (argc > 0) {
std::unique_ptr<CFXJSE_Value> infotyle = GetSimpleValue(pThis, info, 0);
if (infotyle->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -1947,7 +1933,7 @@
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> argLocale = GetSimpleValue(pThis, info, 1);
if (argLocale->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsLocale = ValueToUTF8String(argLocale.get());
@@ -1955,32 +1941,31 @@
ByteString bsFormat =
GetStandardDateFormat(pThis, iStyle, bsLocale.AsStringView());
- pRetValue->SetString(bsFormat.AsStringView());
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), bsFormat.AsStringView()));
}
// static
void CFXJSE_FormCalcContext::IsoDate2Num(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"IsoDate2Num");
return;
}
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (argOne->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
ByteString bsArg = ValueToUTF8String(argOne.get());
- pRetValue->SetInteger(DateString2Num(bsArg.AsStringView()));
+ info.GetReturnValue().Set(DateString2Num(bsArg.AsStringView()));
}
// static
void CFXJSE_FormCalcContext::IsoTime2Num(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 1) {
pContext->ThrowParamCountMismatchException(L"IsoTime2Num");
@@ -1989,7 +1974,7 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -1998,7 +1983,7 @@
ByteString bsArg = ValueToUTF8String(argOne.get());
auto pos = bsArg.Find('T', 0);
if (!pos.has_value() || pos.value() == bsArg.GetLength() - 1) {
- pRetValue->SetInteger(0);
+ info.GetReturnValue().Set(0);
return;
}
bsArg = bsArg.Last(bsArg.GetLength() - (pos.value() + 1));
@@ -2006,7 +1991,7 @@
CXFA_LocaleValue timeValue(XFA_VT_TIME,
WideString::FromUTF8(bsArg.AsStringView()), pMgr);
if (!timeValue.IsValid()) {
- pRetValue->SetInteger(0);
+ info.GetReturnValue().Set(0);
return;
}
@@ -2027,15 +2012,14 @@
hour = mins / 60;
min = mins % 60;
- pRetValue->SetInteger(hour * 3600000 + min * 60000 + second * 1000 +
- milSecond + 1);
+ info.GetReturnValue().Set(hour * 3600000 + min * 60000 + second * 1000 +
+ milSecond + 1);
}
// static
void CFXJSE_FormCalcContext::LocalDateFmt(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"LocalDateFmt");
@@ -2046,7 +2030,7 @@
if (argc > 0) {
std::unique_ptr<CFXJSE_Value> infotyle = GetSimpleValue(pThis, info, 0);
if (infotyle->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
iStyle = (int32_t)ValueToFloat(pThis, infotyle.get());
@@ -2058,7 +2042,7 @@
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> argLocale = GetSimpleValue(pThis, info, 1);
if (argLocale->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsLocale = ValueToUTF8String(argLocale.get());
@@ -2066,14 +2050,14 @@
ByteString bsFormat =
GetLocalDateFormat(pThis, iStyle, bsLocale.AsStringView(), false);
- pRetValue->SetString(bsFormat.AsStringView());
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), bsFormat.AsStringView()));
}
// static
void CFXJSE_FormCalcContext::LocalTimeFmt(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"LocalTimeFmt");
@@ -2084,7 +2068,7 @@
if (argc > 0) {
std::unique_ptr<CFXJSE_Value> infotyle = GetSimpleValue(pThis, info, 0);
if (infotyle->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
iStyle = (int32_t)ValueToFloat(pThis, infotyle.get());
@@ -2096,7 +2080,7 @@
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> argLocale = GetSimpleValue(pThis, info, 1);
if (argLocale->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsLocale = ValueToUTF8String(argLocale.get());
@@ -2104,14 +2088,14 @@
ByteString bsFormat =
GetLocalTimeFormat(pThis, iStyle, bsLocale.AsStringView(), false);
- pRetValue->SetString(bsFormat.AsStringView());
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), bsFormat.AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Num2Date(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 1 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Num2Date");
@@ -2120,12 +2104,12 @@
std::unique_ptr<CFXJSE_Value> dateValue = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, dateValue.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
int32_t dDate = (int32_t)ValueToFloat(pThis, dateValue.get());
if (dDate < 1) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -2133,7 +2117,7 @@
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, info, 1);
if (ValueIsNull(pThis, formatValue.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsFormat = ValueToUTF8String(formatValue.get());
@@ -2143,7 +2127,7 @@
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, localeValue.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsLocale = ValueToUTF8String(localeValue.get());
@@ -2245,14 +2229,14 @@
pThis,
ByteString::Format("%d%02d%02d", iYear + i, iMonth, iDay).AsStringView(),
bsFormat.AsStringView(), bsLocale.AsStringView());
- pRetValue->SetString(bsLocalDate.AsStringView());
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), bsLocalDate.AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Num2GMTime(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 1 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Num2GMTime");
@@ -2261,12 +2245,12 @@
std::unique_ptr<CFXJSE_Value> timeValue = GetSimpleValue(pThis, info, 0);
if (timeValue->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
int32_t iTime = (int32_t)ValueToFloat(pThis, timeValue.get());
if (abs(iTime) < 1.0) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -2274,7 +2258,7 @@
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, info, 1);
if (formatValue->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsFormat = ValueToUTF8String(formatValue.get());
@@ -2284,7 +2268,7 @@
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, info, 2);
if (localeValue->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsLocale = ValueToUTF8String(localeValue.get());
@@ -2292,14 +2276,14 @@
ByteString bsGMTTime = Num2AllTime(pThis, iTime, bsFormat.AsStringView(),
bsLocale.AsStringView(), true);
- pRetValue->SetString(bsGMTTime.AsStringView());
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), bsGMTTime.AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Num2Time(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 1 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Num2Time");
@@ -2308,12 +2292,12 @@
std::unique_ptr<CFXJSE_Value> timeValue = GetSimpleValue(pThis, info, 0);
if (timeValue->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
float fTime = ValueToFloat(pThis, timeValue.get());
if (fabs(fTime) < 1.0) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -2321,7 +2305,7 @@
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, info, 1);
if (formatValue->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsFormat = ValueToUTF8String(formatValue.get());
@@ -2331,7 +2315,7 @@
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, info, 2);
if (localeValue->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsLocale = ValueToUTF8String(localeValue.get());
@@ -2340,14 +2324,14 @@
ByteString bsLocalTime =
Num2AllTime(pThis, static_cast<int32_t>(fTime), bsFormat.AsStringView(),
bsLocale.AsStringView(), false);
- pRetValue->SetString(bsLocalTime.AsStringView());
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), bsLocalTime.AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Time(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 0) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Time");
return;
@@ -2356,15 +2340,14 @@
time_t now;
FXSYS_time(&now);
struct tm* pGmt = gmtime(&now);
- pRetValue->SetInteger(
+ info.GetReturnValue().Set(
(pGmt->tm_hour * 3600 + pGmt->tm_min * 60 + pGmt->tm_sec) * 1000);
}
// static
void CFXJSE_FormCalcContext::Time2Num(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 1 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Time2Num");
@@ -2374,7 +2357,7 @@
ByteString bsTime;
std::unique_ptr<CFXJSE_Value> timeValue = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, timeValue.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsTime = ValueToUTF8String(timeValue.get());
@@ -2383,7 +2366,7 @@
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, info, 1);
if (ValueIsNull(pThis, formatValue.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsFormat = ValueToUTF8String(formatValue.get());
@@ -2393,7 +2376,7 @@
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, localeValue.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsLocale = ValueToUTF8String(localeValue.get());
@@ -2421,7 +2404,7 @@
WideString::FromUTF8(bsTime.AsStringView()),
wsFormat, pLocale, pMgr);
if (!localeValue.IsValid()) {
- pRetValue->SetInteger(0);
+ info.GetReturnValue().Set(0);
return;
}
@@ -2441,15 +2424,14 @@
hour = mins / 60;
min = mins % 60;
- pRetValue->SetInteger(hour * 3600000 + min * 60000 + second * 1000 +
- milSecond + 1);
+ info.GetReturnValue().Set(hour * 3600000 + min * 60000 + second * 1000 +
+ milSecond + 1);
}
// static
void CFXJSE_FormCalcContext::TimeFmt(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"TimeFmt");
@@ -2460,7 +2442,7 @@
if (argc > 0) {
std::unique_ptr<CFXJSE_Value> infotyle = GetSimpleValue(pThis, info, 0);
if (infotyle->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
iStyle = (int32_t)ValueToFloat(pThis, infotyle.get());
@@ -2472,7 +2454,7 @@
if (argc > 1) {
std::unique_ptr<CFXJSE_Value> argLocale = GetSimpleValue(pThis, info, 1);
if (argLocale->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsLocale = ValueToUTF8String(argLocale.get());
@@ -2480,7 +2462,8 @@
ByteString bsFormat =
GetStandardTimeFormat(pThis, iStyle, bsLocale.AsStringView());
- pRetValue->SetString(bsFormat.AsStringView());
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), bsFormat.AsStringView()));
}
// static
@@ -2624,8 +2607,7 @@
// static
void CFXJSE_FormCalcContext::Apr(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 3) {
pContext->ThrowParamCountMismatchException(L"Apr");
@@ -2637,7 +2619,7 @@
std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -2661,7 +2643,7 @@
(r * nTemp * nPeriods * (nTemp / (1 + r)))) /
((nTemp - 1) * (nTemp - 1));
if (nDerivative == 0) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -2672,14 +2654,13 @@
}
nRet = r * nTemp / (nTemp - 1) - nPayment / nPrincipal;
}
- pRetValue->SetDouble(r * 12);
+ info.GetReturnValue().Set(r * 12);
}
// static
void CFXJSE_FormCalcContext::CTerm(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 3) {
pContext->ThrowParamCountMismatchException(L"CTerm");
@@ -2691,7 +2672,7 @@
std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -2703,14 +2684,14 @@
return;
}
- pRetValue->SetFloat(log((float)(nFutureValue / nInitAmount)) /
- log((float)(1 + nRate)));
+ info.GetReturnValue().Set(log((float)(nFutureValue / nInitAmount)) /
+ log((float)(1 + nRate)));
}
// static
-void CFXJSE_FormCalcContext::FV(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+void CFXJSE_FormCalcContext::FV(
+ CFXJSE_Value* pThis,
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 3) {
pContext->ThrowParamCountMismatchException(L"FV");
@@ -2722,7 +2703,7 @@
std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -2745,14 +2726,13 @@
dResult = nAmount * nPeriod;
}
- pRetValue->SetDouble(dResult);
+ info.GetReturnValue().Set(dResult);
}
// static
void CFXJSE_FormCalcContext::IPmt(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 5) {
pContext->ThrowParamCountMismatchException(L"IPmt");
@@ -2767,7 +2747,7 @@
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get()) || ValueIsNull(pThis, argFour.get()) ||
ValueIsNull(pThis, argFive.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -2790,7 +2770,7 @@
int32_t iEnd = std::min((int32_t)(nFirstMonth + nNumberOfMonths - 1), iNums);
if (nPayment < nPrincipalAmount * nRateOfMonth) {
- pRetValue->SetFloat(0);
+ info.GetReturnValue().Set(0);
return;
}
@@ -2803,14 +2783,13 @@
nSum += nPrincipalAmount * nRateOfMonth;
nPrincipalAmount -= nPayment - nPrincipalAmount * nRateOfMonth;
}
- pRetValue->SetFloat(nSum);
+ info.GetReturnValue().Set(nSum);
}
// static
void CFXJSE_FormCalcContext::NPV(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
int32_t argc = info.Length();
if (argc < 3) {
@@ -2822,7 +2801,7 @@
for (int32_t i = 0; i < argc; i++) {
argValues.push_back(GetSimpleValue(pThis, info, i));
if (ValueIsNull(pThis, argValues[i].get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
}
@@ -2847,14 +2826,13 @@
double nNum = data[iIndex++];
nSum += nNum / nTemp;
}
- pRetValue->SetDouble(nSum);
+ info.GetReturnValue().Set(nSum);
}
// static
void CFXJSE_FormCalcContext::Pmt(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 3) {
pContext->ThrowParamCountMismatchException(L"Pmt");
@@ -2866,7 +2844,7 @@
std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -2883,14 +2861,13 @@
for (int32_t i = 0; i < nPeriods - 1; ++i)
nSum *= nTmp;
- pRetValue->SetFloat((nPrincipal * nRate * nSum) / (nSum - 1));
+ info.GetReturnValue().Set((nPrincipal * nRate * nSum) / (nSum - 1));
}
// static
void CFXJSE_FormCalcContext::PPmt(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 5) {
pContext->ThrowParamCountMismatchException(L"PPmt");
@@ -2905,7 +2882,7 @@
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get()) || ValueIsNull(pThis, argFour.get()) ||
ValueIsNull(pThis, argFive.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -2942,13 +2919,13 @@
nSum += nTemp;
nPrincipalAmount -= nTemp;
}
- pRetValue->SetFloat(nSum);
+ info.GetReturnValue().Set(nSum);
}
// static
-void CFXJSE_FormCalcContext::PV(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+void CFXJSE_FormCalcContext::PV(
+ CFXJSE_Value* pThis,
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 3) {
pContext->ThrowParamCountMismatchException(L"PV");
@@ -2960,7 +2937,7 @@
std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -2977,14 +2954,13 @@
nTemp *= 1 + nRate;
nTemp = 1 / nTemp;
- pRetValue->SetDouble(nAmount * ((1 - nTemp) / nRate));
+ info.GetReturnValue().Set(nAmount * ((1 - nTemp) / nRate));
}
// static
void CFXJSE_FormCalcContext::Rate(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 3) {
pContext->ThrowParamCountMismatchException(L"Rate");
@@ -2996,7 +2972,7 @@
std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -3008,15 +2984,14 @@
return;
}
- pRetValue->SetFloat(
+ info.GetReturnValue().Set(
FXSYS_pow((float)(nFuture / nPresent), (float)(1 / nTotalNumber)) - 1);
}
// static
void CFXJSE_FormCalcContext::Term(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 3) {
pContext->ThrowParamCountMismatchException(L"Term");
@@ -3028,7 +3003,7 @@
std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) ||
ValueIsNull(pThis, argThree.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -3040,15 +3015,14 @@
return;
}
- pRetValue->SetFloat(log((float)(nFuture / nMount * nRate) + 1) /
- log((float)(1 + nRate)));
+ info.GetReturnValue().Set(log((float)(nFuture / nMount * nRate) + 1) /
+ log((float)(1 + nRate)));
}
// static
void CFXJSE_FormCalcContext::Choose(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
int32_t argc = info.Length();
if (argc < 2) {
@@ -3058,13 +3032,13 @@
auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (ValueIsNull(pThis, argOne.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
int32_t iIndex = (int32_t)ValueToFloat(pThis, argOne.get());
if (iIndex < 1) {
- pRetValue->SetString("");
+ info.GetReturnValue().SetEmptyString();
return;
}
@@ -3098,41 +3072,41 @@
propertyValue->ToString().AsStringView(), newPropertyValue.get());
}
ByteString bsChosen = ValueToUTF8String(newPropertyValue.get());
- pRetValue->SetString(bsChosen.AsStringView());
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(), bsChosen.AsStringView()));
bFound = true;
}
} else {
iValueIndex++;
if (iValueIndex == iIndex) {
ByteString bsChosen = ValueToUTF8String(argIndexValue.get());
- pRetValue->SetString(bsChosen.AsStringView());
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(), bsChosen.AsStringView()));
bFound = true;
}
}
iArgIndex++;
}
if (!bFound)
- pRetValue->SetString("");
+ info.GetReturnValue().SetEmptyString();
}
// static
void CFXJSE_FormCalcContext::Exists(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Exists");
return;
}
auto temp = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
- pRetValue->SetInteger(temp->IsObject());
+ info.GetReturnValue().Set(static_cast<int>(temp->IsObject()));
}
// static
void CFXJSE_FormCalcContext::HasValue(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"HasValue");
return;
@@ -3140,42 +3114,39 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (!argOne->IsString()) {
- pRetValue->SetInteger(argOne->IsNumber() || argOne->IsBoolean());
+ info.GetReturnValue().Set(
+ static_cast<int>(argOne->IsNumber() || argOne->IsBoolean()));
return;
}
ByteString bsValue = argOne->ToString();
bsValue.TrimLeft();
- pRetValue->SetInteger(!bsValue.IsEmpty());
+ info.GetReturnValue().Set(static_cast<int>(!bsValue.IsEmpty()));
}
// static
void CFXJSE_FormCalcContext::Oneof(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() < 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Oneof");
return;
}
- bool bFlags = false;
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;
+ info.GetReturnValue().Set(1);
+ return;
}
}
-
- pRetValue->SetInteger(bFlags);
+ info.GetReturnValue().Set(0);
}
// static
void CFXJSE_FormCalcContext::Within(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Within");
return;
@@ -3183,7 +3154,7 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (argOne->IsNull()) {
- pRetValue->SetUndefined();
+ info.GetReturnValue().SetUndefined();
return;
}
@@ -3193,37 +3164,40 @@
float oneNumber = ValueToFloat(pThis, argOne.get());
float lowNumber = ValueToFloat(pThis, argLow.get());
float heightNumber = ValueToFloat(pThis, argHigh.get());
- pRetValue->SetInteger((oneNumber >= lowNumber) &&
- (oneNumber <= heightNumber));
+ info.GetReturnValue().Set(static_cast<int>((oneNumber >= lowNumber) &&
+ (oneNumber <= heightNumber)));
return;
}
ByteString bsOne = ValueToUTF8String(argOne.get());
ByteString bsLow = ValueToUTF8String(argLow.get());
ByteString bsHeight = ValueToUTF8String(argHigh.get());
- pRetValue->SetInteger((bsOne.Compare(bsLow.AsStringView()) >= 0) &&
- (bsOne.Compare(bsHeight.AsStringView()) <= 0));
+ info.GetReturnValue().Set(
+ static_cast<int>((bsOne.Compare(bsLow.AsStringView()) >= 0) &&
+ (bsOne.Compare(bsHeight.AsStringView()) <= 0)));
}
// static
-void CFXJSE_FormCalcContext::If(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+void CFXJSE_FormCalcContext::If(
+ CFXJSE_Value* pThis,
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"If");
return;
}
- pRetValue->Assign(GetSimpleValue(pThis, info, 0)->ToBoolean()
- ? GetSimpleValue(pThis, info, 1).get()
- : GetSimpleValue(pThis, info, 2).get());
+ std::unique_ptr<CFXJSE_Value> value =
+ GetSimpleValue(pThis, info, 0)->ToBoolean()
+ ? GetSimpleValue(pThis, info, 1)
+ : GetSimpleValue(pThis, info, 2);
+
+ info.GetReturnValue().Set(value->DirectGetValue());
}
// static
void CFXJSE_FormCalcContext::Eval(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 1) {
pContext->ThrowParamCountMismatchException(L"Eval");
@@ -3234,7 +3208,7 @@
std::unique_ptr<CFXJSE_Value> scriptValue = GetSimpleValue(pThis, info, 0);
ByteString bsUtf8Script = ValueToUTF8String(scriptValue.get());
if (bsUtf8Script.IsEmpty()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -3254,14 +3228,13 @@
FX_UTF8Encode(wsJavaScriptBuf.AsStringView()).c_str(), returnValue.get(),
nullptr);
- pRetValue->Assign(returnValue.get());
+ info.GetReturnValue().Set(returnValue->DirectGetValue());
}
// static
void CFXJSE_FormCalcContext::Ref(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
if (info.Length() != 1) {
@@ -3277,7 +3250,7 @@
}
if (argOne->IsBoolean() || argOne->IsString() || argOne->IsNumber()) {
- pRetValue->Assign(argOne.get());
+ info.GetReturnValue().Set(argOne->DirectGetValue());
return;
}
@@ -3313,14 +3286,16 @@
values[0]->SetInteger(intVal);
values[1]->SetNull();
- pRetValue->SetArray(values);
+
+ auto temp = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ temp->SetArray(values);
+ info.GetReturnValue().Set(temp->DirectGetValue());
}
// static
void CFXJSE_FormCalcContext::UnitType(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"UnitType");
return;
@@ -3328,13 +3303,13 @@
std::unique_ptr<CFXJSE_Value> unitspanValue = GetSimpleValue(pThis, info, 0);
if (unitspanValue->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
ByteString bsUnitspan = ValueToUTF8String(unitspanValue.get());
if (bsUnitspan.IsEmpty()) {
- pRetValue->SetString("in");
+ info.GetReturnValue().SetEmptyString();
return;
}
@@ -3407,19 +3382,24 @@
}
switch (eParserStatus) {
case VALUETYPE_ISCM:
- pRetValue->SetString("cm");
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), "cm"));
break;
case VALUETYPE_ISMM:
- pRetValue->SetString("mm");
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), "mm"));
break;
case VALUETYPE_ISPT:
- pRetValue->SetString("pt");
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), "pt"));
break;
case VALUETYPE_ISMP:
- pRetValue->SetString("mp");
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), "mp"));
break;
default:
- pRetValue->SetString("in");
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), "in"));
break;
}
}
@@ -3427,8 +3407,7 @@
// static
void CFXJSE_FormCalcContext::UnitValue(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 1 || argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"UnitValue");
@@ -3437,14 +3416,14 @@
std::unique_ptr<CFXJSE_Value> unitspanValue = GetSimpleValue(pThis, info, 0);
if (unitspanValue->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
ByteString bsUnitspan = ValueToUTF8String(unitspanValue.get());
const char* pData = bsUnitspan.c_str();
if (!pData) {
- pRetValue->SetInteger(0);
+ info.GetReturnValue().Set(0);
return;
}
@@ -3561,13 +3540,13 @@
else
dResult = dFirstNumber / 72000;
}
- pRetValue->SetDouble(dResult);
+ info.GetReturnValue().Set(dResult);
}
// static
-void CFXJSE_FormCalcContext::At(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+void CFXJSE_FormCalcContext::At(
+ CFXJSE_Value* pThis,
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"At");
return;
@@ -3576,26 +3555,26 @@
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())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
ByteString stringTwo = ValueToUTF8String(argTwo.get());
if (stringTwo.IsEmpty()) {
- pRetValue->SetInteger(1);
+ info.GetReturnValue().Set(1);
return;
}
ByteString stringOne = ValueToUTF8String(argOne.get());
auto pos = stringOne.Find(stringTwo.AsStringView());
- pRetValue->SetInteger(pos.has_value() ? pos.value() + 1 : 0);
+ info.GetReturnValue().Set(
+ static_cast<int>(pos.has_value() ? pos.value() + 1 : 0));
}
// static
void CFXJSE_FormCalcContext::Concat(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Concat");
@@ -3614,18 +3593,17 @@
}
if (bAllNull) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
-
- pRetValue->SetString(bsResult.AsStringView());
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), bsResult.AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Decode(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 1 || argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Decode");
@@ -3635,21 +3613,22 @@
if (argc == 1) {
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
WideString decoded = DecodeURL(
WideString::FromUTF8(ValueToUTF8String(argOne.get()).AsStringView()));
-
- pRetValue->SetString(FX_UTF8Encode(decoded.AsStringView()).AsStringView());
+ auto result = FX_UTF8Encode(decoded.AsStringView());
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
return;
}
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())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -3666,14 +3645,15 @@
else
decoded = DecodeURL(wsToDecode);
- pRetValue->SetString(FX_UTF8Encode(decoded.AsStringView()).AsStringView());
+ auto result = FX_UTF8Encode(decoded.AsStringView());
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Encode(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 1 || argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Encode");
@@ -3683,19 +3663,20 @@
if (argc == 1) {
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
-
WideString encoded = EncodeURL(ValueToUTF8String(argOne.get()));
- pRetValue->SetString(FX_UTF8Encode(encoded.AsStringView()).AsStringView());
+ auto result = FX_UTF8Encode(encoded.AsStringView());
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
return;
}
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())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -3709,14 +3690,15 @@
else
encoded = EncodeURL(bsToEncode);
- pRetValue->SetString(FX_UTF8Encode(encoded.AsStringView()).AsStringView());
+ auto result = FX_UTF8Encode(encoded.AsStringView());
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Format(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() < 2) {
pContext->ThrowParamCountMismatchException(L"Format");
@@ -3744,7 +3726,7 @@
case XFA_VT_DATETIME: {
auto iTChar = wsPattern.Find(L'T');
if (!iTChar.has_value()) {
- pRetValue->SetString("");
+ info.GetReturnValue().SetEmptyString();
return;
}
WideString wsDatePattern(L"date{");
@@ -3786,18 +3768,17 @@
WideString wsRet;
if (!localeValue.FormatPatterns(wsRet, wsPattern, pLocale,
XFA_VALUEPICTURE_Display)) {
- pRetValue->SetString("");
+ info.GetReturnValue().SetEmptyString();
return;
}
-
- pRetValue->SetString(wsRet.ToUTF8().AsStringView());
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(), wsRet.ToUTF8().AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Left(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Left");
return;
@@ -3807,20 +3788,20 @@
std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
if ((ValueIsNull(pThis, argOne.get())) ||
(ValueIsNull(pThis, argTwo.get()))) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
ByteString bsSource = ValueToUTF8String(argOne.get());
int32_t count = std::max(0, ValueToInteger(pThis, argTwo.get()));
- pRetValue->SetString(bsSource.First(count).AsStringView());
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(), bsSource.First(count).AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Len(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Len");
return;
@@ -3828,19 +3809,18 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
ByteString bsSource = ValueToUTF8String(argOne.get());
- pRetValue->SetInteger(bsSource.GetLength());
+ info.GetReturnValue().Set(static_cast<int>(bsSource.GetLength()));
}
// static
void CFXJSE_FormCalcContext::Lower(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 1 || argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Lower");
@@ -3849,7 +3829,7 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -3865,14 +3845,15 @@
}
szLowBuf.AppendChar(0);
- pRetValue->SetString(FX_UTF8Encode(szLowBuf.AsStringView()).AsStringView());
+ auto result = FX_UTF8Encode(szLowBuf.AsStringView());
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Ltrim(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Ltrim");
return;
@@ -3880,20 +3861,20 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
ByteString bsSource = ValueToUTF8String(argOne.get());
bsSource.TrimLeft();
- pRetValue->SetString(bsSource.AsStringView());
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), bsSource.AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Parse(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 2) {
pContext->ThrowParamCountMismatchException(L"Parse");
@@ -3903,7 +3884,7 @@
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())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -3923,10 +3904,12 @@
CXFA_LocaleValue localeValue(dwPatternType, wsValue, wsPattern, pLocale,
pMgr);
if (!localeValue.IsValid()) {
- pRetValue->SetString("");
+ info.GetReturnValue().SetEmptyString();
return;
}
- pRetValue->SetString(localeValue.GetValue().ToUTF8().AsStringView());
+ auto result = localeValue.GetValue().ToUTF8();
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
return;
}
@@ -3934,7 +3917,7 @@
case XFA_VT_DATETIME: {
auto iTChar = wsPattern.Find(L'T');
if (!iTChar.has_value()) {
- pRetValue->SetString("");
+ info.GetReturnValue().SetEmptyString();
return;
}
WideString wsDatePattern(L"date{" + wsPattern.First(iTChar.value()) +
@@ -3946,10 +3929,12 @@
CXFA_LocaleValue localeValue(dwPatternType, wsValue, wsPattern, pLocale,
pMgr);
if (!localeValue.IsValid()) {
- pRetValue->SetString("");
+ info.GetReturnValue().SetEmptyString();
return;
}
- pRetValue->SetString(localeValue.GetValue().ToUTF8().AsStringView());
+ auto result = localeValue.GetValue().ToUTF8();
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
return;
}
case XFA_VT_DATE: {
@@ -3957,10 +3942,12 @@
CXFA_LocaleValue localeValue(dwPatternType, wsValue, wsPattern, pLocale,
pMgr);
if (!localeValue.IsValid()) {
- pRetValue->SetString("");
+ info.GetReturnValue().SetEmptyString();
return;
}
- pRetValue->SetString(localeValue.GetValue().ToUTF8().AsStringView());
+ auto result = localeValue.GetValue().ToUTF8();
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
return;
}
case XFA_VT_TIME: {
@@ -3968,10 +3955,12 @@
CXFA_LocaleValue localeValue(dwPatternType, wsValue, wsPattern, pLocale,
pMgr);
if (!localeValue.IsValid()) {
- pRetValue->SetString("");
+ info.GetReturnValue().SetEmptyString();
return;
}
- pRetValue->SetString(localeValue.GetValue().ToUTF8().AsStringView());
+ auto result = localeValue.GetValue().ToUTF8();
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
return;
}
case XFA_VT_TEXT: {
@@ -3979,10 +3968,12 @@
CXFA_LocaleValue localeValue(XFA_VT_TEXT, wsValue, wsPattern, pLocale,
pMgr);
if (!localeValue.IsValid()) {
- pRetValue->SetString("");
+ info.GetReturnValue().SetEmptyString();
return;
}
- pRetValue->SetString(localeValue.GetValue().ToUTF8().AsStringView());
+ auto result = localeValue.GetValue().ToUTF8();
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
return;
}
case XFA_VT_FLOAT: {
@@ -3990,10 +3981,10 @@
CXFA_LocaleValue localeValue(XFA_VT_FLOAT, wsValue, wsPattern, pLocale,
pMgr);
if (!localeValue.IsValid()) {
- pRetValue->SetString("");
+ info.GetReturnValue().SetEmptyString();
return;
}
- pRetValue->SetDouble(localeValue.GetDoubleNum());
+ info.GetReturnValue().Set(localeValue.GetDoubleNum());
return;
}
default: {
@@ -4002,7 +3993,7 @@
CXFA_LocaleValue localeValue(XFA_VT_FLOAT, wsValue, wsTestPattern,
pLocale, pMgr);
if (localeValue.IsValid()) {
- pRetValue->SetDouble(localeValue.GetDoubleNum());
+ info.GetReturnValue().Set(localeValue.GetDoubleNum());
return;
}
}
@@ -4012,11 +4003,13 @@
CXFA_LocaleValue localeValue(XFA_VT_TEXT, wsValue, wsTestPattern,
pLocale, pMgr);
if (localeValue.IsValid()) {
- pRetValue->SetString(localeValue.GetValue().ToUTF8().AsStringView());
+ auto result = localeValue.GetValue().ToUTF8();
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(), result.AsStringView()));
return;
}
}
- pRetValue->SetString("");
+ info.GetReturnValue().SetEmptyString();
return;
}
}
@@ -4025,8 +4018,7 @@
// static
void CFXJSE_FormCalcContext::Replace(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 2 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Replace");
@@ -4079,14 +4071,14 @@
}
}
szResult << '\0';
- pRetValue->SetString(ByteStringView(szResult.str().c_str()));
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(), ByteStringView(szResult.str().c_str())));
}
// static
void CFXJSE_FormCalcContext::Right(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Right");
return;
@@ -4096,20 +4088,20 @@
std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, info, 1);
if ((ValueIsNull(pThis, argOne.get())) ||
(ValueIsNull(pThis, argTwo.get()))) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
ByteString bsSource = ValueToUTF8String(argOne.get());
int32_t count = std::max(0, ValueToInteger(pThis, argTwo.get()));
- pRetValue->SetString(bsSource.Last(count).AsStringView());
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(), bsSource.Last(count).AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Rtrim(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Rtrim");
return;
@@ -4117,20 +4109,20 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
ByteString bsSource = ValueToUTF8String(argOne.get());
bsSource.TrimRight();
- pRetValue->SetString(bsSource.AsStringView());
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), bsSource.AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Space(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Space");
return;
@@ -4138,7 +4130,7 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (argOne->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -4150,14 +4142,14 @@
index++;
}
spaceString << '\0';
- pRetValue->SetString(ByteStringView(spaceString.str().c_str()));
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(), ByteStringView(spaceString.str().c_str())));
}
// static
void CFXJSE_FormCalcContext::Str(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 1 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Str");
@@ -4166,7 +4158,7 @@
std::unique_ptr<CFXJSE_Value> numberValue = GetSimpleValue(pThis, info, 0);
if (numberValue->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
float fNumber = ValueToFloat(pThis, numberValue.get());
@@ -4211,7 +4203,8 @@
++i;
}
resultBuf << '\0';
- pRetValue->SetString(ByteStringView(resultBuf.str().c_str()));
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(), ByteStringView(resultBuf.str().c_str())));
return;
}
@@ -4230,7 +4223,8 @@
}
resultBuf << pData;
}
- pRetValue->SetString(ByteStringView(resultBuf.str().c_str()));
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(), ByteStringView(resultBuf.str().c_str())));
return;
}
@@ -4266,14 +4260,14 @@
++i;
}
resultBuf << '\0';
- pRetValue->SetString(ByteStringView(resultBuf.str().c_str()));
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(), ByteStringView(resultBuf.str().c_str())));
}
// static
void CFXJSE_FormCalcContext::Stuff(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 3 || argc > 4) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Stuff");
@@ -4318,14 +4312,15 @@
++i;
}
szResult << '\0';
- pRetValue->SetString(ByteStringView(szResult.str().c_str()));
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(), ByteStringView(szResult.str().c_str())));
+ ;
}
// static
void CFXJSE_FormCalcContext::Substr(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Substr");
return;
@@ -4337,14 +4332,14 @@
if (ValueIsNull(pThis, string_value.get()) ||
ValueIsNull(pThis, start_value.get()) ||
ValueIsNull(pThis, end_value.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
ByteString bsSource = ValueToUTF8String(string_value.get());
size_t iLength = bsSource.GetLength();
if (iLength == 0) {
- pRetValue->SetString("");
+ info.GetReturnValue().SetEmptyString();
return;
}
@@ -4352,21 +4347,21 @@
// 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) {
- pRetValue->SetString("");
+ info.GetReturnValue().SetEmptyString();
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);
- pRetValue->SetString(bsSource.Substr(iStart, iCount).AsStringView());
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(), bsSource.Substr(iStart, iCount).AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Uuid(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 0 || argc > 1) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Uuid");
@@ -4378,14 +4373,14 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
iNum = static_cast<int32_t>(ValueToFloat(pThis, argOne.get()));
}
- pRetValue->SetString(GUIDString(!!iNum).AsStringView());
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(), GUIDString(!!iNum).AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Upper(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 1 || argc > 2) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Upper");
@@ -4394,7 +4389,7 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (ValueIsNull(pThis, argOne.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -4415,15 +4410,15 @@
}
upperStringBuf.AppendChar(0);
- pRetValue->SetString(
- FX_UTF8Encode(upperStringBuf.AsStringView()).AsStringView());
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(),
+ FX_UTF8Encode(upperStringBuf.AsStringView()).AsStringView()));
}
// static
void CFXJSE_FormCalcContext::WordNum(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
int32_t argc = info.Length();
if (argc < 1 || argc > 3) {
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"WordNum");
@@ -4432,7 +4427,7 @@
std::unique_ptr<CFXJSE_Value> numberValue = GetSimpleValue(pThis, info, 0);
if (numberValue->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
float fNumber = ValueToFloat(pThis, numberValue.get());
@@ -4442,7 +4437,7 @@
std::unique_ptr<CFXJSE_Value> identifierValue =
GetSimpleValue(pThis, info, 1);
if (identifierValue->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
iIdentifier =
@@ -4453,7 +4448,7 @@
if (argc > 2) {
std::unique_ptr<CFXJSE_Value> localeValue = GetSimpleValue(pThis, info, 2);
if (localeValue->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
bsLocale = ValueToUTF8String(localeValue.get());
@@ -4461,19 +4456,19 @@
if (std::isnan(fNumber) || fNumber < 0.0f ||
fNumber > 922337203685477550.0f) {
- pRetValue->SetString("*");
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(info.GetIsolate(), "*"));
return;
}
- pRetValue->SetString(
- WordUS(ByteString::Format("%.2f", fNumber), iIdentifier).AsStringView());
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(),
+ WordUS(ByteString::Format("%.2f", fNumber), iIdentifier).AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Get(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 1) {
pContext->ThrowParamCountMismatchException(L"Get");
@@ -4498,14 +4493,14 @@
int32_t size = pFile->GetSize();
std::vector<uint8_t> dataBuf(size);
pFile->ReadBlock(dataBuf.data(), size);
- pRetValue->SetString(ByteStringView(dataBuf));
+ info.GetReturnValue().Set(
+ CFX_V8::NewStringHelper(info.GetIsolate(), ByteStringView(dataBuf)));
}
// static
void CFXJSE_FormCalcContext::Post(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
int32_t argc = info.Length();
if (argc < 2 || argc > 5) {
@@ -4555,14 +4550,14 @@
pContext->ThrowServerDeniedException();
return;
}
- pRetValue->SetString(decodedResponse.ToUTF8().AsStringView());
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(), decodedResponse.ToUTF8().AsStringView()));
}
// static
void CFXJSE_FormCalcContext::Put(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
int32_t argc = info.Length();
if (argc < 2 || argc > 3) {
@@ -4589,7 +4584,6 @@
std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, info, 2);
bsEncode = ValueToUTF8String(argThree.get());
}
-
if (!pAppProvider->PutRequestURL(
WideString::FromUTF8(bsURL.AsStringView()),
WideString::FromUTF8(bsData.AsStringView()),
@@ -4597,15 +4591,13 @@
pContext->ThrowServerDeniedException();
return;
}
-
- pRetValue->SetString("");
+ info.GetReturnValue().SetEmptyString();
}
// static
void CFXJSE_FormCalcContext::assign_value_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 2) {
pContext->ThrowCompilerErrorException();
@@ -4643,14 +4635,13 @@
return;
}
}
- pRetValue->Assign(rValue.get());
+ info.GetReturnValue().Set(rValue->DirectGetValue());
}
// static
void CFXJSE_FormCalcContext::logical_or_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
@@ -4659,20 +4650,19 @@
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();
+ info.GetReturnValue().SetNull();
return;
}
float first = ValueToFloat(pThis, argFirst.get());
float second = ValueToFloat(pThis, infoecond.get());
- pRetValue->SetInteger((first || second) ? 1 : 0);
+ info.GetReturnValue().Set(static_cast<int>(first || second));
}
// static
void CFXJSE_FormCalcContext::logical_and_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
@@ -4681,77 +4671,79 @@
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();
+ info.GetReturnValue().SetNull();
return;
}
float first = ValueToFloat(pThis, argFirst.get());
float second = ValueToFloat(pThis, infoecond.get());
- pRetValue->SetInteger((first && second) ? 1 : 0);
+ info.GetReturnValue().Set(static_cast<int>(first && second));
}
// static
void CFXJSE_FormCalcContext::equality_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
if (fm_ref_equal(pThis, info)) {
- pRetValue->SetInteger(1);
+ info.GetReturnValue().Set(1);
return;
}
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);
+ info.GetReturnValue().Set(
+ static_cast<int>(argFirst->IsNull() && infoecond->IsNull()));
return;
}
if (argFirst->IsString() && infoecond->IsString()) {
- pRetValue->SetInteger(argFirst->ToString() == infoecond->ToString());
+ info.GetReturnValue().Set(
+ static_cast<int>(argFirst->ToString() == infoecond->ToString()));
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, infoecond.get());
- pRetValue->SetInteger((first == second) ? 1 : 0);
+ info.GetReturnValue().Set(static_cast<int>(first == second));
}
// static
void CFXJSE_FormCalcContext::notequality_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
}
if (fm_ref_equal(pThis, info)) {
- pRetValue->SetInteger(0);
+ info.GetReturnValue().Set(0);
return;
}
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);
+ info.GetReturnValue().Set(
+ static_cast<int>(!argFirst->IsNull() || !infoecond->IsNull()));
return;
}
if (argFirst->IsString() && infoecond->IsString()) {
- pRetValue->SetInteger(argFirst->ToString() != infoecond->ToString());
+ info.GetReturnValue().Set(
+ static_cast<int>(argFirst->ToString() != infoecond->ToString()));
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, infoecond.get());
- pRetValue->SetInteger(first != second);
+ info.GetReturnValue().Set(static_cast<int>(first != second));
}
// static
@@ -4784,8 +4776,7 @@
// static
void CFXJSE_FormCalcContext::less_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
@@ -4794,27 +4785,26 @@
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()) {
- pRetValue->SetInteger(0);
+ info.GetReturnValue().Set(0);
return;
}
if (argFirst->IsString() && argSecond->IsString()) {
int result =
argFirst->ToString().Compare(argSecond->ToString().AsStringView()) < 0;
- pRetValue->SetInteger(result);
+ info.GetReturnValue().Set(result);
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, argSecond.get());
- pRetValue->SetInteger((first < second) ? 1 : 0);
+ info.GetReturnValue().Set(static_cast<int>(first < second));
}
// static
void CFXJSE_FormCalcContext::lessequal_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
@@ -4823,27 +4813,27 @@
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()) {
- pRetValue->SetInteger((argFirst->IsNull() && argSecond->IsNull()) ? 1 : 0);
+ info.GetReturnValue().Set(
+ static_cast<int>(argFirst->IsNull() && argSecond->IsNull()));
return;
}
if (argFirst->IsString() && argSecond->IsString()) {
int result =
argFirst->ToString().Compare(argSecond->ToString().AsStringView()) <= 0;
- pRetValue->SetInteger(result);
+ info.GetReturnValue().Set(result);
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, argSecond.get());
- pRetValue->SetInteger((first <= second) ? 1 : 0);
+ info.GetReturnValue().Set(static_cast<int>(first <= second));
}
// static
void CFXJSE_FormCalcContext::greater_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
@@ -4852,27 +4842,26 @@
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()) {
- pRetValue->SetInteger(0);
+ info.GetReturnValue().Set(0);
return;
}
if (argFirst->IsString() && argSecond->IsString()) {
int result =
argFirst->ToString().Compare(argSecond->ToString().AsStringView()) > 0;
- pRetValue->SetInteger(result);
+ info.GetReturnValue().Set(result);
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, argSecond.get());
- pRetValue->SetInteger((first > second) ? 1 : 0);
+ info.GetReturnValue().Set(static_cast<int>(first > second));
}
// static
void CFXJSE_FormCalcContext::greaterequal_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
@@ -4881,27 +4870,27 @@
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()) {
- pRetValue->SetInteger((argFirst->IsNull() && argSecond->IsNull()) ? 1 : 0);
+ info.GetReturnValue().Set(
+ static_cast<int>(argFirst->IsNull() && argSecond->IsNull()));
return;
}
if (argFirst->IsString() && argSecond->IsString()) {
int result =
argFirst->ToString().Compare(argSecond->ToString().AsStringView()) >= 0;
- pRetValue->SetInteger(result);
+ info.GetReturnValue().Set(result);
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, argSecond.get());
- pRetValue->SetInteger((first >= second) ? 1 : 0);
+ info.GetReturnValue().Set(static_cast<int>(first >= second));
}
// static
void CFXJSE_FormCalcContext::plus_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
@@ -4911,20 +4900,19 @@
auto argSecond = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[1]);
if (ValueIsNull(pThis, argFirst.get()) &&
ValueIsNull(pThis, argSecond.get())) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, argSecond.get());
- pRetValue->SetDouble(first + second);
+ info.GetReturnValue().Set(first + second);
}
// static
void CFXJSE_FormCalcContext::minus_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
@@ -4933,20 +4921,19 @@
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()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, argSecond.get());
- pRetValue->SetDouble(first - second);
+ info.GetReturnValue().Set(first - second);
}
// static
void CFXJSE_FormCalcContext::multiple_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 2) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
@@ -4955,20 +4942,19 @@
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()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
double first = ValueToDouble(pThis, argFirst.get());
double second = ValueToDouble(pThis, argSecond.get());
- pRetValue->SetDouble(first * second);
+ info.GetReturnValue().Set(first * second);
}
// static
void CFXJSE_FormCalcContext::divide_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 2) {
pContext->ThrowCompilerErrorException();
@@ -4978,7 +4964,7 @@
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()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
@@ -4989,14 +4975,13 @@
}
double first = ValueToDouble(pThis, argFirst.get());
- pRetValue->SetDouble(first / second);
+ info.GetReturnValue().Set(first / second);
}
// static
void CFXJSE_FormCalcContext::positive_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
@@ -5004,17 +4989,16 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (argOne->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
- pRetValue->SetDouble(0.0 + ValueToDouble(pThis, argOne.get()));
+ info.GetReturnValue().Set(0.0 + ValueToDouble(pThis, argOne.get()));
}
// static
void CFXJSE_FormCalcContext::negative_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
@@ -5022,17 +5006,16 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (argOne->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
- pRetValue->SetDouble(0.0 - ValueToDouble(pThis, argOne.get()));
+ info.GetReturnValue().Set(0.0 - ValueToDouble(pThis, argOne.get()));
}
// static
void CFXJSE_FormCalcContext::logical_not_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
@@ -5040,35 +5023,32 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
if (argOne->IsNull()) {
- pRetValue->SetNull();
+ info.GetReturnValue().SetNull();
return;
}
double first = ValueToDouble(pThis, argOne.get());
- pRetValue->SetInteger((first == 0.0) ? 1 : 0);
+ info.GetReturnValue().Set((first == 0.0) ? 1 : 0);
}
// static
void CFXJSE_FormCalcContext::dot_accessor(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
- DotAccessorCommon(pThis, info, pRetValue, /*bDotAccessor=*/true);
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
+ DotAccessorCommon(pThis, info, /*bDotAccessor=*/true);
}
// static
void CFXJSE_FormCalcContext::dotdot_accessor(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
- DotAccessorCommon(pThis, info, pRetValue, /*bDotAccessor=*/false);
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
+ DotAccessorCommon(pThis, info, /*bDotAccessor=*/false);
}
// static
void CFXJSE_FormCalcContext::eval_translation(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 1) {
pContext->ThrowParamCountMismatchException(L"Eval");
@@ -5089,44 +5069,41 @@
pContext->ThrowCompilerErrorException();
return;
}
-
- pRetValue->SetString(
- FX_UTF8Encode(wsJavaScriptBuf.AsStringView()).AsStringView());
+ info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetIsolate(),
+ FX_UTF8Encode(wsJavaScriptBuf.AsStringView()).AsStringView()));
}
// static
void CFXJSE_FormCalcContext::is_fm_object(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
- pRetValue->SetBoolean(false);
+ info.GetReturnValue().Set(false);
return;
}
auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
- pRetValue->SetBoolean(argOne->IsObject());
+ info.GetReturnValue().Set(argOne->IsObject());
}
// static
void CFXJSE_FormCalcContext::is_fm_array(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
- pRetValue->SetBoolean(false);
+ info.GetReturnValue().Set(false);
return;
}
auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
- pRetValue->SetBoolean(argOne->IsArray());
+ info.GetReturnValue().Set(argOne->IsArray());
}
// static
void CFXJSE_FormCalcContext::get_fm_value(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 1) {
pContext->ThrowCompilerErrorException();
@@ -5141,28 +5118,33 @@
argOne->GetObjectPropertyByIdx(1, propertyValue.get());
argOne->GetObjectPropertyByIdx(2, jsObjectValue.get());
if (propertyValue->IsNull()) {
- GetObjectDefaultValue(jsObjectValue.get(), pRetValue);
+ auto pReturn = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ GetObjectDefaultValue(jsObjectValue.get(), pReturn.get());
+ info.GetReturnValue().Set(pReturn->DirectGetValue());
return;
}
+ auto pReturn = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(),
- pRetValue);
+ pReturn.get());
+ info.GetReturnValue().Set(pReturn->DirectGetValue());
return;
}
if (argOne->IsObject()) {
- GetObjectDefaultValue(argOne.get(), pRetValue);
+ auto pReturn = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ GetObjectDefaultValue(argOne.get(), pReturn.get());
+ info.GetReturnValue().Set(pReturn->DirectGetValue());
return;
}
- pRetValue->Assign(argOne.get());
+ info.GetReturnValue().Set(argOne->DirectGetValue());
}
// static
void CFXJSE_FormCalcContext::get_fm_jsobj(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() != 1) {
ToFormCalcContext(pThis)->ThrowCompilerErrorException();
return;
@@ -5170,7 +5152,7 @@
auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (!argOne->IsArray()) {
- pRetValue->Assign(argOne.get());
+ info.GetReturnValue().Set(argOne->DirectGetValue());
return;
}
@@ -5182,14 +5164,15 @@
ASSERT(lengthValue->ToInteger() >= 3);
#endif
- argOne->GetObjectPropertyByIdx(2, pRetValue);
+ auto pReturn = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ argOne->GetObjectPropertyByIdx(2, pReturn.get());
+ info.GetReturnValue().Set(pReturn->DirectGetValue());
}
// static
void CFXJSE_FormCalcContext::fm_var_filter(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
if (info.Length() != 1) {
pContext->ThrowCompilerErrorException();
@@ -5200,7 +5183,7 @@
auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (!argOne->IsArray()) {
std::unique_ptr<CFXJSE_Value> simpleValue = GetSimpleValue(pThis, info, 0);
- pRetValue->Assign(simpleValue.get());
+ info.GetReturnValue().Set(simpleValue->DirectGetValue());
return;
}
@@ -5215,7 +5198,7 @@
int32_t iFlags = flagsValue->ToInteger();
if (iFlags != 3 && iFlags != 4) {
std::unique_ptr<CFXJSE_Value> simpleValue = GetSimpleValue(pThis, info, 0);
- pRetValue->Assign(simpleValue.get());
+ info.GetReturnValue().Set(simpleValue->DirectGetValue());
return;
}
@@ -5227,7 +5210,9 @@
values[0]->SetInteger(3);
values[1]->SetNull();
values[2]->SetNull();
- pRetValue->SetArray(values);
+ auto pResult = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ pResult->SetArray(values);
+ info.GetReturnValue().Set(pResult->DirectGetValue());
return;
}
@@ -5237,14 +5222,13 @@
pContext->ThrowCompilerErrorException();
return;
}
- pRetValue->Assign(argOne.get());
+ info.GetReturnValue().Set(argOne->DirectGetValue());
}
// static
void CFXJSE_FormCalcContext::concat_fm_object(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue) {
+ const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* pIsolate = ToFormCalcContext(pThis)->GetScriptRuntime();
std::vector<std::unique_ptr<CFXJSE_Value>> returnValues;
for (int32_t i = 0; i < info.Length(); ++i) {
@@ -5261,7 +5245,9 @@
returnValues.push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
returnValues.back()->Assign(argValue.get());
}
- pRetValue->SetArray(returnValues);
+ auto pReturn = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ pReturn->SetArray(returnValues);
+ info.GetReturnValue().Set(pReturn->DirectGetValue());
}
// static
@@ -5758,7 +5744,6 @@
void CFXJSE_FormCalcContext::DotAccessorCommon(
CFXJSE_Value* pThis,
const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue,
bool bDotAccessor) {
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
@@ -5832,7 +5817,9 @@
values.back()->Assign(resolveValues[i][j].get());
}
}
- pRetValue->SetArray(values);
+ auto pReturn = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ pReturn->SetArray(values);
+ info.GetReturnValue().Set(pReturn->DirectGetValue());
return;
}
@@ -5875,7 +5862,9 @@
for (size_t i = 0; i < resolveValues.size(); i++)
values[i + 2]->Assign(resolveValues[i].get());
- pRetValue->SetArray(values);
+ auto pReturn = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ pReturn->SetArray(values);
+ info.GetReturnValue().Set(pReturn->DirectGetValue());
}
void CFXJSE_FormCalcContext::ThrowNoDefaultPropertyException(
diff --git a/fxjs/xfa/cfxjse_formcalc_context.h b/fxjs/xfa/cfxjse_formcalc_context.h
index d88b6e5..f06e1a7 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.h
+++ b/fxjs/xfa/cfxjse_formcalc_context.h
@@ -29,74 +29,51 @@
CFXJSE_FormCalcContext* AsFormCalcContext() override;
static void Abs(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Avg(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Ceil(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Count(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Floor(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Max(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Min(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Mod(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Round(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Sum(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Date(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Date2Num(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void DateFmt(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void IsoDate2Num(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void IsoTime2Num(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void LocalDateFmt(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void LocalTimeFmt(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Num2Date(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Num2GMTime(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Num2Time(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Time(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Time2Num(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void TimeFmt(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static ByteString Local2IsoDate(CFXJSE_Value* pThis,
ByteStringView bsDate,
@@ -131,220 +108,156 @@
bool bGM);
static void Apr(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void CTerm(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void FV(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void IPmt(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void NPV(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Pmt(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void PPmt(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void PV(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Rate(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Term(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Choose(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Exists(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void HasValue(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Oneof(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Within(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void If(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Eval(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Ref(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void UnitType(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void UnitValue(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void At(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Concat(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Decode(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Encode(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Format(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Left(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Len(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Lower(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Ltrim(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Parse(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Replace(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Right(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Rtrim(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Space(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Str(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Stuff(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Substr(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Uuid(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Upper(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void WordNum(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Get(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Post(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void Put(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void assign_value_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void logical_or_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void logical_and_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
- static void equality_operator(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
+ static void equality_operator(
+ CFXJSE_Value* pThis,
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void notequality_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static bool fm_ref_equal(CFXJSE_Value* pThis,
const v8::FunctionCallbackInfo<v8::Value>& info);
static void less_operator(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void lessequal_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void greater_operator(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void greaterequal_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void plus_operator(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void minus_operator(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
- static void multiple_operator(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
+ static void multiple_operator(
+ CFXJSE_Value* pThis,
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void divide_operator(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
- static void positive_operator(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
- static void negative_operator(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
+ static void positive_operator(
+ CFXJSE_Value* pThis,
+ const v8::FunctionCallbackInfo<v8::Value>& info);
+ static void negative_operator(
+ CFXJSE_Value* pThis,
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void logical_not_operator(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void dot_accessor(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void dotdot_accessor(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void eval_translation(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void is_fm_object(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void is_fm_array(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void get_fm_value(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void get_fm_jsobj(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void fm_var_filter(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static void concat_fm_object(CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
static int32_t hvalue_get_array_length(CFXJSE_Value* pThis,
CFXJSE_Value* arg);
@@ -395,7 +308,6 @@
private:
static void DotAccessorCommon(CFXJSE_Value* pThis,
const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue,
bool bDotAccessor);
v8::Isolate* GetScriptRuntime() const { return m_pIsolate.Get(); }
diff --git a/fxjs/xfa/fxjse.h b/fxjs/xfa/fxjse.h
index ca6fea8..9a64259 100644
--- a/fxjs/xfa/fxjse.h
+++ b/fxjs/xfa/fxjse.h
@@ -43,8 +43,7 @@
const WideString& functionName);
typedef void (*FXJSE_FuncCallback)(
CFXJSE_Value* pThis,
- const v8::FunctionCallbackInfo<v8::Value>& info,
- CFXJSE_Value* pRetValue);
+ const v8::FunctionCallbackInfo<v8::Value>& info);
typedef void (*FXJSE_PropAccessor)(CFXJSE_Value* pObject,
ByteStringView szPropName,
CFXJSE_Value* pValue);