Chromium Code Reviews| Index: xfa/fxfa/fm2js/xfa_fm2jscontext.cpp |
| diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp |
| index 93f38233012216f97c17fe428544bb35a75285e7..ec9e25edddcbf8237293f9992dbaf25bbcd2a206 100644 |
| --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp |
| +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp |
| @@ -501,10 +501,8 @@ void CXFA_FM2JSContext::Abs(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| if (args.GetLength() != 1) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Abs"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Abs"); |
| return; |
| } |
| @@ -531,9 +529,7 @@ void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis, |
| return; |
| } |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| + v8::Isolate* pIsolate = pThis->ToJSContext(nullptr)->GetScriptRuntime(); |
| uint32_t uCount = 0; |
| FX_DOUBLE dSum = 0.0; |
| for (int32_t i = 0; i < argc; i++) { |
| @@ -602,10 +598,8 @@ void CXFA_FM2JSContext::Ceil(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| if (args.GetLength() != 1) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Ceil"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Ceil"); |
| return; |
| } |
| @@ -623,8 +617,7 @@ void CXFA_FM2JSContext::Ceil(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| int32_t iCount = 0; |
| for (int32_t i = 0; i < args.GetLength(); i++) { |
| @@ -686,10 +679,8 @@ void CXFA_FM2JSContext::Floor(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| if (args.GetLength() != 1) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Floor"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Floor"); |
| return; |
| } |
| @@ -707,8 +698,7 @@ void CXFA_FM2JSContext::Floor(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| uint32_t uCount = 0; |
| FX_DOUBLE dMaxValue = 0.0; |
| @@ -789,8 +779,7 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| uint32_t uCount = 0; |
| FX_DOUBLE dMinValue = 0.0; |
| @@ -871,8 +860,7 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::Mod(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| if (args.GetLength() != 2) { |
| pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| @@ -958,8 +946,7 @@ void CXFA_FM2JSContext::Mod(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| int32_t argc = args.GetLength(); |
| uint8_t uPrecision = 0; |
| @@ -1073,8 +1060,7 @@ void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis, |
| return; |
| } |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| uint32_t uCount = 0; |
| FX_DOUBLE dSum = 0.0; |
| @@ -1151,10 +1137,8 @@ void CXFA_FM2JSContext::Date(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| if (args.GetLength() != 0) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Date"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Date"); |
| return; |
| } |
| @@ -1180,10 +1164,8 @@ void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis, |
| CFXJSE_Arguments& args) { |
| int32_t argc = args.GetLength(); |
| if ((argc <= 0) || (argc >= 4)) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Date2Num"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Date2Num"); |
| return; |
| } |
| @@ -1233,10 +1215,8 @@ void CXFA_FM2JSContext::DateFmt(CFXJSE_Value* pThis, |
| CFXJSE_Arguments& args) { |
| int32_t argc = args.GetLength(); |
| if (argc >= 3) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Date2Num"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Date2Num"); |
| return; |
| } |
| @@ -1276,10 +1256,8 @@ void CXFA_FM2JSContext::IsoDate2Num(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| if (args.GetLength() != 1) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"IsoDate2Num"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"IsoDate2Num"); |
| return; |
| } |
| @@ -1299,8 +1277,7 @@ void CXFA_FM2JSContext::IsoDate2Num(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| if (args.GetLength() != 1) { |
| pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| L"IsoTime2Num"); |
| @@ -1392,10 +1369,8 @@ void CXFA_FM2JSContext::LocalDateFmt(CFXJSE_Value* pThis, |
| FXJSE_Value_SetNull(args.GetReturnValue()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"LocalDateFmt"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"LocalDateFmt"); |
| } |
| } |
| @@ -1437,10 +1412,8 @@ void CXFA_FM2JSContext::LocalTimeFmt(CFXJSE_Value* pThis, |
| FXJSE_Value_SetNull(args.GetReturnValue()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"LocalTimeFmt"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"LocalTimeFmt"); |
| } |
| } |
| @@ -1586,10 +1559,8 @@ void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis, |
| FXJSE_Value_SetNull(args.GetReturnValue()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Num2Date"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Num2Date"); |
| } |
| } |
| @@ -1642,10 +1613,8 @@ void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis, |
| FXJSE_Value_SetNull(args.GetReturnValue()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Num2GMTime"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Num2GMTime"); |
| } |
| } |
| @@ -1698,10 +1667,8 @@ void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, |
| FXJSE_Value_SetNull(args.GetReturnValue()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Num2Time"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Num2Time"); |
| } |
| } |
| @@ -1719,10 +1686,8 @@ void CXFA_FM2JSContext::Time(CFXJSE_Value* pThis, |
| FXJSE_Value_SetInteger(args.GetReturnValue(), |
| ((iGMHour * 3600 + iGMMin * 60 + iGMSec) * 1000)); |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Time"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Time"); |
| } |
| } |
| @@ -1760,9 +1725,7 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, |
| } |
| } |
| if (!bFlags) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - CXFA_Document* pDoc = pContext->GetDocument(); |
| + CXFA_Document* pDoc = pThis->ToJSContext(nullptr)->GetDocument(); |
| IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| IFX_Locale* pLocale = nullptr; |
| if (localString.IsEmpty()) { |
| @@ -1817,10 +1780,8 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, |
| FXJSE_Value_SetNull(args.GetReturnValue()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Time2Num"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Time2Num"); |
| } |
| } |
| @@ -1862,10 +1823,8 @@ void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis, |
| FXJSE_Value_SetNull(args.GetReturnValue()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"TimeFmt"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"TimeFmt"); |
| } |
| } |
| @@ -2200,9 +2159,7 @@ FX_BOOL CXFA_FM2JSContext::Local2IsoDate(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFormat, |
| const CFX_ByteStringC& szLocale, |
| CFX_ByteString& strIsoDate) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - CXFA_Document* pDoc = pContext->GetDocument(); |
| + CXFA_Document* pDoc = pThis->ToJSContext(nullptr)->GetDocument(); |
| if (!pDoc) { |
| return FALSE; |
| } |
| @@ -2238,9 +2195,7 @@ FX_BOOL CXFA_FM2JSContext::Local2IsoTime(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFormat, |
| const CFX_ByteStringC& szLocale, |
| CFX_ByteString& strIsoTime) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - CXFA_Document* pDoc = pContext->GetDocument(); |
| + CXFA_Document* pDoc = pThis->ToJSContext(nullptr)->GetDocument(); |
| if (!pDoc) { |
| return FALSE; |
| } |
| @@ -2279,9 +2234,7 @@ FX_BOOL CXFA_FM2JSContext::IsoDate2Local(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFormat, |
| const CFX_ByteStringC& szLocale, |
| CFX_ByteString& strLocalDate) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - CXFA_Document* pDoc = pContext->GetDocument(); |
| + CXFA_Document* pDoc = pThis->ToJSContext(nullptr)->GetDocument(); |
| if (!pDoc) { |
| return FALSE; |
| } |
| @@ -2319,9 +2272,7 @@ FX_BOOL CXFA_FM2JSContext::IsoTime2Local(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFormat, |
| const CFX_ByteStringC& szLocale, |
| CFX_ByteString& strLocalTime) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - CXFA_Document* pDoc = pContext->GetDocument(); |
| + CXFA_Document* pDoc = pThis->ToJSContext(nullptr)->GetDocument(); |
| if (!pDoc) { |
| return FALSE; |
| } |
| @@ -2361,9 +2312,7 @@ FX_BOOL CXFA_FM2JSContext::GetGMTTime(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFormat, |
| const CFX_ByteStringC& szLocale, |
| CFX_ByteString& strGMTTime) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - CXFA_Document* pDoc = pContext->GetDocument(); |
| + CXFA_Document* pDoc = pThis->ToJSContext(nullptr)->GetDocument(); |
| if (!pDoc) { |
| return FALSE; |
| } |
| @@ -2498,9 +2447,8 @@ void CXFA_FM2JSContext::GetLocalDateFormat(CFXJSE_Value* pThis, |
| strStyle = FX_LOCALEDATETIMESUBCATEGORY_Medium; |
| break; |
| } |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - CXFA_Document* pDoc = pContext->GetDocument(); |
| + |
| + CXFA_Document* pDoc = pThis->ToJSContext(nullptr)->GetDocument(); |
| if (!pDoc) { |
| return; |
| } |
| @@ -2554,9 +2502,8 @@ void CXFA_FM2JSContext::GetLocalTimeFormat(CFXJSE_Value* pThis, |
| strStyle = FX_LOCALEDATETIMESUBCATEGORY_Medium; |
| break; |
| } |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - CXFA_Document* pDoc = pContext->GetDocument(); |
| + |
| + CXFA_Document* pDoc = pThis->ToJSContext(nullptr)->GetDocument(); |
| if (!pDoc) { |
| return; |
| } |
| @@ -2659,8 +2606,7 @@ void CXFA_FM2JSContext::GetLocalTimeZone(int32_t& iHour, |
| void CXFA_FM2JSContext::Apr(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| if (args.GetLength() == 3) { |
| FX_BOOL bFlags = FALSE; |
| FX_DOUBLE nPrincipal = 0; |
| @@ -2724,8 +2670,7 @@ void CXFA_FM2JSContext::Apr(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::CTerm(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| if (args.GetLength() == 3) { |
| FX_BOOL bFlags = FALSE; |
| FX_FLOAT nRate = 0; |
| @@ -2762,8 +2707,7 @@ void CXFA_FM2JSContext::CTerm(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::FV(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| if (args.GetLength() == 3) { |
| FX_BOOL bFlags = FALSE; |
| FX_DOUBLE nAmount = 0; |
| @@ -2808,8 +2752,7 @@ void CXFA_FM2JSContext::FV(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| if (args.GetLength() == 5) { |
| FX_BOOL bFlags = FALSE; |
| FX_FLOAT nPrincpalAmount = 0; |
| @@ -2880,8 +2823,7 @@ void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::NPV(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| int32_t argc = args.GetLength(); |
| if (argc > 2) { |
| FX_BOOL bFlags = FALSE; |
| @@ -2929,8 +2871,7 @@ void CXFA_FM2JSContext::NPV(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::Pmt(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| if (args.GetLength() == 3) { |
| FX_BOOL bFlags = FALSE; |
| FX_FLOAT nPrincipal = 0; |
| @@ -2972,8 +2913,7 @@ void CXFA_FM2JSContext::Pmt(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| if (args.GetLength() == 5) { |
| FX_BOOL bFlags = FALSE; |
| FX_FLOAT nPrincpalAmount = 0; |
| @@ -3045,8 +2985,7 @@ void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::PV(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| if (args.GetLength() == 3) { |
| FX_BOOL bFlags = FALSE; |
| FX_DOUBLE nAmount = 0; |
| @@ -3087,8 +3026,7 @@ void CXFA_FM2JSContext::PV(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::Rate(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| if (args.GetLength() == 3) { |
| FX_BOOL bFlags = FALSE; |
| FX_FLOAT nFuture = 0; |
| @@ -3126,8 +3064,7 @@ void CXFA_FM2JSContext::Rate(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::Term(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| if (args.GetLength() == 3) { |
| FX_BOOL bFlags = FALSE; |
| FX_FLOAT nMount = 0; |
| @@ -3165,8 +3102,7 @@ void CXFA_FM2JSContext::Term(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| int32_t argc = args.GetLength(); |
| if (argc > 1) { |
| @@ -3242,8 +3178,6 @@ void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, |
| } |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| L"Choose"); |
| } |
| @@ -3258,10 +3192,8 @@ void CXFA_FM2JSContext::Exists(CFXJSE_Value* pThis, |
| FXJSE_Value_SetInteger(args.GetReturnValue(), |
| FXJSE_Value_IsObject(argOne.get())); |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Exists"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Exists"); |
| } |
| } |
| @@ -3283,10 +3215,8 @@ void CXFA_FM2JSContext::HasValue(CFXJSE_Value* pThis, |
| FXJSE_Value_SetInteger(args.GetReturnValue(), FALSE); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"HasValue"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"HasValue"); |
| } |
| } |
| @@ -3312,10 +3242,8 @@ void CXFA_FM2JSContext::Oneof(CFXJSE_Value* pThis, |
| } |
| FX_Free(parametersValue); |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Oneof"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Oneof"); |
| } |
| } |
| @@ -3351,10 +3279,8 @@ void CXFA_FM2JSContext::Within(CFXJSE_Value* pThis, |
| } |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Within"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Within"); |
| } |
| } |
| @@ -3372,10 +3298,8 @@ void CXFA_FM2JSContext::If(CFXJSE_Value* pThis, |
| FXJSE_Value_Set(args.GetReturnValue(), |
| bCondition ? argFirstValue.get() : argSecondValue.get()); |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"If"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"If"); |
| } |
| } |
| @@ -3383,8 +3307,7 @@ void CXFA_FM2JSContext::If(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| if (args.GetLength() == 1) { |
| std::unique_ptr<CFXJSE_Value> scriptValue = GetSimpleValue(pThis, args, 0); |
| @@ -3399,16 +3322,16 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, |
| CXFA_FM2JSContext::Translate( |
| CFX_WideString::FromUTF8(utf8ScriptString.AsStringC()).AsStringC(), |
| wsJavaScriptBuf, wsError); |
| - CFXJSE_Context* pContext = |
| + CFXJSE_Context* pTempContext = |
|
dsinclair
2016/06/01 14:49:33
Shadow'd variable.
|
| FXJSE_Context_Create(pIsolate, nullptr, nullptr); |
| std::unique_ptr<CFXJSE_Value> returnValue(new CFXJSE_Value(pIsolate)); |
| javaScript = wsJavaScriptBuf.AsStringC(); |
| FXJSE_ExecuteScript( |
| - pContext, |
| + pTempContext, |
| FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength()).c_str(), |
| returnValue.get()); |
| FXJSE_Value_Set(args.GetReturnValue(), returnValue.get()); |
| - FXJSE_Context_Release(pContext); |
| + FXJSE_Context_Release(pTempContext); |
| } |
| } else { |
| pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| @@ -3420,8 +3343,7 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::Ref(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| if (args.GetLength() == 1) { |
| std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| @@ -3601,10 +3523,8 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, |
| } |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"UnitType"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"UnitType"); |
| } |
| } |
| @@ -3759,10 +3679,8 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, |
| } |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"UnitValue"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"UnitValue"); |
| } |
| } |
| @@ -3788,10 +3706,8 @@ void CXFA_FM2JSContext::At(CFXJSE_Value* pThis, |
| } |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"At"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"At"); |
| } |
| } |
| @@ -3821,10 +3737,8 @@ void CXFA_FM2JSContext::Concat(CFXJSE_Value* pThis, |
| resultString.AsStringC()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Concat"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Concat"); |
| } |
| } |
| @@ -3865,10 +3779,8 @@ void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, |
| FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Decode"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Decode"); |
| } |
| } |
| @@ -4141,10 +4053,8 @@ void CXFA_FM2JSContext::Encode(CFXJSE_Value* pThis, |
| FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Encode"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Encode"); |
| } |
| } |
| @@ -4444,8 +4354,7 @@ FX_BOOL CXFA_FM2JSContext::HTMLCode2STR(uint32_t iCode, |
| void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| if (args.GetLength() >= 2) { |
| std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); |
| @@ -4550,10 +4459,8 @@ void CXFA_FM2JSContext::Left(CFXJSE_Value* pThis, |
| sourceString.Left(count).AsStringC()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Left"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Left"); |
| } |
| } |
| @@ -4571,10 +4478,8 @@ void CXFA_FM2JSContext::Len(CFXJSE_Value* pThis, |
| FXJSE_Value_SetInteger(args.GetReturnValue(), sourceString.GetLength()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Len"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Len"); |
| } |
| } |
| @@ -4616,10 +4521,8 @@ void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis, |
| .AsStringC()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Lower"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Lower"); |
| } |
| } |
| @@ -4639,10 +4542,8 @@ void CXFA_FM2JSContext::Ltrim(CFXJSE_Value* pThis, |
| sourceString.AsStringC()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Ltrim"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Ltrim"); |
| } |
| } |
| @@ -4650,8 +4551,7 @@ void CXFA_FM2JSContext::Ltrim(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| if (args.GetLength() == 2) { |
| std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); |
| @@ -4842,10 +4742,8 @@ void CXFA_FM2JSContext::Replace(CFXJSE_Value* pThis, |
| resultString.AppendChar(0); |
| FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString.AsStringC()); |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Replace"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Replace"); |
| } |
| } |
| @@ -4874,10 +4772,8 @@ void CXFA_FM2JSContext::Right(CFXJSE_Value* pThis, |
| sourceString.Right(count).AsStringC()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Right"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Right"); |
| } |
| } |
| @@ -4897,10 +4793,8 @@ void CXFA_FM2JSContext::Rtrim(CFXJSE_Value* pThis, |
| sourceString.AsStringC()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Rtrim"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Rtrim"); |
| } |
| } |
| @@ -4926,10 +4820,8 @@ void CXFA_FM2JSContext::Space(CFXJSE_Value* pThis, |
| FXJSE_Value_SetUTF8String(args.GetReturnValue(), spaceString.AsStringC()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Space"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Space"); |
| } |
| } |
| @@ -5046,10 +4938,8 @@ void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis, |
| FXJSE_Value_SetNull(args.GetReturnValue()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Str"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Str"); |
| } |
| } |
| @@ -5105,10 +4995,8 @@ void CXFA_FM2JSContext::Stuff(CFXJSE_Value* pThis, |
| resultString.AppendChar(0); |
| FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString.AsStringC()); |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Stuff"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Stuff"); |
| } |
| } |
| @@ -5150,10 +5038,8 @@ void CXFA_FM2JSContext::Substr(CFXJSE_Value* pThis, |
| } |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Substr"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Substr"); |
| } |
| } |
| @@ -5174,10 +5060,8 @@ void CXFA_FM2JSContext::Uuid(CFXJSE_Value* pThis, |
| FX_GUID_ToString(&guid, bsUId, iNum); |
| FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsUId.AsStringC()); |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Uuid"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Uuid"); |
| } |
| } |
| @@ -5219,10 +5103,8 @@ void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis, |
| .AsStringC()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"Upper"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Upper"); |
| } |
| } |
| @@ -5274,10 +5156,8 @@ void CXFA_FM2JSContext::WordNum(CFXJSE_Value* pThis, |
| FXJSE_Value_SetNull(args.GetReturnValue()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| - L"WordNum"); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"WordNum"); |
| } |
| } |
| @@ -5484,8 +5364,7 @@ void CXFA_FM2JSContext::WordUS(const CFX_ByteStringC& szData, |
| void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| if (args.GetLength() == 1) { |
| CXFA_Document* pDoc = pContext->GetDocument(); |
| if (!pDoc) { |
| @@ -5520,8 +5399,7 @@ void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::Post(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| int32_t argc = args.GetLength(); |
| if ((argc >= 2) && (argc <= 5)) { |
| CXFA_Document* pDoc = pContext->GetDocument(); |
| @@ -5579,8 +5457,7 @@ void CXFA_FM2JSContext::Post(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::Put(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| int32_t argc = args.GetLength(); |
| if ((argc == 2) || (argc == 3)) { |
| CXFA_Document* pDoc = pContext->GetDocument(); |
| @@ -5622,8 +5499,7 @@ void CXFA_FM2JSContext::Put(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::assign_value_operator(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| if (args.GetLength() == 2) { |
| std::unique_ptr<CFXJSE_Value> lValue = args.GetValue(0); |
| @@ -5682,9 +5558,8 @@ void CXFA_FM2JSContext::logical_or_operator(CFXJSE_Value* pThis, |
| FXJSE_Value_SetInteger(args.GetReturnValue(), (first || second) ? 1 : 0); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_COMPILER_ERROR); |
| } |
| } |
| @@ -5704,9 +5579,8 @@ void CXFA_FM2JSContext::logical_and_operator(CFXJSE_Value* pThis, |
| FXJSE_Value_SetInteger(args.GetReturnValue(), (first && second) ? 1 : 0); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_COMPILER_ERROR); |
| } |
| } |
| @@ -5743,9 +5617,8 @@ void CXFA_FM2JSContext::equality_operator(CFXJSE_Value* pThis, |
| } |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_COMPILER_ERROR); |
| } |
| } |
| @@ -5781,9 +5654,8 @@ void CXFA_FM2JSContext::notequality_operator(CFXJSE_Value* pThis, |
| } |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_COMPILER_ERROR); |
| } |
| } |
| @@ -5791,9 +5663,7 @@ void CXFA_FM2JSContext::notequality_operator(CFXJSE_Value* pThis, |
| FX_BOOL CXFA_FM2JSContext::fm_ref_equal(CFXJSE_Value* pThis, |
| CFXJSE_Arguments& args) { |
| FX_BOOL bRet = FALSE; |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| + v8::Isolate* pIsolate = pThis->ToJSContext(nullptr)->GetScriptRuntime(); |
| std::unique_ptr<CFXJSE_Value> argFirst = args.GetValue(0); |
| std::unique_ptr<CFXJSE_Value> argSecond = args.GetValue(1); |
| if (FXJSE_Value_IsArray(argFirst.get()) && |
| @@ -5810,8 +5680,8 @@ FX_BOOL CXFA_FM2JSContext::fm_ref_equal(CFXJSE_Value* pThis, |
| FXJSE_Value_GetObjectPropByIdx(argSecond.get(), 2, secondJSObject.get()); |
| if (!FXJSE_Value_IsNull(firstJSObject.get()) && |
| !FXJSE_Value_IsNull(secondJSObject.get())) { |
| - bRet = (FXJSE_Value_ToObject(firstJSObject.get(), nullptr) == |
| - FXJSE_Value_ToObject(secondJSObject.get(), nullptr)); |
| + bRet = (firstJSObject.get()->ToHostObject(nullptr) == |
| + secondJSObject.get()->ToHostObject(nullptr)); |
| } |
| } |
| } |
| @@ -5843,9 +5713,8 @@ void CXFA_FM2JSContext::less_operator(CFXJSE_Value* pThis, |
| FXJSE_Value_SetInteger(args.GetReturnValue(), (first < second) ? 1 : 0); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_COMPILER_ERROR); |
| } |
| } |
| @@ -5878,9 +5747,8 @@ void CXFA_FM2JSContext::lessequal_operator(CFXJSE_Value* pThis, |
| FXJSE_Value_SetInteger(args.GetReturnValue(), (first <= second) ? 1 : 0); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_COMPILER_ERROR); |
| } |
| } |
| @@ -5909,9 +5777,8 @@ void CXFA_FM2JSContext::greater_operator(CFXJSE_Value* pThis, |
| FXJSE_Value_SetInteger(args.GetReturnValue(), (first > second) ? 1 : 0); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_COMPILER_ERROR); |
| } |
| } |
| @@ -5944,9 +5811,8 @@ void CXFA_FM2JSContext::greaterequal_operator(CFXJSE_Value* pThis, |
| FXJSE_Value_SetInteger(args.GetReturnValue(), (first >= second) ? 1 : 0); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_COMPILER_ERROR); |
| } |
| } |
| @@ -5966,9 +5832,8 @@ void CXFA_FM2JSContext::plus_operator(CFXJSE_Value* pThis, |
| FXJSE_Value_SetDouble(args.GetReturnValue(), first + second); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_COMPILER_ERROR); |
| } |
| } |
| @@ -5988,9 +5853,8 @@ void CXFA_FM2JSContext::minus_operator(CFXJSE_Value* pThis, |
| FXJSE_Value_SetDouble(args.GetReturnValue(), first - second); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_COMPILER_ERROR); |
| } |
| } |
| @@ -6010,9 +5874,8 @@ void CXFA_FM2JSContext::multiple_operator(CFXJSE_Value* pThis, |
| FXJSE_Value_SetDouble(args.GetReturnValue(), first * second); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_COMPILER_ERROR); |
| } |
| } |
| @@ -6020,8 +5883,7 @@ void CXFA_FM2JSContext::multiple_operator(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::divide_operator(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| if (args.GetLength() == 2) { |
| std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); |
| std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); |
| @@ -6055,9 +5917,8 @@ void CXFA_FM2JSContext::positive_operator(CFXJSE_Value* pThis, |
| 0.0 + ValueToDouble(pThis, argOne.get())); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_COMPILER_ERROR); |
| } |
| } |
| @@ -6074,9 +5935,8 @@ void CXFA_FM2JSContext::negative_operator(CFXJSE_Value* pThis, |
| 0.0 - ValueToDouble(pThis, argOne.get())); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_COMPILER_ERROR); |
| } |
| } |
| @@ -6093,9 +5953,8 @@ void CXFA_FM2JSContext::logical_not_operator(CFXJSE_Value* pThis, |
| FXJSE_Value_SetInteger(args.GetReturnValue(), (first == 0.0) ? 1 : 0); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_COMPILER_ERROR); |
| } |
| } |
| @@ -6103,8 +5962,7 @@ void CXFA_FM2JSContext::logical_not_operator(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| int32_t argc = args.GetLength(); |
| if ((argc == 4) || (argc == 5)) { |
| @@ -6252,8 +6110,7 @@ void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| int32_t argc = args.GetLength(); |
| if ((argc == 4) || (argc == 5)) { |
| @@ -6396,8 +6253,7 @@ void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| if (args.GetLength() == 1) { |
| std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); |
| CFX_ByteString argString; |
| @@ -6457,8 +6313,7 @@ void CXFA_FM2JSContext::is_fm_array(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::get_fm_value(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| if (args.GetLength() == 1) { |
| std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| @@ -6493,9 +6348,7 @@ void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis, |
| std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| if (FXJSE_Value_IsArray(argOne.get())) { |
| #ifndef NDEBUG |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| + v8::Isolate* pIsolate = pThis->ToJSContext(nullptr)->GetScriptRuntime(); |
| std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| FXJSE_Value_GetObjectProp(argOne.get(), "length", lengthValue.get()); |
| ASSERT(FXJSE_Value_ToInteger(lengthValue.get()) >= 3); |
| @@ -6505,9 +6358,8 @@ void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis, |
| FXJSE_Value_Set(args.GetReturnValue(), argOne.get()); |
| } |
| } else { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| + pThis->ToJSContext(nullptr)->ThrowScriptErrorMessage( |
| + XFA_IDS_COMPILER_ERROR); |
| } |
| } |
| @@ -6515,8 +6367,7 @@ void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::fm_var_filter(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| if (args.GetLength() == 1) { |
| std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); |
| @@ -6567,9 +6418,7 @@ void CXFA_FM2JSContext::fm_var_filter(CFXJSE_Value* pThis, |
| void CXFA_FM2JSContext::concat_fm_object(CFXJSE_Value* pThis, |
| const CFX_ByteStringC& szFuncName, |
| CFXJSE_Arguments& args) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| + v8::Isolate* pIsolate = pThis->ToJSContext(nullptr)->GetScriptRuntime(); |
| uint32_t iLength = 0; |
| int32_t argc = args.GetLength(); |
| std::vector<std::unique_ptr<CFXJSE_Value>> argValues; |
| @@ -6616,9 +6465,7 @@ std::unique_ptr<CFXJSE_Value> CXFA_FM2JSContext::GetSimpleValue( |
| CFXJSE_Value* pThis, |
| CFXJSE_Arguments& args, |
| uint32_t index) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| + v8::Isolate* pIsolate = pThis->ToJSContext(nullptr)->GetScriptRuntime(); |
| ASSERT(index < (uint32_t)args.GetLength()); |
| std::unique_ptr<CFXJSE_Value> argIndex = args.GetValue(index); |
| if (FXJSE_Value_IsArray(argIndex.get())) { |
| @@ -6654,9 +6501,7 @@ std::unique_ptr<CFXJSE_Value> CXFA_FM2JSContext::GetSimpleValue( |
| // static |
| FX_BOOL CXFA_FM2JSContext::ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* arg) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| + v8::Isolate* pIsolate = pThis->ToJSContext(nullptr)->GetScriptRuntime(); |
| FX_BOOL isNull = FALSE; |
| if (FXJSE_Value_IsNull(arg)) { |
| isNull = TRUE; |
| @@ -6700,9 +6545,7 @@ FX_BOOL CXFA_FM2JSContext::ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* arg) { |
| // static |
| int32_t CXFA_FM2JSContext::hvalue_get_array_length(CFXJSE_Value* pThis, |
| CFXJSE_Value* arg) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| + v8::Isolate* pIsolate = pThis->ToJSContext(nullptr)->GetScriptRuntime(); |
| int32_t iLength = 0; |
| if (FXJSE_Value_IsArray(arg)) { |
| std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); |
| @@ -6742,9 +6585,7 @@ void CXFA_FM2JSContext::unfoldArgs(CFXJSE_Value* pThis, |
| CFXJSE_Value**& resultValues, |
| int32_t& iCount, |
| int32_t iStart) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| + v8::Isolate* pIsolate = pThis->ToJSContext(nullptr)->GetScriptRuntime(); |
| iCount = 0; |
| int32_t argc = args.GetLength(); |
| std::vector<std::unique_ptr<CFXJSE_Value>> argsValue; |
| @@ -6809,8 +6650,7 @@ void CXFA_FM2JSContext::unfoldArgs(CFXJSE_Value* pThis, |
| // static |
| void CXFA_FM2JSContext::GetObjectDefaultValue(CFXJSE_Value* pObjectValue, |
| CFXJSE_Value* pDefaultValue) { |
| - CXFA_Node* pNode = |
| - ToNode((CXFA_Object*)FXJSE_Value_ToObject(pObjectValue, nullptr)); |
| + CXFA_Node* pNode = ToNode(pObjectValue->ToObject(nullptr)); |
| if (pNode) { |
| pNode->Script_Som_DefaultValue(pDefaultValue, FALSE, (XFA_ATTRIBUTE)-1); |
| } else { |
| @@ -6821,8 +6661,7 @@ void CXFA_FM2JSContext::GetObjectDefaultValue(CFXJSE_Value* pObjectValue, |
| // static |
| FX_BOOL CXFA_FM2JSContext::SetObjectDefaultValue(CFXJSE_Value* pObjectValue, |
| CFXJSE_Value* hNewValue) { |
| - CXFA_Node* pNode = |
| - ToNode((CXFA_Object*)FXJSE_Value_ToObject(pObjectValue, nullptr)); |
| + CXFA_Node* pNode = ToNode(pObjectValue->ToObject(nullptr)); |
| if (pNode) { |
| pNode->Script_Som_DefaultValue(hNewValue, TRUE, (XFA_ATTRIBUTE)-1); |
| return TRUE; |
| @@ -6867,9 +6706,7 @@ FX_BOOL CXFA_FM2JSContext::GetObjectByName( |
| CFXJSE_Value* accessorValue, |
| const CFX_ByteStringC& szAccessorName) { |
| FX_BOOL bFlags = FALSE; |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - CXFA_Document* pDoc = pContext->GetDocument(); |
| + CXFA_Document* pDoc = pThis->ToJSContext(nullptr)->GetDocument(); |
| if (!pDoc) { |
| return bFlags; |
| } |
| @@ -6898,9 +6735,7 @@ int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, |
| FX_BOOL bHasNoResolveName) { |
| CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(bsSomExp); |
| int32_t iRet = -1; |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - CXFA_Document* pDoc = pContext->GetDocument(); |
| + CXFA_Document* pDoc = pThis->ToJSContext(nullptr)->GetDocument(); |
| if (!pDoc) { |
| return iRet; |
| } |
| @@ -6912,7 +6747,7 @@ int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, |
| pNode = pScriptContext->GetThisObject(); |
| dFlags = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; |
| } else { |
| - pNode = (CXFA_Object*)FXJSE_Value_ToObject(pRefValue, nullptr); |
| + pNode = pRefValue->ToObject(nullptr); |
| ASSERT(pNode); |
| if (bHasNoResolveName) { |
| CFX_WideString wsName; |
| @@ -6934,7 +6769,7 @@ int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, |
| } |
| } |
| } else { |
| - pNode = (CXFA_Object*)FXJSE_Value_ToObject(pRefValue, nullptr); |
| + pNode = pRefValue->ToObject(nullptr); |
| dFlags = XFA_RESOLVENODE_AnyChild; |
| } |
| iRet = pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringC(), |
| @@ -6950,8 +6785,7 @@ void CXFA_FM2JSContext::ParseResolveResult( |
| CFXJSE_Value**& resultValues, |
| int32_t& iSize, |
| FX_BOOL& bAttribute) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| + CXFA_FM2JSContext* pContext = pThis->ToJSContext(nullptr); |
| v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| iSize = 0; |
| resultValues = nullptr; |
| @@ -6991,9 +6825,7 @@ void CXFA_FM2JSContext::ParseResolveResult( |
| // static |
| int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis, |
| CFXJSE_Value* pValue) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| + v8::Isolate* pIsolate = pThis->ToJSContext(nullptr)->GetScriptRuntime(); |
| int32_t iValue = 0; |
| if (FXJSE_Value_IsArray(pValue)) { |
| std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); |
| @@ -7029,9 +6861,7 @@ int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis, |
| // static |
| FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, |
| CFXJSE_Value* arg) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| + v8::Isolate* pIsolate = pThis->ToJSContext(nullptr)->GetScriptRuntime(); |
| FX_FLOAT fRet = 0.0f; |
| if (FXJSE_Value_IsArray(arg)) { |
| std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); |
| @@ -7067,9 +6897,7 @@ FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, |
| // static |
| FX_DOUBLE CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis, |
| CFXJSE_Value* arg) { |
| - CXFA_FM2JSContext* pContext = |
| - static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr)); |
| - v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
| + v8::Isolate* pIsolate = pThis->ToJSContext(nullptr)->GetScriptRuntime(); |
| FX_DOUBLE dRet = 0; |
| if (FXJSE_Value_IsArray(arg)) { |
| std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); |