diff options
29 files changed, 791 insertions, 781 deletions
@@ -1289,6 +1289,10 @@ static_library("fxjs") { "fxjs/cfxjse_class.h", "fxjs/cfxjse_context.cpp", "fxjs/cfxjse_context.h", + "fxjs/cfxjse_engine.cpp", + "fxjs/cfxjse_engine.h", + "fxjs/cfxjse_formcalc_context.cpp", + "fxjs/cfxjse_formcalc_context.h", "fxjs/cfxjse_isolatetracker.cpp", "fxjs/cfxjse_isolatetracker.h", "fxjs/cfxjse_runtimedata.cpp", @@ -1735,8 +1739,6 @@ if (pdf_enable_xfa) { "xfa/fxfa/cxfa_widgetacc.h", "xfa/fxfa/cxfa_widgetacciterator.cpp", "xfa/fxfa/cxfa_widgetacciterator.h", - "xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp", - "xfa/fxfa/fm2js/cxfa_fm2jscontext.h", "xfa/fxfa/fm2js/cxfa_fmexpression.cpp", "xfa/fxfa/fm2js/cxfa_fmexpression.h", "xfa/fxfa/fm2js/cxfa_fmlexer.cpp", @@ -1843,8 +1845,6 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/cxfa_resolveprocessor.h", "xfa/fxfa/parser/cxfa_script.cpp", "xfa/fxfa/parser/cxfa_script.h", - "xfa/fxfa/parser/cxfa_scriptcontext.cpp", - "xfa/fxfa/parser/cxfa_scriptcontext.h", "xfa/fxfa/parser/cxfa_simple_parser.cpp", "xfa/fxfa/parser/cxfa_simple_parser.h", "xfa/fxfa/parser/cxfa_stroke.cpp", @@ -2081,10 +2081,10 @@ test("pdfium_embeddertests") { } if (pdf_enable_xfa) { sources += [ + "fxjs/cfxjse_formcalc_context_embeddertest.cpp", "testing/xfa_js_embedder_test.cpp", "testing/xfa_js_embedder_test.h", "xfa/fwl/cfwl_edit_embeddertest.cpp", - "xfa/fxfa/fm2js/cxfa_fm2jscontext_embeddertest.cpp", "xfa/fxfa/parser/cxfa_simple_parser_embeddertest.cpp", ] } @@ -7,4 +7,5 @@ include_rules = [ '+public', '+fpdfsdk', '+v8/include', + '+xfa/fxfa' ] diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/fxjs/cfxjse_engine.cpp index 4e78f46f17..915c4903fd 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp +++ b/fxjs/cfxjse_engine.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" +#include "fxjs/cfxjse_engine.h" #include <utility> @@ -39,11 +39,11 @@ const FXJSE_CLASS_DESCRIPTOR GlobalClassDescriptor = { nullptr, // methods 0, // property count 0, // method count - CXFA_ScriptContext::GlobalPropTypeGetter, - CXFA_ScriptContext::GlobalPropertyGetter, - CXFA_ScriptContext::GlobalPropertySetter, + CFXJSE_Engine::GlobalPropTypeGetter, + CFXJSE_Engine::GlobalPropertyGetter, + CFXJSE_Engine::GlobalPropertySetter, nullptr, // property deleter - CXFA_ScriptContext::NormalMethodCall, + CFXJSE_Engine::NormalMethodCall, }; const FXJSE_CLASS_DESCRIPTOR NormalClassDescriptor = { @@ -53,11 +53,11 @@ const FXJSE_CLASS_DESCRIPTOR NormalClassDescriptor = { nullptr, // methods 0, // property count 0, // method count - CXFA_ScriptContext::NormalPropTypeGetter, - CXFA_ScriptContext::NormalPropertyGetter, - CXFA_ScriptContext::NormalPropertySetter, + CFXJSE_Engine::NormalPropTypeGetter, + CFXJSE_Engine::NormalPropertyGetter, + CFXJSE_Engine::NormalPropertySetter, nullptr, // property deleter - CXFA_ScriptContext::NormalMethodCall, + CFXJSE_Engine::NormalMethodCall, }; const FXJSE_CLASS_DESCRIPTOR VariablesClassDescriptor = { @@ -67,11 +67,11 @@ const FXJSE_CLASS_DESCRIPTOR VariablesClassDescriptor = { nullptr, // methods 0, // property count 0, // method count - CXFA_ScriptContext::NormalPropTypeGetter, - CXFA_ScriptContext::GlobalPropertyGetter, - CXFA_ScriptContext::GlobalPropertySetter, + CFXJSE_Engine::NormalPropTypeGetter, + CFXJSE_Engine::GlobalPropertyGetter, + CFXJSE_Engine::GlobalPropertySetter, nullptr, // property deleter - CXFA_ScriptContext::NormalMethodCall, + CFXJSE_Engine::NormalMethodCall, }; const char kFormCalcRuntime[] = "pfm_rt"; @@ -115,15 +115,15 @@ const XFA_METHODINFO* GetMethodByName(XFA_Element eElement, } // namespace // static. -CXFA_Object* CXFA_ScriptContext::ToObject(CFXJSE_Value* pValue, - CFXJSE_Class* pClass) { +CXFA_Object* CFXJSE_Engine::ToObject(CFXJSE_Value* pValue, + CFXJSE_Class* pClass) { CFXJSE_HostObject* pHostObj = pValue->ToHostObject(pClass); if (!pHostObj || pHostObj->type() != CFXJSE_HostObject::kXFA) return nullptr; return static_cast<CXFA_Object*>(pHostObj); } -CXFA_ScriptContext::CXFA_ScriptContext(CXFA_Document* pDocument) +CFXJSE_Engine::CFXJSE_Engine(CXFA_Document* pDocument) : m_pDocument(pDocument), m_pIsolate(nullptr), m_pJsClass(nullptr), @@ -133,32 +133,32 @@ CXFA_ScriptContext::CXFA_ScriptContext(CXFA_Document* pDocument) m_dwBuiltInInFlags(0), m_eRunAtType(XFA_ATTRIBUTEENUM_Client) {} -CXFA_ScriptContext::~CXFA_ScriptContext() { +CFXJSE_Engine::~CFXJSE_Engine() { for (const auto& pair : m_mapVariableToContext) delete ToThisProxy(pair.second->GetGlobalObject().get(), nullptr); } -void CXFA_ScriptContext::Initialize(v8::Isolate* pIsolate) { +void CFXJSE_Engine::Initialize(v8::Isolate* pIsolate) { m_pIsolate = pIsolate; DefineJsContext(); DefineJsClass(); m_ResolveProcessor = pdfium::MakeUnique<CXFA_ResolveProcessor>(); } -bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, - const WideStringView& wsScript, - CFXJSE_Value* hRetValue, - CXFA_Object* pThisObject) { +bool CFXJSE_Engine::RunScript(XFA_SCRIPTLANGTYPE eScriptType, + const WideStringView& wsScript, + CFXJSE_Value* hRetValue, + CXFA_Object* pThisObject) { ByteString btScript; AutoRestorer<XFA_SCRIPTLANGTYPE> typeRestorer(&m_eScriptType); m_eScriptType = eScriptType; if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) { if (!m_FM2JSContext) { - m_FM2JSContext = pdfium::MakeUnique<CXFA_FM2JSContext>( + m_FM2JSContext = pdfium::MakeUnique<CFXJSE_FormCalcContext>( m_pIsolate, m_JsContext.get(), m_pDocument.Get()); } CFX_WideTextBuf wsJavaScript; - if (!CXFA_FM2JSContext::Translate(wsScript, &wsJavaScript)) { + if (!CFXJSE_FormCalcContext::Translate(wsScript, &wsJavaScript)) { hRetValue->SetUndefined(); return false; } @@ -172,12 +172,12 @@ bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, return m_JsContext->ExecuteScript(btScript.c_str(), hRetValue, pValue); } -void CXFA_ScriptContext::GlobalPropertySetter(CFXJSE_Value* pObject, - const ByteStringView& szPropName, - CFXJSE_Value* pValue) { +void CFXJSE_Engine::GlobalPropertySetter(CFXJSE_Value* pObject, + const ByteStringView& szPropName, + CFXJSE_Value* pValue) { CXFA_Object* lpOrginalNode = ToObject(pObject, nullptr); CXFA_Document* pDoc = lpOrginalNode->GetDocument(); - CXFA_ScriptContext* lpScriptContext = pDoc->GetScriptContext(); + CFXJSE_Engine* lpScriptContext = pDoc->GetScriptContext(); CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(lpOrginalNode); WideString wsPropName = WideString::FromUTF8(szPropName); uint32_t dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings | @@ -203,11 +203,11 @@ void CXFA_ScriptContext::GlobalPropertySetter(CFXJSE_Value* pObject, pNotify->GetDocEnvironment()->SetGlobalProperty(pNotify->GetHDOC(), szPropName, pValue); } -bool CXFA_ScriptContext::QueryNodeByFlag(CXFA_Node* refNode, - const WideStringView& propname, - CFXJSE_Value* pValue, - uint32_t dwFlag, - bool bSetting) { +bool CFXJSE_Engine::QueryNodeByFlag(CXFA_Node* refNode, + const WideStringView& propname, + CFXJSE_Value* pValue, + uint32_t dwFlag, + bool bSetting) { if (!refNode) return false; XFA_RESOLVENODE_RS resolveRs; @@ -226,12 +226,12 @@ bool CXFA_ScriptContext::QueryNodeByFlag(CXFA_Node* refNode, } return true; } -void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject, - const ByteStringView& szPropName, - CFXJSE_Value* pValue) { +void CFXJSE_Engine::GlobalPropertyGetter(CFXJSE_Value* pObject, + const ByteStringView& szPropName, + CFXJSE_Value* pValue) { CXFA_Object* pOriginalObject = ToObject(pObject, nullptr); CXFA_Document* pDoc = pOriginalObject->GetDocument(); - CXFA_ScriptContext* lpScriptContext = pDoc->GetScriptContext(); + CFXJSE_Engine* lpScriptContext = pDoc->GetScriptContext(); CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(pOriginalObject); WideString wsPropName = WideString::FromUTF8(szPropName); if (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Formcalc) { @@ -267,9 +267,8 @@ void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject, } CXFA_Object* pScriptObject = lpScriptContext->GetVariablesThis(pOriginalObject, true); - if (pScriptObject && - lpScriptContext->QueryVariableValue(pScriptObject->AsNode(), szPropName, - pValue, true)) { + if (pScriptObject && lpScriptContext->QueryVariableValue( + pScriptObject->AsNode(), szPropName, pValue, true)) { return; } CXFA_FFNotify* pNotify = pDoc->GetNotify(); @@ -279,16 +278,16 @@ void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject, pNotify->GetDocEnvironment()->GetGlobalProperty(pNotify->GetHDOC(), szPropName, pValue); } -void CXFA_ScriptContext::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, - const ByteStringView& szPropName, - CFXJSE_Value* pReturnValue) { +void CFXJSE_Engine::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, + const ByteStringView& szPropName, + CFXJSE_Value* pReturnValue) { CXFA_Object* pOriginalObject = ToObject(pOriginalValue, nullptr); if (!pOriginalObject) { pReturnValue->SetUndefined(); return; } WideString wsPropName = WideString::FromUTF8(szPropName); - CXFA_ScriptContext* lpScriptContext = + CFXJSE_Engine* lpScriptContext = pOriginalObject->GetDocument()->GetScriptContext(); CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOriginalObject); if (wsPropName == L"xfa") { @@ -325,14 +324,14 @@ void CXFA_ScriptContext::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, pReturnValue->SetUndefined(); } } -void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, - const ByteStringView& szPropName, - CFXJSE_Value* pReturnValue) { +void CFXJSE_Engine::NormalPropertySetter(CFXJSE_Value* pOriginalValue, + const ByteStringView& szPropName, + CFXJSE_Value* pReturnValue) { CXFA_Object* pOriginalObject = ToObject(pOriginalValue, nullptr); if (!pOriginalObject) return; - CXFA_ScriptContext* lpScriptContext = + CFXJSE_Engine* lpScriptContext = pOriginalObject->GetDocument()->GetScriptContext(); CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOriginalObject); WideString wsPropName = WideString::FromUTF8(szPropName); @@ -374,16 +373,14 @@ void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, } } } -int32_t CXFA_ScriptContext::NormalPropTypeGetter( - CFXJSE_Value* pOriginalValue, - const ByteStringView& szPropName, - bool bQueryIn) { +int32_t CFXJSE_Engine::NormalPropTypeGetter(CFXJSE_Value* pOriginalValue, + const ByteStringView& szPropName, + bool bQueryIn) { CXFA_Object* pObject = ToObject(pOriginalValue, nullptr); if (!pObject) return FXJSE_ClassPropType_None; - CXFA_ScriptContext* lpScriptContext = - pObject->GetDocument()->GetScriptContext(); + CFXJSE_Engine* lpScriptContext = pObject->GetDocument()->GetScriptContext(); pObject = lpScriptContext->GetVariablesThis(pObject); XFA_Element eType = pObject->GetElementType(); WideString wsPropName = WideString::FromUTF8(szPropName); @@ -396,16 +393,14 @@ int32_t CXFA_ScriptContext::NormalPropTypeGetter( } return FXJSE_ClassPropType_Property; } -int32_t CXFA_ScriptContext::GlobalPropTypeGetter( - CFXJSE_Value* pOriginalValue, - const ByteStringView& szPropName, - bool bQueryIn) { +int32_t CFXJSE_Engine::GlobalPropTypeGetter(CFXJSE_Value* pOriginalValue, + const ByteStringView& szPropName, + bool bQueryIn) { CXFA_Object* pObject = ToObject(pOriginalValue, nullptr); if (!pObject) return FXJSE_ClassPropType_None; - CXFA_ScriptContext* lpScriptContext = - pObject->GetDocument()->GetScriptContext(); + CFXJSE_Engine* lpScriptContext = pObject->GetDocument()->GetScriptContext(); pObject = lpScriptContext->GetVariablesThis(pObject); XFA_Element eType = pObject->GetElementType(); WideString wsPropName = WideString::FromUTF8(szPropName); @@ -414,15 +409,14 @@ int32_t CXFA_ScriptContext::GlobalPropTypeGetter( } return FXJSE_ClassPropType_Property; } -void CXFA_ScriptContext::NormalMethodCall(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_Engine::NormalMethodCall(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { CXFA_Object* pObject = ToObject(pThis, nullptr); if (!pObject) return; - CXFA_ScriptContext* lpScriptContext = - pObject->GetDocument()->GetScriptContext(); + CFXJSE_Engine* lpScriptContext = pObject->GetDocument()->GetScriptContext(); pObject = lpScriptContext->GetVariablesThis(pObject); WideString wsFunName = WideString::FromUTF8(szFuncName); const XFA_METHODINFO* lpMethodInfo = @@ -432,22 +426,21 @@ void CXFA_ScriptContext::NormalMethodCall(CFXJSE_Value* pThis, (pObject->*(lpMethodInfo->lpfnCallback))(&args); } -bool CXFA_ScriptContext::IsStrictScopeInJavaScript() { +bool CFXJSE_Engine::IsStrictScopeInJavaScript() { return m_pDocument->HasFlag(XFA_DOCFLAG_StrictScoping); } -XFA_SCRIPTLANGTYPE CXFA_ScriptContext::GetType() { +XFA_SCRIPTLANGTYPE CFXJSE_Engine::GetType() { return m_eScriptType; } -void CXFA_ScriptContext::DefineJsContext() { +void CFXJSE_Engine::DefineJsContext() { m_JsContext = CFXJSE_Context::Create(m_pIsolate, &GlobalClassDescriptor, m_pDocument->GetRoot()); RemoveBuiltInObjs(m_JsContext.get()); m_JsContext->EnableCompatibleMode(); } -CFXJSE_Context* CXFA_ScriptContext::CreateVariablesContext( - CXFA_Node* pScriptNode, - CXFA_Node* pSubform) { +CFXJSE_Context* CFXJSE_Engine::CreateVariablesContext(CXFA_Node* pScriptNode, + CXFA_Node* pSubform) { if (!pScriptNode || !pSubform) return nullptr; @@ -461,8 +454,8 @@ CFXJSE_Context* CXFA_ScriptContext::CreateVariablesContext( return pResult; } -CXFA_Object* CXFA_ScriptContext::GetVariablesThis(CXFA_Object* pObject, - bool bScriptNode) { +CXFA_Object* CFXJSE_Engine::GetVariablesThis(CXFA_Object* pObject, + bool bScriptNode) { if (!pObject->IsVariablesThis()) return pObject; @@ -470,7 +463,7 @@ CXFA_Object* CXFA_ScriptContext::GetVariablesThis(CXFA_Object* pObject, return bScriptNode ? pProxy->GetScriptNode() : pProxy->GetThisNode(); } -bool CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) { +bool CFXJSE_Engine::RunVariablesScript(CXFA_Node* pScriptNode) { if (!pScriptNode) return false; @@ -503,10 +496,10 @@ bool CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) { return pVariablesContext->ExecuteScript(btScript.c_str(), hRetValue.get()); } -bool CXFA_ScriptContext::QueryVariableValue(CXFA_Node* pScriptNode, - const ByteStringView& szPropName, - CFXJSE_Value* pValue, - bool bGetter) { +bool CFXJSE_Engine::QueryVariableValue(CXFA_Node* pScriptNode, + const ByteStringView& szPropName, + CFXJSE_Value* pValue, + bool bGetter) { if (!pScriptNode || pScriptNode->GetElementType() != XFA_Element::Script) return false; @@ -539,12 +532,12 @@ bool CXFA_ScriptContext::QueryVariableValue(CXFA_Node* pScriptNode, return false; } -void CXFA_ScriptContext::DefineJsClass() { +void CFXJSE_Engine::DefineJsClass() { m_pJsClass = CFXJSE_Class::Create(m_JsContext.get(), &NormalClassDescriptor, false); } -void CXFA_ScriptContext::RemoveBuiltInObjs(CFXJSE_Context* pContext) const { +void CFXJSE_Engine::RemoveBuiltInObjs(CFXJSE_Context* pContext) const { static const ByteStringView OBJ_NAME[2] = {"Number", "Date"}; std::unique_ptr<CFXJSE_Value> pObject = pContext->GetGlobalObject(); auto hProp = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate); @@ -553,15 +546,15 @@ void CXFA_ScriptContext::RemoveBuiltInObjs(CFXJSE_Context* pContext) const { pObject->DeleteObjectProperty(OBJ_NAME[i]); } } -CFXJSE_Class* CXFA_ScriptContext::GetJseNormalClass() { +CFXJSE_Class* CFXJSE_Engine::GetJseNormalClass() { return m_pJsClass; } -int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refObject, - const WideStringView& wsExpression, - XFA_RESOLVENODE_RS& resolveNodeRS, - uint32_t dwStyles, - CXFA_Node* bindNode) { +int32_t CFXJSE_Engine::ResolveObjects(CXFA_Object* refObject, + const WideStringView& wsExpression, + XFA_RESOLVENODE_RS& resolveNodeRS, + uint32_t dwStyles, + CXFA_Node* bindNode) { if (wsExpression.IsEmpty()) return 0; @@ -727,11 +720,11 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refObject, return nNodes; } -void CXFA_ScriptContext::AddToCacheList(std::unique_ptr<CXFA_NodeList> pList) { +void CFXJSE_Engine::AddToCacheList(std::unique_ptr<CXFA_NodeList> pList) { m_CacheList.push_back(std::move(pList)); } -CFXJSE_Value* CXFA_ScriptContext::GetJSValueFromMap(CXFA_Object* pObject) { +CFXJSE_Value* CFXJSE_Engine::GetJSValueFromMap(CXFA_Object* pObject) { if (!pObject) return nullptr; if (pObject->IsNode()) @@ -747,33 +740,32 @@ CFXJSE_Value* CXFA_ScriptContext::GetJSValueFromMap(CXFA_Object* pObject) { m_mapObjectToValue.insert(std::make_pair(pObject, std::move(jsValue))); return pValue; } -int32_t CXFA_ScriptContext::GetIndexByName(CXFA_Node* refNode) { +int32_t CFXJSE_Engine::GetIndexByName(CXFA_Node* refNode) { CXFA_NodeHelper* lpNodeHelper = m_ResolveProcessor->GetNodeHelper(); return lpNodeHelper->GetIndex(refNode, XFA_LOGIC_Transparent, lpNodeHelper->NodeIsProperty(refNode), false); } -int32_t CXFA_ScriptContext::GetIndexByClassName(CXFA_Node* refNode) { +int32_t CFXJSE_Engine::GetIndexByClassName(CXFA_Node* refNode) { CXFA_NodeHelper* lpNodeHelper = m_ResolveProcessor->GetNodeHelper(); return lpNodeHelper->GetIndex(refNode, XFA_LOGIC_Transparent, lpNodeHelper->NodeIsProperty(refNode), true); } -void CXFA_ScriptContext::GetSomExpression(CXFA_Node* refNode, - WideString& wsExpression) { +void CFXJSE_Engine::GetSomExpression(CXFA_Node* refNode, + WideString& wsExpression) { CXFA_NodeHelper* lpNodeHelper = m_ResolveProcessor->GetNodeHelper(); lpNodeHelper->GetNameExpression(refNode, wsExpression, true, XFA_LOGIC_Transparent); } -void CXFA_ScriptContext::SetNodesOfRunScript(std::vector<CXFA_Node*>* pArray) { +void CFXJSE_Engine::SetNodesOfRunScript(std::vector<CXFA_Node*>* pArray) { m_pScriptNodeArray = pArray; } -void CXFA_ScriptContext::AddNodesOfRunScript( - const std::vector<CXFA_Node*>& nodes) { +void CFXJSE_Engine::AddNodesOfRunScript(const std::vector<CXFA_Node*>& nodes) { if (m_pScriptNodeArray && !nodes.empty()) *m_pScriptNodeArray = nodes; } -void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) { +void CFXJSE_Engine::AddNodesOfRunScript(CXFA_Node* pNode) { if (m_pScriptNodeArray && !pdfium::ContainsValue(*m_pScriptNodeArray, pNode)) m_pScriptNodeArray->push_back(pNode); } diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.h b/fxjs/cfxjse_engine.h index 75d30278bd..34383cac76 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.h +++ b/fxjs/cfxjse_engine.h @@ -4,16 +4,16 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FXFA_PARSER_CXFA_SCRIPTCONTEXT_H_ -#define XFA_FXFA_PARSER_CXFA_SCRIPTCONTEXT_H_ +#ifndef FXJS_CFXJSE_ENGINE_H_ +#define FXJS_CFXJSE_ENGINE_H_ #include <map> #include <memory> #include <vector> #include "fxjs/cfxjse_arguments.h" +#include "fxjs/cfxjse_formcalc_context.h" #include "xfa/fxfa/cxfa_eventparam.h" -#include "xfa/fxfa/fm2js/cxfa_fm2jscontext.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" @@ -21,10 +21,10 @@ class CXFA_ResolveProcessor; -class CXFA_ScriptContext { +class CFXJSE_Engine { public: - explicit CXFA_ScriptContext(CXFA_Document* pDocument); - ~CXFA_ScriptContext(); + explicit CFXJSE_Engine(CXFA_Document* pDocument); + ~CFXJSE_Engine(); void Initialize(v8::Isolate* pIsolate); void SetEventParam(CXFA_EventParam param) { m_eventParam = param; } @@ -117,10 +117,10 @@ class CXFA_ScriptContext { std::vector<std::unique_ptr<CXFA_NodeList>> m_CacheList; std::vector<CXFA_Node*>* m_pScriptNodeArray; std::unique_ptr<CXFA_ResolveProcessor> m_ResolveProcessor; - std::unique_ptr<CXFA_FM2JSContext> m_FM2JSContext; + std::unique_ptr<CFXJSE_FormCalcContext> m_FM2JSContext; CXFA_Object* m_pThisObject; uint32_t m_dwBuiltInInFlags; XFA_ATTRIBUTEENUM m_eRunAtType; }; -#endif // XFA_FXFA_PARSER_CXFA_SCRIPTCONTEXT_H_ +#endif // FXJS_CFXJSE_ENGINE_H_ diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp b/fxjs/cfxjse_formcalc_context.cpp index 2f271d8c60..c1be933742 100644 --- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp +++ b/fxjs/cfxjse_formcalc_context.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/fm2js/cxfa_fm2jscontext.h" +#include "fxjs/cfxjse_formcalc_context.h" #include <time.h> @@ -17,6 +17,7 @@ #include "core/fxcrt/fx_random.h" #include "fxjs/cfxjse_arguments.h" #include "fxjs/cfxjse_class.h" +#include "fxjs/cfxjse_engine.h" #include "fxjs/cfxjse_value.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" @@ -26,7 +27,6 @@ #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localevalue.h" #include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/cxfa_timezoneprovider.h" #include "xfa/fxfa/parser/xfa_utils.h" @@ -216,97 +216,97 @@ const XFA_FMHtmlReserveCode reservesForEncode[] = { }; const FXJSE_FUNCTION_DESCRIPTOR formcalc_fm2js_functions[] = { - {"Abs", CXFA_FM2JSContext::Abs}, - {"Avg", CXFA_FM2JSContext::Avg}, - {"Ceil", CXFA_FM2JSContext::Ceil}, - {"Count", CXFA_FM2JSContext::Count}, - {"Floor", CXFA_FM2JSContext::Floor}, - {"Max", CXFA_FM2JSContext::Max}, - {"Min", CXFA_FM2JSContext::Min}, - {"Mod", CXFA_FM2JSContext::Mod}, - {"Round", CXFA_FM2JSContext::Round}, - {"Sum", CXFA_FM2JSContext::Sum}, - {"Date", CXFA_FM2JSContext::Date}, - {"Date2Num", CXFA_FM2JSContext::Date2Num}, - {"DateFmt", CXFA_FM2JSContext::DateFmt}, - {"IsoDate2Num", CXFA_FM2JSContext::IsoDate2Num}, - {"IsoTime2Num", CXFA_FM2JSContext::IsoTime2Num}, - {"LocalDateFmt", CXFA_FM2JSContext::LocalDateFmt}, - {"LocalTimeFmt", CXFA_FM2JSContext::LocalTimeFmt}, - {"Num2Date", CXFA_FM2JSContext::Num2Date}, - {"Num2GMTime", CXFA_FM2JSContext::Num2GMTime}, - {"Num2Time", CXFA_FM2JSContext::Num2Time}, - {"Time", CXFA_FM2JSContext::Time}, - {"Time2Num", CXFA_FM2JSContext::Time2Num}, - {"TimeFmt", CXFA_FM2JSContext::TimeFmt}, - {"Apr", CXFA_FM2JSContext::Apr}, - {"Cterm", CXFA_FM2JSContext::CTerm}, - {"FV", CXFA_FM2JSContext::FV}, - {"Ipmt", CXFA_FM2JSContext::IPmt}, - {"NPV", CXFA_FM2JSContext::NPV}, - {"Pmt", CXFA_FM2JSContext::Pmt}, - {"PPmt", CXFA_FM2JSContext::PPmt}, - {"PV", CXFA_FM2JSContext::PV}, - {"Rate", CXFA_FM2JSContext::Rate}, - {"Term", CXFA_FM2JSContext::Term}, - {"Choose", CXFA_FM2JSContext::Choose}, - {"Exists", CXFA_FM2JSContext::Exists}, - {"HasValue", CXFA_FM2JSContext::HasValue}, - {"Oneof", CXFA_FM2JSContext::Oneof}, - {"Within", CXFA_FM2JSContext::Within}, - {"If", CXFA_FM2JSContext::If}, - {"Eval", CXFA_FM2JSContext::Eval}, - {"Translate", CXFA_FM2JSContext::eval_translation}, - {"Ref", CXFA_FM2JSContext::Ref}, - {"UnitType", CXFA_FM2JSContext::UnitType}, - {"UnitValue", CXFA_FM2JSContext::UnitValue}, - {"At", CXFA_FM2JSContext::At}, - {"Concat", CXFA_FM2JSContext::Concat}, - {"Decode", CXFA_FM2JSContext::Decode}, - {"Encode", CXFA_FM2JSContext::Encode}, - {"Format", CXFA_FM2JSContext::Format}, - {"Left", CXFA_FM2JSContext::Left}, - {"Len", CXFA_FM2JSContext::Len}, - {"Lower", CXFA_FM2JSContext::Lower}, - {"Ltrim", CXFA_FM2JSContext::Ltrim}, - {"Parse", CXFA_FM2JSContext::Parse}, - {"Replace", CXFA_FM2JSContext::Replace}, - {"Right", CXFA_FM2JSContext::Right}, - {"Rtrim", CXFA_FM2JSContext::Rtrim}, - {"Space", CXFA_FM2JSContext::Space}, - {"Str", CXFA_FM2JSContext::Str}, - {"Stuff", CXFA_FM2JSContext::Stuff}, - {"Substr", CXFA_FM2JSContext::Substr}, - {"Uuid", CXFA_FM2JSContext::Uuid}, - {"Upper", CXFA_FM2JSContext::Upper}, - {"WordNum", CXFA_FM2JSContext::WordNum}, - {"Get", CXFA_FM2JSContext::Get}, - {"Post", CXFA_FM2JSContext::Post}, - {"Put", CXFA_FM2JSContext::Put}, - {"pos_op", CXFA_FM2JSContext::positive_operator}, - {"neg_op", CXFA_FM2JSContext::negative_operator}, - {"log_or_op", CXFA_FM2JSContext::logical_or_operator}, - {"log_and_op", CXFA_FM2JSContext::logical_and_operator}, - {"log_not_op", CXFA_FM2JSContext::logical_not_operator}, - {"eq_op", CXFA_FM2JSContext::equality_operator}, - {"neq_op", CXFA_FM2JSContext::notequality_operator}, - {"lt_op", CXFA_FM2JSContext::less_operator}, - {"le_op", CXFA_FM2JSContext::lessequal_operator}, - {"gt_op", CXFA_FM2JSContext::greater_operator}, - {"ge_op", CXFA_FM2JSContext::greaterequal_operator}, - {"plus_op", CXFA_FM2JSContext::plus_operator}, - {"minus_op", CXFA_FM2JSContext::minus_operator}, - {"mul_op", CXFA_FM2JSContext::multiple_operator}, - {"div_op", CXFA_FM2JSContext::divide_operator}, - {"asgn_val_op", CXFA_FM2JSContext::assign_value_operator}, - {"dot_acc", CXFA_FM2JSContext::dot_accessor}, - {"dotdot_acc", CXFA_FM2JSContext::dotdot_accessor}, - {"concat_obj", CXFA_FM2JSContext::concat_fm_object}, - {"is_obj", CXFA_FM2JSContext::is_fm_object}, - {"is_ary", CXFA_FM2JSContext::is_fm_array}, - {"get_val", CXFA_FM2JSContext::get_fm_value}, - {"get_jsobj", CXFA_FM2JSContext::get_fm_jsobj}, - {"var_filter", CXFA_FM2JSContext::fm_var_filter}, + {"Abs", CFXJSE_FormCalcContext::Abs}, + {"Avg", CFXJSE_FormCalcContext::Avg}, + {"Ceil", CFXJSE_FormCalcContext::Ceil}, + {"Count", CFXJSE_FormCalcContext::Count}, + {"Floor", CFXJSE_FormCalcContext::Floor}, + {"Max", CFXJSE_FormCalcContext::Max}, + {"Min", CFXJSE_FormCalcContext::Min}, + {"Mod", CFXJSE_FormCalcContext::Mod}, + {"Round", CFXJSE_FormCalcContext::Round}, + {"Sum", CFXJSE_FormCalcContext::Sum}, + {"Date", CFXJSE_FormCalcContext::Date}, + {"Date2Num", CFXJSE_FormCalcContext::Date2Num}, + {"DateFmt", CFXJSE_FormCalcContext::DateFmt}, + {"IsoDate2Num", CFXJSE_FormCalcContext::IsoDate2Num}, + {"IsoTime2Num", CFXJSE_FormCalcContext::IsoTime2Num}, + {"LocalDateFmt", CFXJSE_FormCalcContext::LocalDateFmt}, + {"LocalTimeFmt", CFXJSE_FormCalcContext::LocalTimeFmt}, + {"Num2Date", CFXJSE_FormCalcContext::Num2Date}, + {"Num2GMTime", CFXJSE_FormCalcContext::Num2GMTime}, + {"Num2Time", CFXJSE_FormCalcContext::Num2Time}, + {"Time", CFXJSE_FormCalcContext::Time}, + {"Time2Num", CFXJSE_FormCalcContext::Time2Num}, + {"TimeFmt", CFXJSE_FormCalcContext::TimeFmt}, + {"Apr", CFXJSE_FormCalcContext::Apr}, + {"Cterm", CFXJSE_FormCalcContext::CTerm}, + {"FV", CFXJSE_FormCalcContext::FV}, + {"Ipmt", CFXJSE_FormCalcContext::IPmt}, + {"NPV", CFXJSE_FormCalcContext::NPV}, + {"Pmt", CFXJSE_FormCalcContext::Pmt}, + {"PPmt", CFXJSE_FormCalcContext::PPmt}, + {"PV", CFXJSE_FormCalcContext::PV}, + {"Rate", CFXJSE_FormCalcContext::Rate}, + {"Term", CFXJSE_FormCalcContext::Term}, + {"Choose", CFXJSE_FormCalcContext::Choose}, + {"Exists", CFXJSE_FormCalcContext::Exists}, + {"HasValue", CFXJSE_FormCalcContext::HasValue}, + {"Oneof", CFXJSE_FormCalcContext::Oneof}, + {"Within", CFXJSE_FormCalcContext::Within}, + {"If", CFXJSE_FormCalcContext::If}, + {"Eval", CFXJSE_FormCalcContext::Eval}, + {"Translate", CFXJSE_FormCalcContext::eval_translation}, + {"Ref", CFXJSE_FormCalcContext::Ref}, + {"UnitType", CFXJSE_FormCalcContext::UnitType}, + {"UnitValue", CFXJSE_FormCalcContext::UnitValue}, + {"At", CFXJSE_FormCalcContext::At}, + {"Concat", CFXJSE_FormCalcContext::Concat}, + {"Decode", CFXJSE_FormCalcContext::Decode}, + {"Encode", CFXJSE_FormCalcContext::Encode}, + {"Format", CFXJSE_FormCalcContext::Format}, + {"Left", CFXJSE_FormCalcContext::Left}, + {"Len", CFXJSE_FormCalcContext::Len}, + {"Lower", CFXJSE_FormCalcContext::Lower}, + {"Ltrim", CFXJSE_FormCalcContext::Ltrim}, + {"Parse", CFXJSE_FormCalcContext::Parse}, + {"Replace", CFXJSE_FormCalcContext::Replace}, + {"Right", CFXJSE_FormCalcContext::Right}, + {"Rtrim", CFXJSE_FormCalcContext::Rtrim}, + {"Space", CFXJSE_FormCalcContext::Space}, + {"Str", CFXJSE_FormCalcContext::Str}, + {"Stuff", CFXJSE_FormCalcContext::Stuff}, + {"Substr", CFXJSE_FormCalcContext::Substr}, + {"Uuid", CFXJSE_FormCalcContext::Uuid}, + {"Upper", CFXJSE_FormCalcContext::Upper}, + {"WordNum", CFXJSE_FormCalcContext::WordNum}, + {"Get", CFXJSE_FormCalcContext::Get}, + {"Post", CFXJSE_FormCalcContext::Post}, + {"Put", CFXJSE_FormCalcContext::Put}, + {"pos_op", CFXJSE_FormCalcContext::positive_operator}, + {"neg_op", CFXJSE_FormCalcContext::negative_operator}, + {"log_or_op", CFXJSE_FormCalcContext::logical_or_operator}, + {"log_and_op", CFXJSE_FormCalcContext::logical_and_operator}, + {"log_not_op", CFXJSE_FormCalcContext::logical_not_operator}, + {"eq_op", CFXJSE_FormCalcContext::equality_operator}, + {"neq_op", CFXJSE_FormCalcContext::notequality_operator}, + {"lt_op", CFXJSE_FormCalcContext::less_operator}, + {"le_op", CFXJSE_FormCalcContext::lessequal_operator}, + {"gt_op", CFXJSE_FormCalcContext::greater_operator}, + {"ge_op", CFXJSE_FormCalcContext::greaterequal_operator}, + {"plus_op", CFXJSE_FormCalcContext::plus_operator}, + {"minus_op", CFXJSE_FormCalcContext::minus_operator}, + {"mul_op", CFXJSE_FormCalcContext::multiple_operator}, + {"div_op", CFXJSE_FormCalcContext::divide_operator}, + {"asgn_val_op", CFXJSE_FormCalcContext::assign_value_operator}, + {"dot_acc", CFXJSE_FormCalcContext::dot_accessor}, + {"dotdot_acc", CFXJSE_FormCalcContext::dotdot_accessor}, + {"concat_obj", CFXJSE_FormCalcContext::concat_fm_object}, + {"is_obj", CFXJSE_FormCalcContext::is_fm_object}, + {"is_ary", CFXJSE_FormCalcContext::is_fm_array}, + {"get_val", CFXJSE_FormCalcContext::get_fm_value}, + {"get_jsobj", CFXJSE_FormCalcContext::get_fm_jsobj}, + {"var_filter", CFXJSE_FormCalcContext::fm_var_filter}, }; const FXJSE_CLASS_DESCRIPTOR formcalc_fm2js_descriptor = { @@ -460,11 +460,12 @@ bool PatternStringType(const ByteStringView& szPattern, uint32_t& patternType) { return false; } -CXFA_FM2JSContext* ToJSContext(CFXJSE_Value* pValue, CFXJSE_Class* pClass) { +CFXJSE_FormCalcContext* ToJSContext(CFXJSE_Value* pValue, + CFXJSE_Class* pClass) { CFXJSE_HostObject* pHostObj = pValue->ToHostObject(pClass); if (!pHostObj || pHostObj->type() != CFXJSE_HostObject::kFM2JS) return nullptr; - return static_cast<CXFA_FM2JSContext*>(pHostObj); + return static_cast<CFXJSE_FormCalcContext*>(pHostObj); } bool IsWhitespace(char c) { @@ -534,9 +535,9 @@ ByteString GUIDString(bool bSeparator) { } // namespace // static -void CXFA_FM2JSContext::Abs(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Abs(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Abs"); return; @@ -556,9 +557,9 @@ void CXFA_FM2JSContext::Abs(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Avg(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1) { args.GetReturnValue()->SetNull(); @@ -623,9 +624,9 @@ void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Ceil(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Ceil(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Ceil"); return; @@ -641,10 +642,10 @@ void CXFA_FM2JSContext::Ceil(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Count(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); int32_t iCount = 0; for (int32_t i = 0; i < args.GetLength(); i++) { @@ -695,9 +696,9 @@ void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Floor(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Floor(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Floor"); return; @@ -713,10 +714,10 @@ void CXFA_FM2JSContext::Floor(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Max(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); uint32_t uCount = 0; double dMaxValue = 0.0; @@ -787,10 +788,10 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Min(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); uint32_t uCount = 0; double dMinValue = 0.0; @@ -861,10 +862,10 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Mod(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Mod(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 2) { pContext->ThrowParamCountMismatchException(L"Mod"); return; @@ -896,10 +897,10 @@ void CXFA_FM2JSContext::Mod(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Round(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); int32_t argc = args.GetLength(); if (argc < 1 || argc > 2) { pContext->ThrowParamCountMismatchException(L"Round"); @@ -942,16 +943,16 @@ void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Sum(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc == 0) { args.GetReturnValue()->SetNull(); return; } - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); uint32_t uCount = 0; double dSum = 0.0; @@ -1017,9 +1018,9 @@ void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Date(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Date(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 0) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Date"); return; @@ -1042,9 +1043,9 @@ void CXFA_FM2JSContext::Date(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Date2Num(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 3) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Date2Num"); @@ -1086,9 +1087,9 @@ void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::DateFmt(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::DateFmt(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc > 2) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Date2Num"); @@ -1124,9 +1125,9 @@ void CXFA_FM2JSContext::DateFmt(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::IsoDate2Num(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::IsoDate2Num(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr) ->ThrowParamCountMismatchException(L"IsoDate2Num"); @@ -1142,10 +1143,10 @@ void CXFA_FM2JSContext::IsoDate2Num(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::IsoTime2Num(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 1) { pContext->ThrowParamCountMismatchException(L"IsoTime2Num"); return; @@ -1196,9 +1197,9 @@ void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::LocalDateFmt(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::LocalDateFmt(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc > 2) { ToJSContext(pThis, nullptr) @@ -1234,9 +1235,9 @@ void CXFA_FM2JSContext::LocalDateFmt(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::LocalTimeFmt(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::LocalTimeFmt(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc > 2) { ToJSContext(pThis, nullptr) @@ -1272,9 +1273,9 @@ void CXFA_FM2JSContext::LocalTimeFmt(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Num2Date(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 3) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Num2Date"); @@ -1413,9 +1414,9 @@ void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Num2GMTime(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 3) { ToJSContext(pThis, nullptr) @@ -1461,9 +1462,9 @@ void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Num2Time(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 3) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Num2Time"); @@ -1508,9 +1509,9 @@ void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Time(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Time(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 0) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Time"); return; @@ -1525,9 +1526,9 @@ void CXFA_FM2JSContext::Time(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Time2Num(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 3) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Time2Num"); @@ -1611,9 +1612,9 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::TimeFmt(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc > 2) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"TimeFmt"); @@ -1648,12 +1649,12 @@ void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis, } // static -bool CXFA_FM2JSContext::IsIsoDateFormat(const char* pData, - int32_t iLength, - int32_t& iStyle, - int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) { +bool CFXJSE_FormCalcContext::IsIsoDateFormat(const char* pData, + int32_t iLength, + int32_t& iStyle, + int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) { iYear = 0; iMonth = 1; iDay = 1; @@ -1725,14 +1726,14 @@ bool CXFA_FM2JSContext::IsIsoDateFormat(const char* pData, } // static -bool CXFA_FM2JSContext::IsIsoTimeFormat(const char* pData, - int32_t iLength, - int32_t& iHour, - int32_t& iMinute, - int32_t& iSecond, - int32_t& iMilliSecond, - int32_t& iZoneHour, - int32_t& iZoneMinute) { +bool CFXJSE_FormCalcContext::IsIsoTimeFormat(const char* pData, + int32_t iLength, + int32_t& iHour, + int32_t& iMinute, + int32_t& iSecond, + int32_t& iMilliSecond, + int32_t& iZoneHour, + int32_t& iZoneMinute) { iHour = 0; iMinute = 0; iSecond = 0; @@ -1870,17 +1871,17 @@ bool CXFA_FM2JSContext::IsIsoTimeFormat(const char* pData, } // static -bool CXFA_FM2JSContext::IsIsoDateTimeFormat(const char* pData, - int32_t iLength, - int32_t& iYear, - int32_t& iMonth, - int32_t& iDay, - int32_t& iHour, - int32_t& iMinute, - int32_t& iSecond, - int32_t& iMillionSecond, - int32_t& iZoneHour, - int32_t& iZoneMinute) { +bool CFXJSE_FormCalcContext::IsIsoDateTimeFormat(const char* pData, + int32_t iLength, + int32_t& iYear, + int32_t& iMonth, + int32_t& iDay, + int32_t& iHour, + int32_t& iMinute, + int32_t& iSecond, + int32_t& iMillionSecond, + int32_t& iZoneHour, + int32_t& iZoneMinute) { iYear = 0; iMonth = 0; iDay = 0; @@ -1915,10 +1916,11 @@ bool CXFA_FM2JSContext::IsIsoDateTimeFormat(const char* pData, } // static -ByteString CXFA_FM2JSContext::Local2IsoDate(CFXJSE_Value* pThis, - const ByteStringView& szDate, - const ByteStringView& szFormat, - const ByteStringView& szLocale) { +ByteString CFXJSE_FormCalcContext::Local2IsoDate( + CFXJSE_Value* pThis, + const ByteStringView& szDate, + const ByteStringView& szFormat, + const ByteStringView& szLocale) { CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); if (!pDoc) return ByteString(); @@ -1939,10 +1941,11 @@ ByteString CXFA_FM2JSContext::Local2IsoDate(CFXJSE_Value* pThis, } // static -ByteString CXFA_FM2JSContext::IsoDate2Local(CFXJSE_Value* pThis, - const ByteStringView& szDate, - const ByteStringView& szFormat, - const ByteStringView& szLocale) { +ByteString CFXJSE_FormCalcContext::IsoDate2Local( + CFXJSE_Value* pThis, + const ByteStringView& szDate, + const ByteStringView& szFormat, + const ByteStringView& szLocale) { CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); if (!pDoc) return ByteString(); @@ -1960,10 +1963,11 @@ ByteString CXFA_FM2JSContext::IsoDate2Local(CFXJSE_Value* pThis, } // static -ByteString CXFA_FM2JSContext::IsoTime2Local(CFXJSE_Value* pThis, - const ByteStringView& szTime, - const ByteStringView& szFormat, - const ByteStringView& szLocale) { +ByteString CFXJSE_FormCalcContext::IsoTime2Local( + CFXJSE_Value* pThis, + const ByteStringView& szTime, + const ByteStringView& szFormat, + const ByteStringView& szLocale) { CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); if (!pDoc) return ByteString(); @@ -1983,7 +1987,8 @@ ByteString CXFA_FM2JSContext::IsoTime2Local(CFXJSE_Value* pThis, } // static -int32_t CXFA_FM2JSContext::DateString2Num(const ByteStringView& szDateString) { +int32_t CFXJSE_FormCalcContext::DateString2Num( + const ByteStringView& szDateString) { int32_t iLength = szDateString.GetLength(); int32_t iYear = 0; int32_t iMonth = 0; @@ -2040,10 +2045,11 @@ int32_t CXFA_FM2JSContext::DateString2Num(const ByteStringView& szDateString) { } // static -ByteString CXFA_FM2JSContext::GetLocalDateFormat(CFXJSE_Value* pThis, - int32_t iStyle, - const ByteStringView& szLocale, - bool bStandard) { +ByteString CFXJSE_FormCalcContext::GetLocalDateFormat( + CFXJSE_Value* pThis, + int32_t iStyle, + const ByteStringView& szLocale, + bool bStandard) { CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); if (!pDoc) return ByteString(); @@ -2062,10 +2068,11 @@ ByteString CXFA_FM2JSContext::GetLocalDateFormat(CFXJSE_Value* pThis, } // static -ByteString CXFA_FM2JSContext::GetLocalTimeFormat(CFXJSE_Value* pThis, - int32_t iStyle, - const ByteStringView& szLocale, - bool bStandard) { +ByteString CFXJSE_FormCalcContext::GetLocalTimeFormat( + CFXJSE_Value* pThis, + int32_t iStyle, + const ByteStringView& szLocale, + bool bStandard) { CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); if (!pDoc) return ByteString(); @@ -2084,7 +2091,7 @@ ByteString CXFA_FM2JSContext::GetLocalTimeFormat(CFXJSE_Value* pThis, } // static -ByteString CXFA_FM2JSContext::GetStandardDateFormat( +ByteString CFXJSE_FormCalcContext::GetStandardDateFormat( CFXJSE_Value* pThis, int32_t iStyle, const ByteStringView& szLocalStr) { @@ -2092,7 +2099,7 @@ ByteString CXFA_FM2JSContext::GetStandardDateFormat( } // static -ByteString CXFA_FM2JSContext::GetStandardTimeFormat( +ByteString CFXJSE_FormCalcContext::GetStandardTimeFormat( CFXJSE_Value* pThis, int32_t iStyle, const ByteStringView& szLocalStr) { @@ -2100,11 +2107,11 @@ ByteString CXFA_FM2JSContext::GetStandardTimeFormat( } // static -ByteString CXFA_FM2JSContext::Num2AllTime(CFXJSE_Value* pThis, - int32_t iTime, - const ByteStringView& szFormat, - const ByteStringView& szLocale, - bool bGM) { +ByteString CFXJSE_FormCalcContext::Num2AllTime(CFXJSE_Value* pThis, + int32_t iTime, + const ByteStringView& szFormat, + const ByteStringView& szLocale, + bool bGM) { int32_t iHour = 0; int32_t iMin = 0; int32_t iSec = 0; @@ -2128,9 +2135,9 @@ ByteString CXFA_FM2JSContext::Num2AllTime(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::GetLocalTimeZone(int32_t& iHour, - int32_t& iMin, - int32_t& iSec) { +void CFXJSE_FormCalcContext::GetLocalTimeZone(int32_t& iHour, + int32_t& iMin, + int32_t& iSec) { time_t now; time(&now); @@ -2142,10 +2149,10 @@ void CXFA_FM2JSContext::GetLocalTimeZone(int32_t& iHour, } // static -void CXFA_FM2JSContext::Apr(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Apr(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 3) { pContext->ThrowParamCountMismatchException(L"Apr"); return; @@ -2195,10 +2202,10 @@ void CXFA_FM2JSContext::Apr(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::CTerm(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::CTerm(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 3) { pContext->ThrowParamCountMismatchException(L"CTerm"); return; @@ -2226,10 +2233,10 @@ void CXFA_FM2JSContext::CTerm(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::FV(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::FV(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 3) { pContext->ThrowParamCountMismatchException(L"FV"); return; @@ -2267,10 +2274,10 @@ void CXFA_FM2JSContext::FV(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::IPmt(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 5) { pContext->ThrowParamCountMismatchException(L"IPmt"); return; @@ -2324,10 +2331,10 @@ void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::NPV(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::NPV(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); int32_t argc = args.GetLength(); if (argc < 3) { pContext->ThrowParamCountMismatchException(L"NPV"); @@ -2367,10 +2374,10 @@ void CXFA_FM2JSContext::NPV(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Pmt(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Pmt(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 3) { pContext->ThrowParamCountMismatchException(L"Pmt"); return; @@ -2402,10 +2409,10 @@ void CXFA_FM2JSContext::Pmt(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::PPmt(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 5) { pContext->ThrowParamCountMismatchException(L"PPmt"); return; @@ -2460,10 +2467,10 @@ void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::PV(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::PV(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 3) { pContext->ThrowParamCountMismatchException(L"PV"); return; @@ -2495,10 +2502,10 @@ void CXFA_FM2JSContext::PV(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Rate(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Rate(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 3) { pContext->ThrowParamCountMismatchException(L"Rate"); return; @@ -2526,10 +2533,10 @@ void CXFA_FM2JSContext::Rate(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Term(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Term(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 3) { pContext->ThrowParamCountMismatchException(L"Term"); return; @@ -2557,10 +2564,10 @@ void CXFA_FM2JSContext::Term(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Choose(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); int32_t argc = args.GetLength(); if (argc < 2) { pContext->ThrowParamCountMismatchException(L"Choose"); @@ -2626,9 +2633,9 @@ void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Exists(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Exists(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Exists"); return; @@ -2637,9 +2644,9 @@ void CXFA_FM2JSContext::Exists(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::HasValue(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::HasValue(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"HasValue"); return; @@ -2658,9 +2665,9 @@ void CXFA_FM2JSContext::HasValue(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Oneof(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Oneof(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() < 2) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Oneof"); return; @@ -2681,9 +2688,9 @@ void CXFA_FM2JSContext::Oneof(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Within(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Within(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 3) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Within"); return; @@ -2715,9 +2722,9 @@ void CXFA_FM2JSContext::Within(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::If(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::If(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 3) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"If"); return; @@ -2729,10 +2736,10 @@ void CXFA_FM2JSContext::If(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Eval(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 1) { pContext->ThrowParamCountMismatchException(L"Eval"); return; @@ -2747,7 +2754,7 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, } CFX_WideTextBuf wsJavaScriptBuf; - if (!CXFA_FM2JSContext::Translate( + if (!CFXJSE_FormCalcContext::Translate( WideString::FromUTF8(utf8ScriptString.AsStringView()).AsStringView(), &wsJavaScriptBuf)) { pContext->ThrowCompilerErrorException(); @@ -2765,10 +2772,10 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Ref(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Ref(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); if (args.GetLength() != 1) { pContext->ThrowParamCountMismatchException(L"Ref"); @@ -2823,9 +2830,9 @@ void CXFA_FM2JSContext::Ref(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::UnitType(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"UnitType"); return; @@ -2930,9 +2937,9 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::UnitValue(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 2) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"UnitValue"); @@ -3069,9 +3076,9 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::At(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::At(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"At"); return; @@ -3096,9 +3103,9 @@ void CXFA_FM2JSContext::At(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Concat(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Concat(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Concat"); @@ -3125,9 +3132,9 @@ void CXFA_FM2JSContext::Concat(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Decode(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 2) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Decode"); @@ -3175,7 +3182,7 @@ void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, } // static -WideString CXFA_FM2JSContext::DecodeURL(const WideString& wsURLString) { +WideString CFXJSE_FormCalcContext::DecodeURL(const WideString& wsURLString) { const wchar_t* pData = wsURLString.c_str(); size_t i = 0; CFX_WideTextBuf wsResultBuf; @@ -3212,7 +3219,7 @@ WideString CXFA_FM2JSContext::DecodeURL(const WideString& wsURLString) { } // static -WideString CXFA_FM2JSContext::DecodeHTML(const WideString& wsHTMLString) { +WideString CFXJSE_FormCalcContext::DecodeHTML(const WideString& wsHTMLString) { wchar_t strString[9]; size_t iStrIndex = 0; size_t iLen = wsHTMLString.GetLength(); @@ -3283,7 +3290,7 @@ WideString CXFA_FM2JSContext::DecodeHTML(const WideString& wsHTMLString) { } // static -WideString CXFA_FM2JSContext::DecodeXML(const WideString& wsXMLString) { +WideString CFXJSE_FormCalcContext::DecodeXML(const WideString& wsXMLString) { wchar_t strString[9]; int32_t iStrIndex = 0; int32_t iLen = wsXMLString.GetLength(); @@ -3378,9 +3385,9 @@ WideString CXFA_FM2JSContext::DecodeXML(const WideString& wsXMLString) { } // static -void CXFA_FM2JSContext::Encode(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Encode(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 2) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Encode"); @@ -3422,7 +3429,7 @@ void CXFA_FM2JSContext::Encode(CFXJSE_Value* pThis, } // static -WideString CXFA_FM2JSContext::EncodeURL(const ByteString& szURLString) { +WideString CFXJSE_FormCalcContext::EncodeURL(const ByteString& szURLString) { WideString wsURLString = WideString::FromUTF8(szURLString.AsStringView()); CFX_WideTextBuf wsResultBuf; wchar_t strEncode[4]; @@ -3520,7 +3527,7 @@ WideString CXFA_FM2JSContext::EncodeURL(const ByteString& szURLString) { } // static -WideString CXFA_FM2JSContext::EncodeHTML(const ByteString& szHTMLString) { +WideString CFXJSE_FormCalcContext::EncodeHTML(const ByteString& szHTMLString) { WideString wsHTMLString = WideString::FromUTF8(szHTMLString.AsStringView()); const wchar_t* strCode = L"0123456789abcdef"; wchar_t strEncode[9]; @@ -3567,7 +3574,7 @@ WideString CXFA_FM2JSContext::EncodeHTML(const ByteString& szHTMLString) { } // static -WideString CXFA_FM2JSContext::EncodeXML(const ByteString& szXMLString) { +WideString CFXJSE_FormCalcContext::EncodeXML(const ByteString& szXMLString) { WideString wsXMLString = WideString::FromUTF8(szXMLString.AsStringView()); CFX_WideTextBuf wsResultBuf; wchar_t strEncode[9]; @@ -3634,8 +3641,8 @@ WideString CXFA_FM2JSContext::EncodeXML(const ByteString& szXMLString) { } // static -bool CXFA_FM2JSContext::HTMLSTR2Code(const WideStringView& pData, - uint32_t* iCode) { +bool CFXJSE_FormCalcContext::HTMLSTR2Code(const WideStringView& pData, + uint32_t* iCode) { auto cmpFunc = [](const XFA_FMHtmlReserveCode& iter, const WideStringView& val) { // TODO(tsepez): check usage of c_str() below. @@ -3653,8 +3660,8 @@ bool CXFA_FM2JSContext::HTMLSTR2Code(const WideStringView& pData, } // static -bool CXFA_FM2JSContext::HTMLCode2STR(uint32_t iCode, - WideString* wsHTMLReserve) { +bool CFXJSE_FormCalcContext::HTMLCode2STR(uint32_t iCode, + WideString* wsHTMLReserve) { auto cmpFunc = [](const XFA_FMHtmlReserveCode iter, const uint32_t& val) { return iter.m_uCode < val; }; @@ -3669,10 +3676,10 @@ bool CXFA_FM2JSContext::HTMLCode2STR(uint32_t iCode, } // static -void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Format(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() < 2) { pContext->ThrowParamCountMismatchException(L"Format"); return; @@ -3751,9 +3758,9 @@ void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Left(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Left(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Left"); return; @@ -3773,9 +3780,9 @@ void CXFA_FM2JSContext::Left(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Len(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Len(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Len"); return; @@ -3792,9 +3799,9 @@ void CXFA_FM2JSContext::Len(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Lower(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 2) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Lower"); @@ -3829,9 +3836,9 @@ void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Ltrim(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Ltrim(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Ltrim"); return; @@ -3849,10 +3856,10 @@ void CXFA_FM2JSContext::Ltrim(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Parse(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 2) { pContext->ThrowParamCountMismatchException(L"Parse"); return; @@ -3984,9 +3991,9 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Replace(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Replace(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 2 || argc > 3) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Replace"); @@ -4043,9 +4050,9 @@ void CXFA_FM2JSContext::Replace(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Right(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Right(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Right"); return; @@ -4065,9 +4072,9 @@ void CXFA_FM2JSContext::Right(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Rtrim(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Rtrim(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Rtrim"); return; @@ -4085,9 +4092,9 @@ void CXFA_FM2JSContext::Rtrim(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Space(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Space(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Space"); return; @@ -4111,9 +4118,9 @@ void CXFA_FM2JSContext::Space(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Str(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 3) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Str"); @@ -4227,9 +4234,9 @@ void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Stuff(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Stuff(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 3 || argc > 4) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Stuff"); @@ -4278,9 +4285,9 @@ void CXFA_FM2JSContext::Stuff(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Substr(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Substr(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 3) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Substr"); return; @@ -4316,9 +4323,9 @@ void CXFA_FM2JSContext::Substr(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Uuid(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Uuid(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 0 || argc > 1) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Uuid"); @@ -4334,9 +4341,9 @@ void CXFA_FM2JSContext::Uuid(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::Upper(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 2) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"Upper"); @@ -4371,9 +4378,9 @@ void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::WordNum(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::WordNum(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1 || argc > 3) { ToJSContext(pThis, nullptr)->ThrowParamCountMismatchException(L"WordNum"); @@ -4422,7 +4429,7 @@ void CXFA_FM2JSContext::WordNum(CFXJSE_Value* pThis, } // static -ByteString CXFA_FM2JSContext::TrillionUS(const ByteStringView& szData) { +ByteString CFXJSE_FormCalcContext::TrillionUS(const ByteStringView& szData) { std::ostringstream strBuf; ByteStringView pUnits[] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; @@ -4522,7 +4529,8 @@ ByteString CXFA_FM2JSContext::TrillionUS(const ByteStringView& szData) { } // static -ByteString CXFA_FM2JSContext::WordUS(const ByteString& szData, int32_t iStyle) { +ByteString CFXJSE_FormCalcContext::WordUS(const ByteString& szData, + int32_t iStyle) { const char* pData = szData.c_str(); int32_t iLength = szData.GetLength(); if (iStyle < 0 || iStyle > 2) { @@ -4572,10 +4580,10 @@ ByteString CXFA_FM2JSContext::WordUS(const ByteString& szData, int32_t iStyle) { } // static -void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Get(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 1) { pContext->ThrowParamCountMismatchException(L"Get"); return; @@ -4603,10 +4611,10 @@ void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Post(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Post(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); int32_t argc = args.GetLength(); if (argc < 2 || argc > 5) { pContext->ThrowParamCountMismatchException(L"Post"); @@ -4659,10 +4667,10 @@ void CXFA_FM2JSContext::Post(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::Put(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::Put(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); int32_t argc = args.GetLength(); if (argc < 2 || argc > 3) { pContext->ThrowParamCountMismatchException(L"Put"); @@ -4701,10 +4709,11 @@ void CXFA_FM2JSContext::Put(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::assign_value_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::assign_value_operator( + CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 2) { pContext->ThrowCompilerErrorException(); return; @@ -4745,9 +4754,10 @@ void CXFA_FM2JSContext::assign_value_operator(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::logical_or_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::logical_or_operator( + CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); return; @@ -4766,9 +4776,10 @@ void CXFA_FM2JSContext::logical_or_operator(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::logical_and_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::logical_and_operator( + CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); return; @@ -4787,9 +4798,9 @@ void CXFA_FM2JSContext::logical_and_operator(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::equality_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::equality_operator(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); return; @@ -4820,9 +4831,10 @@ void CXFA_FM2JSContext::equality_operator(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::notequality_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::notequality_operator( + CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); return; @@ -4853,8 +4865,8 @@ void CXFA_FM2JSContext::notequality_operator(CFXJSE_Value* pThis, } // static -bool CXFA_FM2JSContext::fm_ref_equal(CFXJSE_Value* pThis, - CFXJSE_Arguments& args) { +bool CFXJSE_FormCalcContext::fm_ref_equal(CFXJSE_Value* pThis, + CFXJSE_Arguments& args) { std::unique_ptr<CFXJSE_Value> argFirst = args.GetValue(0); std::unique_ptr<CFXJSE_Value> argSecond = args.GetValue(1); if (!argFirst->IsArray() || !argSecond->IsArray()) @@ -4880,9 +4892,9 @@ bool CXFA_FM2JSContext::fm_ref_equal(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::less_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::less_operator(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); return; @@ -4908,9 +4920,10 @@ void CXFA_FM2JSContext::less_operator(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::lessequal_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::lessequal_operator( + CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); return; @@ -4937,9 +4950,9 @@ void CXFA_FM2JSContext::lessequal_operator(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::greater_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::greater_operator(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); return; @@ -4965,9 +4978,10 @@ void CXFA_FM2JSContext::greater_operator(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::greaterequal_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::greaterequal_operator( + CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); return; @@ -4994,9 +5008,9 @@ void CXFA_FM2JSContext::greaterequal_operator(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::plus_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::plus_operator(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); return; @@ -5016,9 +5030,9 @@ void CXFA_FM2JSContext::plus_operator(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::minus_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::minus_operator(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); return; @@ -5037,9 +5051,9 @@ void CXFA_FM2JSContext::minus_operator(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::multiple_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::multiple_operator(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 2) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); return; @@ -5058,10 +5072,10 @@ void CXFA_FM2JSContext::multiple_operator(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::divide_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::divide_operator(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 2) { pContext->ThrowCompilerErrorException(); return; @@ -5085,9 +5099,9 @@ void CXFA_FM2JSContext::divide_operator(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::positive_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::positive_operator(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); return; @@ -5102,9 +5116,9 @@ void CXFA_FM2JSContext::positive_operator(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::negative_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::negative_operator(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); return; @@ -5119,9 +5133,10 @@ void CXFA_FM2JSContext::negative_operator(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::logical_not_operator(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::logical_not_operator( + CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); return; @@ -5138,10 +5153,10 @@ void CXFA_FM2JSContext::logical_not_operator(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::dot_accessor(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); int32_t argc = args.GetLength(); if (argc < 4 || argc > 5) { @@ -5256,10 +5271,10 @@ void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::dotdot_accessor(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); int32_t argc = args.GetLength(); if (argc < 4 || argc > 5) { @@ -5374,10 +5389,10 @@ void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::eval_translation(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 1) { pContext->ThrowParamCountMismatchException(L"Eval"); return; @@ -5392,8 +5407,8 @@ void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis, WideString scriptString = WideString::FromUTF8(argString.AsStringView()); CFX_WideTextBuf wsJavaScriptBuf; - if (!CXFA_FM2JSContext::Translate(scriptString.AsStringView(), - &wsJavaScriptBuf)) { + if (!CFXJSE_FormCalcContext::Translate(scriptString.AsStringView(), + &wsJavaScriptBuf)) { pContext->ThrowCompilerErrorException(); return; } @@ -5403,9 +5418,9 @@ void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::is_fm_object(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::is_fm_object(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { args.GetReturnValue()->SetBoolean(false); return; @@ -5416,9 +5431,9 @@ void CXFA_FM2JSContext::is_fm_object(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::is_fm_array(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::is_fm_array(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { args.GetReturnValue()->SetBoolean(false); return; @@ -5429,10 +5444,10 @@ void CXFA_FM2JSContext::is_fm_array(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::get_fm_value(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::get_fm_value(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 1) { pContext->ThrowCompilerErrorException(); return; @@ -5464,9 +5479,9 @@ void CXFA_FM2JSContext::get_fm_value(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::get_fm_jsobj(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { if (args.GetLength() != 1) { ToJSContext(pThis, nullptr)->ThrowCompilerErrorException(); return; @@ -5479,7 +5494,7 @@ void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis, } #ifndef NDEBUG - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate); argOne->GetObjectProperty("length", lengthValue.get()); @@ -5490,10 +5505,10 @@ void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::fm_var_filter(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); +void CFXJSE_FormCalcContext::fm_var_filter(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); if (args.GetLength() != 1) { pContext->ThrowCompilerErrorException(); return; @@ -5544,9 +5559,9 @@ void CXFA_FM2JSContext::fm_var_filter(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::concat_fm_object(CFXJSE_Value* pThis, - const ByteStringView& szFuncName, - CFXJSE_Arguments& args) { +void CFXJSE_FormCalcContext::concat_fm_object(CFXJSE_Value* pThis, + const ByteStringView& szFuncName, + CFXJSE_Arguments& args) { v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); uint32_t iLength = 0; int32_t argc = args.GetLength(); @@ -5585,7 +5600,7 @@ void CXFA_FM2JSContext::concat_fm_object(CFXJSE_Value* pThis, } // static -std::unique_ptr<CFXJSE_Value> CXFA_FM2JSContext::GetSimpleValue( +std::unique_ptr<CFXJSE_Value> CFXJSE_FormCalcContext::GetSimpleValue( CFXJSE_Value* pThis, CFXJSE_Arguments& args, uint32_t index) { @@ -5626,7 +5641,8 @@ std::unique_ptr<CFXJSE_Value> CXFA_FM2JSContext::GetSimpleValue( } // static -bool CXFA_FM2JSContext::ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* arg) { +bool CFXJSE_FormCalcContext::ValueIsNull(CFXJSE_Value* pThis, + CFXJSE_Value* arg) { if (!arg || arg->IsNull()) return true; @@ -5661,8 +5677,8 @@ 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) { +int32_t CFXJSE_FormCalcContext::hvalue_get_array_length(CFXJSE_Value* pThis, + CFXJSE_Value* arg) { if (!arg || !arg->IsArray()) return 0; @@ -5673,9 +5689,9 @@ int32_t CXFA_FM2JSContext::hvalue_get_array_length(CFXJSE_Value* pThis, } // static -bool CXFA_FM2JSContext::simpleValueCompare(CFXJSE_Value* pThis, - CFXJSE_Value* firstValue, - CFXJSE_Value* secondValue) { +bool CFXJSE_FormCalcContext::simpleValueCompare(CFXJSE_Value* pThis, + CFXJSE_Value* firstValue, + CFXJSE_Value* secondValue) { if (!firstValue) return false; @@ -5696,7 +5712,7 @@ bool CXFA_FM2JSContext::simpleValueCompare(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::unfoldArgs( +void CFXJSE_FormCalcContext::unfoldArgs( CFXJSE_Value* pThis, CFXJSE_Arguments& args, std::vector<std::unique_ptr<CFXJSE_Value>>* resultValues, @@ -5761,9 +5777,10 @@ void CXFA_FM2JSContext::unfoldArgs( } // static -void CXFA_FM2JSContext::GetObjectDefaultValue(CFXJSE_Value* pValue, - CFXJSE_Value* pDefaultValue) { - CXFA_Node* pNode = ToNode(CXFA_ScriptContext::ToObject(pValue, nullptr)); +void CFXJSE_FormCalcContext::GetObjectDefaultValue( + CFXJSE_Value* pValue, + CFXJSE_Value* pDefaultValue) { + CXFA_Node* pNode = ToNode(CFXJSE_Engine::ToObject(pValue, nullptr)); if (!pNode) { pDefaultValue->SetNull(); return; @@ -5772,9 +5789,9 @@ void CXFA_FM2JSContext::GetObjectDefaultValue(CFXJSE_Value* pValue, } // static -bool CXFA_FM2JSContext::SetObjectDefaultValue(CFXJSE_Value* pValue, - CFXJSE_Value* hNewValue) { - CXFA_Node* pNode = ToNode(CXFA_ScriptContext::ToObject(pValue, nullptr)); +bool CFXJSE_FormCalcContext::SetObjectDefaultValue(CFXJSE_Value* pValue, + CFXJSE_Value* hNewValue) { + CXFA_Node* pNode = ToNode(CFXJSE_Engine::ToObject(pValue, nullptr)); if (!pNode) return false; @@ -5783,7 +5800,7 @@ bool CXFA_FM2JSContext::SetObjectDefaultValue(CFXJSE_Value* pValue, } // static -ByteString CXFA_FM2JSContext::GenerateSomExpression( +ByteString CFXJSE_FormCalcContext::GenerateSomExpression( const ByteStringView& szName, int32_t iIndexFlags, int32_t iIndexValue, @@ -5814,14 +5831,15 @@ ByteString CXFA_FM2JSContext::GenerateSomExpression( } // static -bool CXFA_FM2JSContext::GetObjectForName(CFXJSE_Value* pThis, - CFXJSE_Value* accessorValue, - const ByteStringView& szAccessorName) { +bool CFXJSE_FormCalcContext::GetObjectForName( + CFXJSE_Value* pThis, + CFXJSE_Value* accessorValue, + const ByteStringView& szAccessorName) { CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); if (!pDoc) return false; - CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); + CFXJSE_Engine* pScriptContext = pDoc->GetScriptContext(); XFA_RESOLVENODE_RS resoveNodeRS; uint32_t dwFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; @@ -5838,18 +5856,18 @@ bool CXFA_FM2JSContext::GetObjectForName(CFXJSE_Value* pThis, } // static -int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, - CFXJSE_Value* pRefValue, - const ByteStringView& bsSomExp, - XFA_RESOLVENODE_RS& resoveNodeRS, - bool bdotAccessor, - bool bHasNoResolveName) { +int32_t CFXJSE_FormCalcContext::ResolveObjects(CFXJSE_Value* pThis, + CFXJSE_Value* pRefValue, + const ByteStringView& bsSomExp, + XFA_RESOLVENODE_RS& resoveNodeRS, + bool bdotAccessor, + bool bHasNoResolveName) { CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); if (!pDoc) return -1; WideString wsSomExpression = WideString::FromUTF8(bsSomExp); - CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); + CFXJSE_Engine* pScriptContext = pDoc->GetScriptContext(); CXFA_Object* pNode = nullptr; uint32_t dFlags = 0UL; if (bdotAccessor) { @@ -5857,7 +5875,7 @@ int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, pNode = pScriptContext->GetThisObject(); dFlags = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; } else { - pNode = CXFA_ScriptContext::ToObject(pRefValue, nullptr); + pNode = CFXJSE_Engine::ToObject(pRefValue, nullptr); ASSERT(pNode); if (bHasNoResolveName) { WideString wsName; @@ -5876,7 +5894,7 @@ int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, } } } else { - pNode = CXFA_ScriptContext::ToObject(pRefValue, nullptr); + pNode = CFXJSE_Engine::ToObject(pRefValue, nullptr); dFlags = XFA_RESOLVENODE_AnyChild; } return pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringView(), @@ -5884,7 +5902,7 @@ int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, } // static -void CXFA_FM2JSContext::ParseResolveResult( +void CFXJSE_FormCalcContext::ParseResolveResult( CFXJSE_Value* pThis, const XFA_RESOLVENODE_RS& resoveNodeRS, CFXJSE_Value* pParentValue, @@ -5894,13 +5912,12 @@ void CXFA_FM2JSContext::ParseResolveResult( resultValues->clear(); - CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); + CFXJSE_FormCalcContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { *bAttribute = false; - CXFA_ScriptContext* pScriptContext = - pContext->GetDocument()->GetScriptContext(); + CFXJSE_Engine* pScriptContext = pContext->GetDocument()->GetScriptContext(); for (CXFA_Object* pObject : resoveNodeRS.objects) { resultValues->push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate)); resultValues->back()->Assign(pScriptContext->GetJSValueFromMap(pObject)); @@ -5928,8 +5945,8 @@ void CXFA_FM2JSContext::ParseResolveResult( } // static -int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis, - CFXJSE_Value* pValue) { +int32_t CFXJSE_FormCalcContext::ValueToInteger(CFXJSE_Value* pThis, + CFXJSE_Value* pValue) { if (!pValue) return 0; @@ -5960,7 +5977,8 @@ int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis, } // static -float CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* arg) { +float CFXJSE_FormCalcContext::ValueToFloat(CFXJSE_Value* pThis, + CFXJSE_Value* arg) { if (!arg) return 0.0f; @@ -5993,8 +6011,8 @@ float CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* arg) { } // static -double CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis, - CFXJSE_Value* arg) { +double CFXJSE_FormCalcContext::ValueToDouble(CFXJSE_Value* pThis, + CFXJSE_Value* arg) { if (!arg) return 0; @@ -6026,9 +6044,9 @@ double CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis, } // static. -double CXFA_FM2JSContext::ExtractDouble(CFXJSE_Value* pThis, - CFXJSE_Value* src, - bool* ret) { +double CFXJSE_FormCalcContext::ExtractDouble(CFXJSE_Value* pThis, + CFXJSE_Value* src, + bool* ret) { ASSERT(ret); *ret = true; @@ -6061,7 +6079,7 @@ double CXFA_FM2JSContext::ExtractDouble(CFXJSE_Value* pThis, } // static -ByteString CXFA_FM2JSContext::ValueToUTF8String(CFXJSE_Value* arg) { +ByteString CFXJSE_FormCalcContext::ValueToUTF8String(CFXJSE_Value* arg) { if (!arg || arg->IsNull() || arg->IsUndefined()) return ByteString(); if (arg->IsBoolean()) @@ -6070,8 +6088,8 @@ ByteString CXFA_FM2JSContext::ValueToUTF8String(CFXJSE_Value* arg) { } // static. -bool CXFA_FM2JSContext::Translate(const WideStringView& wsFormcalc, - CFX_WideTextBuf* wsJavascript) { +bool CFXJSE_FormCalcContext::Translate(const WideStringView& wsFormcalc, + CFX_WideTextBuf* wsJavascript) { if (wsFormcalc.IsEmpty()) { wsJavascript->Clear(); return true; @@ -6091,9 +6109,9 @@ bool CXFA_FM2JSContext::Translate(const WideStringView& wsFormcalc, return !CXFA_IsTooBig(*wsJavascript); } -CXFA_FM2JSContext::CXFA_FM2JSContext(v8::Isolate* pScriptIsolate, - CFXJSE_Context* pScriptContext, - CXFA_Document* pDoc) +CFXJSE_FormCalcContext::CFXJSE_FormCalcContext(v8::Isolate* pScriptIsolate, + CFXJSE_Context* pScriptContext, + CXFA_Document* pDoc) : CFXJSE_HostObject(kFM2JS), m_pIsolate(pScriptIsolate), m_pFMClass(CFXJSE_Class::Create(pScriptContext, @@ -6104,32 +6122,32 @@ CXFA_FM2JSContext::CXFA_FM2JSContext(v8::Isolate* pScriptIsolate, m_pValue.get()->SetObject(this, m_pFMClass); } -CXFA_FM2JSContext::~CXFA_FM2JSContext() {} +CFXJSE_FormCalcContext::~CFXJSE_FormCalcContext() {} -void CXFA_FM2JSContext::GlobalPropertyGetter(CFXJSE_Value* pValue) { +void CFXJSE_FormCalcContext::GlobalPropertyGetter(CFXJSE_Value* pValue) { pValue->Assign(m_pValue.get()); } -void CXFA_FM2JSContext::ThrowNoDefaultPropertyException( +void CFXJSE_FormCalcContext::ThrowNoDefaultPropertyException( const ByteStringView& name) const { // TODO(tsepez): check usage of c_str() below. ThrowException(L"%.16S doesn't have a default property.", name.unterminated_c_str()); } -void CXFA_FM2JSContext::ThrowCompilerErrorException() const { +void CFXJSE_FormCalcContext::ThrowCompilerErrorException() const { ThrowException(L"Compiler error."); } -void CXFA_FM2JSContext::ThrowDivideByZeroException() const { +void CFXJSE_FormCalcContext::ThrowDivideByZeroException() const { ThrowException(L"Divide by zero."); } -void CXFA_FM2JSContext::ThrowServerDeniedException() const { +void CFXJSE_FormCalcContext::ThrowServerDeniedException() const { ThrowException(L"Server does not permit operation."); } -void CXFA_FM2JSContext::ThrowPropertyNotInObjectException( +void CFXJSE_FormCalcContext::ThrowPropertyNotInObjectException( const WideString& name, const WideString& exp) const { ThrowException( @@ -6138,17 +6156,17 @@ void CXFA_FM2JSContext::ThrowPropertyNotInObjectException( name.c_str(), exp.c_str()); } -void CXFA_FM2JSContext::ThrowParamCountMismatchException( +void CFXJSE_FormCalcContext::ThrowParamCountMismatchException( const WideString& method) const { ThrowException(L"Incorrect number of parameters calling method '%.16s'.", method.c_str()); } -void CXFA_FM2JSContext::ThrowArgumentMismatchException() const { +void CFXJSE_FormCalcContext::ThrowArgumentMismatchException() const { ThrowException(L"Argument mismatch in property or function argument."); } -void CXFA_FM2JSContext::ThrowException(const wchar_t* str, ...) const { +void CFXJSE_FormCalcContext::ThrowException(const wchar_t* str, ...) const { WideString wsMessage; va_list arg_ptr; va_start(arg_ptr, str); diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.h b/fxjs/cfxjse_formcalc_context.h index 8d1b33bf81..ec9c14b77b 100644 --- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.h +++ b/fxjs/cfxjse_formcalc_context.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FXFA_FM2JS_CXFA_FM2JSCONTEXT_H_ -#define XFA_FXFA_FM2JS_CXFA_FM2JSCONTEXT_H_ +#ifndef FXJS_CFXJSE_FORMCALC_CONTEXT_H_ +#define FXJS_CFXJSE_FORMCALC_CONTEXT_H_ #include <memory> #include <vector> @@ -17,12 +17,12 @@ class CFX_WideTextBuf; class CXFA_Document; -class CXFA_FM2JSContext : public CFXJSE_HostObject { +class CFXJSE_FormCalcContext : public CFXJSE_HostObject { public: - CXFA_FM2JSContext(v8::Isolate* pScriptIsolate, - CFXJSE_Context* pScriptContext, - CXFA_Document* pDoc); - ~CXFA_FM2JSContext() override; + CFXJSE_FormCalcContext(v8::Isolate* pScriptIsolate, + CFXJSE_Context* pScriptContext, + CXFA_Document* pDoc); + ~CFXJSE_FormCalcContext() override; static void Abs(CFXJSE_Value* pThis, const ByteStringView& szFuncName, @@ -442,4 +442,4 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { UnownedPtr<CXFA_Document> const m_pDocument; }; -#endif // XFA_FXFA_FM2JS_CXFA_FM2JSCONTEXT_H_ +#endif // FXJS_CFXJSE_FORMCALC_CONTEXT_H_ diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext_embeddertest.cpp b/fxjs/cfxjse_formcalc_context_embeddertest.cpp index ff2e200186..d48d5cc445 100644 --- a/xfa/fxfa/fm2js/cxfa_fm2jscontext_embeddertest.cpp +++ b/fxjs/cfxjse_formcalc_context_embeddertest.cpp @@ -5,11 +5,11 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/xfa_js_embedder_test.h" -class FM2JSContextEmbedderTest : public XFAJSEmbedderTest {}; +class CFXJSE_FormCalcContextEmbedderTest : public XFAJSEmbedderTest {}; // TODO(dsinclair): Comment out tests are broken and need to be fixed. -TEST_F(FM2JSContextEmbedderTest, TranslateEmpty) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, TranslateEmpty) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); const char input[] = ""; @@ -18,7 +18,7 @@ TEST_F(FM2JSContextEmbedderTest, TranslateEmpty) { // is invalid. } -TEST_F(FM2JSContextEmbedderTest, TranslateNumber) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, TranslateNumber) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); const char input[] = "123"; @@ -29,7 +29,7 @@ TEST_F(FM2JSContextEmbedderTest, TranslateNumber) { EXPECT_EQ(123, value->ToInteger()) << "Program: " << input; } -TEST_F(FM2JSContextEmbedderTest, Numeric) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Numeric) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -70,7 +70,7 @@ TEST_F(FM2JSContextEmbedderTest, Numeric) { } } -TEST_F(FM2JSContextEmbedderTest, Strings) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Strings) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -92,7 +92,7 @@ TEST_F(FM2JSContextEmbedderTest, Strings) { } } -TEST_F(FM2JSContextEmbedderTest, Booleans) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Booleans) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -132,7 +132,7 @@ TEST_F(FM2JSContextEmbedderTest, Booleans) { } } -TEST_F(FM2JSContextEmbedderTest, Abs) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Abs) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -150,7 +150,7 @@ TEST_F(FM2JSContextEmbedderTest, Abs) { } } -TEST_F(FM2JSContextEmbedderTest, Avg) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Avg) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -168,7 +168,7 @@ TEST_F(FM2JSContextEmbedderTest, Avg) { } } -TEST_F(FM2JSContextEmbedderTest, Ceil) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Ceil) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -186,7 +186,7 @@ TEST_F(FM2JSContextEmbedderTest, Ceil) { } } -TEST_F(FM2JSContextEmbedderTest, Count) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Count) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -204,7 +204,7 @@ TEST_F(FM2JSContextEmbedderTest, Count) { } } -TEST_F(FM2JSContextEmbedderTest, Floor) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Floor) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -224,7 +224,7 @@ TEST_F(FM2JSContextEmbedderTest, Floor) { } } -TEST_F(FM2JSContextEmbedderTest, Max) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Max) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -244,7 +244,7 @@ TEST_F(FM2JSContextEmbedderTest, Max) { } } -TEST_F(FM2JSContextEmbedderTest, Min) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Min) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -266,7 +266,7 @@ TEST_F(FM2JSContextEmbedderTest, Min) { } } -TEST_F(FM2JSContextEmbedderTest, Mod) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Mod) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -284,7 +284,7 @@ TEST_F(FM2JSContextEmbedderTest, Mod) { } } -TEST_F(FM2JSContextEmbedderTest, Round) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Round) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -305,7 +305,7 @@ TEST_F(FM2JSContextEmbedderTest, Round) { } } -TEST_F(FM2JSContextEmbedderTest, Sum) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Sum) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -325,7 +325,7 @@ TEST_F(FM2JSContextEmbedderTest, Sum) { } } -// TEST_F(FM2JSContextEmbedderTest, DISABLED_Date) { +// TEST_F(CFXJSE_FormCalcContextEmbedderTest, DISABLED_Date) { // ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); // // TODO(dsinclair): Make compatible with windows. @@ -339,7 +339,7 @@ TEST_F(FM2JSContextEmbedderTest, Sum) { // EXPECT_EQ(days, value->ToInteger()); // } -TEST_F(FM2JSContextEmbedderTest, Date2Num) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Date2Num) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -364,7 +364,7 @@ TEST_F(FM2JSContextEmbedderTest, Date2Num) { } } -TEST_F(FM2JSContextEmbedderTest, DateFmt) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, DateFmt) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -388,7 +388,7 @@ TEST_F(FM2JSContextEmbedderTest, DateFmt) { } } -TEST_F(FM2JSContextEmbedderTest, IsoDate2Num) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, IsoDate2Num) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -410,7 +410,7 @@ TEST_F(FM2JSContextEmbedderTest, IsoDate2Num) { } } -TEST_F(FM2JSContextEmbedderTest, DISABLED_IsoTime2Num) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, DISABLED_IsoTime2Num) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -428,7 +428,7 @@ TEST_F(FM2JSContextEmbedderTest, DISABLED_IsoTime2Num) { } } -TEST_F(FM2JSContextEmbedderTest, LocalDateFmt) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, LocalDateFmt) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -450,7 +450,7 @@ TEST_F(FM2JSContextEmbedderTest, LocalDateFmt) { } } -TEST_F(FM2JSContextEmbedderTest, DISABLED_LocalTimeFmt) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, DISABLED_LocalTimeFmt) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -472,7 +472,7 @@ TEST_F(FM2JSContextEmbedderTest, DISABLED_LocalTimeFmt) { } } -TEST_F(FM2JSContextEmbedderTest, Num2Date) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Num2Date) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -497,7 +497,7 @@ TEST_F(FM2JSContextEmbedderTest, Num2Date) { } } -TEST_F(FM2JSContextEmbedderTest, DISABLED_Num2GMTime) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, DISABLED_Num2GMTime) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -522,7 +522,7 @@ TEST_F(FM2JSContextEmbedderTest, DISABLED_Num2GMTime) { } // TODO(dsinclair): Broken on Mac ... -TEST_F(FM2JSContextEmbedderTest, DISABLED_Num2Time) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, DISABLED_Num2Time) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -541,7 +541,7 @@ TEST_F(FM2JSContextEmbedderTest, DISABLED_Num2Time) { } } -// TEST_F(FM2JSContextEmbedderTest, DISABLED_Time) { +// TEST_F(CFXJSE_FormCalcContextEmbedderTest, DISABLED_Time) { // ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); // TODO(dsinclair): Make compatible with windows. // struct timeval tp; @@ -555,7 +555,7 @@ TEST_F(FM2JSContextEmbedderTest, DISABLED_Num2Time) { // << "Program: Time()"; // } -TEST_F(FM2JSContextEmbedderTest, Time2Num) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Time2Num) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -575,7 +575,7 @@ TEST_F(FM2JSContextEmbedderTest, Time2Num) { } } -TEST_F(FM2JSContextEmbedderTest, TimeFmt) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, TimeFmt) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -599,7 +599,7 @@ TEST_F(FM2JSContextEmbedderTest, TimeFmt) { } } -TEST_F(FM2JSContextEmbedderTest, DISABLED_Apr) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, DISABLED_Apr) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -618,7 +618,7 @@ TEST_F(FM2JSContextEmbedderTest, DISABLED_Apr) { } } -TEST_F(FM2JSContextEmbedderTest, CTerm) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, CTerm) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -640,7 +640,7 @@ TEST_F(FM2JSContextEmbedderTest, CTerm) { } } -TEST_F(FM2JSContextEmbedderTest, FV) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, FV) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -659,7 +659,7 @@ TEST_F(FM2JSContextEmbedderTest, FV) { } } -TEST_F(FM2JSContextEmbedderTest, IPmt) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, IPmt) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -679,7 +679,7 @@ TEST_F(FM2JSContextEmbedderTest, IPmt) { } } -TEST_F(FM2JSContextEmbedderTest, DISABLED_NPV) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, DISABLED_NPV) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -699,7 +699,7 @@ TEST_F(FM2JSContextEmbedderTest, DISABLED_NPV) { } } -TEST_F(FM2JSContextEmbedderTest, Pmt) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Pmt) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -718,7 +718,7 @@ TEST_F(FM2JSContextEmbedderTest, Pmt) { } } -TEST_F(FM2JSContextEmbedderTest, PPmt) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, PPmt) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -740,7 +740,7 @@ TEST_F(FM2JSContextEmbedderTest, PPmt) { } } -TEST_F(FM2JSContextEmbedderTest, PV) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, PV) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -761,7 +761,7 @@ TEST_F(FM2JSContextEmbedderTest, PV) { } } -TEST_F(FM2JSContextEmbedderTest, DISABLED_Rate) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, DISABLED_Rate) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -780,7 +780,7 @@ TEST_F(FM2JSContextEmbedderTest, DISABLED_Rate) { } } -TEST_F(FM2JSContextEmbedderTest, Term) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Term) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -799,7 +799,7 @@ TEST_F(FM2JSContextEmbedderTest, Term) { } } -TEST_F(FM2JSContextEmbedderTest, Choose) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Choose) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -822,7 +822,7 @@ TEST_F(FM2JSContextEmbedderTest, Choose) { } } -TEST_F(FM2JSContextEmbedderTest, Exists) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Exists) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); EXPECT_TRUE(Execute("Exists(\"hello world\")")); @@ -831,7 +831,7 @@ TEST_F(FM2JSContextEmbedderTest, Exists) { EXPECT_FALSE(value->ToBoolean()); } -TEST_F(FM2JSContextEmbedderTest, HasValue) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, HasValue) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -849,7 +849,7 @@ TEST_F(FM2JSContextEmbedderTest, HasValue) { } } -TEST_F(FM2JSContextEmbedderTest, Oneof) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Oneof) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -874,7 +874,7 @@ TEST_F(FM2JSContextEmbedderTest, Oneof) { } } -TEST_F(FM2JSContextEmbedderTest, Within) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Within) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -894,7 +894,7 @@ TEST_F(FM2JSContextEmbedderTest, Within) { } } -TEST_F(FM2JSContextEmbedderTest, DISABLED_Eval) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, DISABLED_Eval) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -912,7 +912,7 @@ TEST_F(FM2JSContextEmbedderTest, DISABLED_Eval) { } } -TEST_F(FM2JSContextEmbedderTest, DISABLED_Null) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, DISABLED_Null) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -938,7 +938,7 @@ TEST_F(FM2JSContextEmbedderTest, DISABLED_Null) { EXPECT_EQ(5, value->ToInteger()); } -TEST_F(FM2JSContextEmbedderTest, Ref) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Ref) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -957,7 +957,7 @@ TEST_F(FM2JSContextEmbedderTest, Ref) { } } -TEST_F(FM2JSContextEmbedderTest, UnitType) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, UnitType) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -981,7 +981,7 @@ TEST_F(FM2JSContextEmbedderTest, UnitType) { } } -TEST_F(FM2JSContextEmbedderTest, UnitValue) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, UnitValue) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1004,7 +1004,7 @@ TEST_F(FM2JSContextEmbedderTest, UnitValue) { } } -TEST_F(FM2JSContextEmbedderTest, At) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, At) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1024,7 +1024,7 @@ TEST_F(FM2JSContextEmbedderTest, At) { } } -TEST_F(FM2JSContextEmbedderTest, Concat) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Concat) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1047,7 +1047,7 @@ TEST_F(FM2JSContextEmbedderTest, Concat) { } } -TEST_F(FM2JSContextEmbedderTest, Decode) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Decode) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1072,7 +1072,7 @@ TEST_F(FM2JSContextEmbedderTest, Decode) { } } -TEST_F(FM2JSContextEmbedderTest, DISABLED_Encode) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, DISABLED_Encode) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1094,7 +1094,7 @@ TEST_F(FM2JSContextEmbedderTest, DISABLED_Encode) { } } -TEST_F(FM2JSContextEmbedderTest, DISABLED_Format) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, DISABLED_Format) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1114,7 +1114,7 @@ TEST_F(FM2JSContextEmbedderTest, DISABLED_Format) { } } -TEST_F(FM2JSContextEmbedderTest, Left) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Left) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1134,7 +1134,7 @@ TEST_F(FM2JSContextEmbedderTest, Left) { } } -TEST_F(FM2JSContextEmbedderTest, Len) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Len) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1153,7 +1153,7 @@ TEST_F(FM2JSContextEmbedderTest, Len) { } } -TEST_F(FM2JSContextEmbedderTest, Lower) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Lower) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1174,7 +1174,7 @@ TEST_F(FM2JSContextEmbedderTest, Lower) { } } -TEST_F(FM2JSContextEmbedderTest, Ltrim) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Ltrim) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1194,7 +1194,7 @@ TEST_F(FM2JSContextEmbedderTest, Ltrim) { } } -TEST_F(FM2JSContextEmbedderTest, DISABLED_Parse) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, DISABLED_Parse) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1218,7 +1218,7 @@ TEST_F(FM2JSContextEmbedderTest, DISABLED_Parse) { EXPECT_FLOAT_EQ(1234567.89f, value->ToFloat()); } -TEST_F(FM2JSContextEmbedderTest, Replace) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Replace) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1239,7 +1239,7 @@ TEST_F(FM2JSContextEmbedderTest, Replace) { } } -TEST_F(FM2JSContextEmbedderTest, Right) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Right) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1259,7 +1259,7 @@ TEST_F(FM2JSContextEmbedderTest, Right) { } } -TEST_F(FM2JSContextEmbedderTest, Rtrim) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Rtrim) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1279,7 +1279,7 @@ TEST_F(FM2JSContextEmbedderTest, Rtrim) { } } -TEST_F(FM2JSContextEmbedderTest, Space) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Space) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1299,7 +1299,7 @@ TEST_F(FM2JSContextEmbedderTest, Space) { } } -TEST_F(FM2JSContextEmbedderTest, Str) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Str) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1321,7 +1321,7 @@ TEST_F(FM2JSContextEmbedderTest, Str) { } } -TEST_F(FM2JSContextEmbedderTest, Stuff) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Stuff) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1343,7 +1343,7 @@ TEST_F(FM2JSContextEmbedderTest, Stuff) { } } -TEST_F(FM2JSContextEmbedderTest, Substr) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Substr) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1365,7 +1365,7 @@ TEST_F(FM2JSContextEmbedderTest, Substr) { } } -TEST_F(FM2JSContextEmbedderTest, Uuid) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Uuid) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); EXPECT_TRUE(Execute("Uuid()")); @@ -1374,7 +1374,7 @@ TEST_F(FM2JSContextEmbedderTest, Uuid) { EXPECT_TRUE(value->IsString()); } -TEST_F(FM2JSContextEmbedderTest, Upper) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Upper) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1395,7 +1395,7 @@ TEST_F(FM2JSContextEmbedderTest, Upper) { } } -TEST_F(FM2JSContextEmbedderTest, WordNum) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, WordNum) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); struct { @@ -1421,19 +1421,19 @@ TEST_F(FM2JSContextEmbedderTest, WordNum) { } } -TEST_F(FM2JSContextEmbedderTest, Get) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Get) { // TODO(dsinclair): Is this supported? } -TEST_F(FM2JSContextEmbedderTest, Post) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Post) { // TODO(dsinclair): Is this supported? } -TEST_F(FM2JSContextEmbedderTest, Put) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, Put) { // TODO(dsinclair): Is this supported? } -TEST_F(FM2JSContextEmbedderTest, InvalidFunctions) { +TEST_F(CFXJSE_FormCalcContextEmbedderTest, InvalidFunctions) { ASSERT_TRUE(OpenDocument("simple_xfa.pdf")); const char* const tests[] = { diff --git a/testing/libfuzzer/pdf_fm2js_fuzzer.cc b/testing/libfuzzer/pdf_fm2js_fuzzer.cc index c93804a92e..2541dfbcc8 100644 --- a/testing/libfuzzer/pdf_fm2js_fuzzer.cc +++ b/testing/libfuzzer/pdf_fm2js_fuzzer.cc @@ -8,7 +8,7 @@ #include "core/fxcrt/cfx_widetextbuf.h" #include "core/fxcrt/fx_safe_types.h" #include "core/fxcrt/fx_string.h" -#include "xfa/fxfa/fm2js/cxfa_fm2jscontext.h" +#include "fxjs/cfxjse_formcalc_context.h" extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { FX_SAFE_SIZE_T safe_size = size; @@ -18,6 +18,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { CFX_WideTextBuf js; WideString input = WideString::FromUTF8(ByteStringView(data, safe_size.ValueOrDie())); - CXFA_FM2JSContext::Translate(input.AsStringView(), &js); + CFXJSE_FormCalcContext::Translate(input.AsStringView(), &js); return 0; } diff --git a/testing/xfa_js_embedder_test.cpp b/testing/xfa_js_embedder_test.cpp index 3aee49c580..54ad15a892 100644 --- a/testing/xfa_js_embedder_test.cpp +++ b/testing/xfa_js_embedder_test.cpp @@ -8,9 +8,9 @@ #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" #include "fpdfsdk/fsdk_define.h" +#include "fxjs/cfxjse_engine.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/base/ptr_util.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" XFAJSEmbedderTest::XFAJSEmbedderTest() : array_buffer_allocator_(pdfium::MakeUnique<FXJS_ArrayBufferAllocator>()) { diff --git a/testing/xfa_js_embedder_test.h b/testing/xfa_js_embedder_test.h index 362db471ce..73d7d576a7 100644 --- a/testing/xfa_js_embedder_test.h +++ b/testing/xfa_js_embedder_test.h @@ -15,7 +15,7 @@ #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_object.h" -class CXFA_ScriptContext; +class CFXJSE_Engine; class XFAJSEmbedderTest : public EmbedderTest { public: @@ -41,7 +41,7 @@ class XFAJSEmbedderTest : public EmbedderTest { std::unique_ptr<FXJS_ArrayBufferAllocator> array_buffer_allocator_; std::unique_ptr<CFXJSE_Value> value_; v8::Isolate* isolate_; - CXFA_ScriptContext* script_context_; + CFXJSE_Engine* script_context_; bool ExecuteHelper(const ByteStringView& input); }; diff --git a/xfa/fxfa/cxfa_ffdochandler.cpp b/xfa/fxfa/cxfa_ffdochandler.cpp index 8dbc55050a..11e5b47e7c 100644 --- a/xfa/fxfa/cxfa_ffdochandler.cpp +++ b/xfa/fxfa/cxfa_ffdochandler.cpp @@ -7,9 +7,9 @@ #include "xfa/fxfa/cxfa_ffdochandler.h" #include "core/fxcrt/cfx_checksumcontext.h" +#include "fxjs/cfxjse_engine.h" #include "xfa/fxfa/cxfa_ffdoc.h" #include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" CXFA_FFDocHandler::CXFA_FFDocHandler() {} @@ -21,7 +21,7 @@ CFXJSE_Value* CXFA_FFDocHandler::GetXFAScriptObject(CXFA_FFDoc* hDoc) { if (!pXFADoc) return nullptr; - CXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext(); + CFXJSE_Engine* pScriptContext = pXFADoc->GetScriptContext(); if (!pScriptContext) return nullptr; return pScriptContext->GetJSValueFromMap(pXFADoc->GetRoot()); @@ -51,11 +51,11 @@ bool CXFA_FFDocHandler::RunDocScript(CXFA_FFDoc* hDoc, if (!pXFADoc) return false; - CXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext(); + CFXJSE_Engine* pScriptContext = pXFADoc->GetScriptContext(); if (!pScriptContext) return false; return pScriptContext->RunScript( (XFA_SCRIPTLANGTYPE)eScriptType, wsScript, pRetValue, - pThisValue ? CXFA_ScriptContext::ToObject(pThisValue, nullptr) : nullptr); + pThisValue ? CFXJSE_Engine::ToObject(pThisValue, nullptr) : nullptr); } diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index 0bf45e919a..603b752d25 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -7,6 +7,7 @@ #include "xfa/fxfa/cxfa_ffdocview.h" #include "core/fxcrt/fx_extension.h" +#include "fxjs/cfxjse_engine.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/cxfa_ffapp.h" @@ -30,7 +31,6 @@ #include "xfa/fxfa/cxfa_widgetacciterator.h" #include "xfa/fxfa/parser/cxfa_binditems.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R') @@ -491,7 +491,7 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( WideString wsExpression; uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; - CXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext(); + CFXJSE_Engine* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext(); if (!pScriptContext) return nullptr; @@ -716,7 +716,7 @@ void CXFA_FFDocView::RunBindItems() { continue; CXFA_BindItems binditems(item); - CXFA_ScriptContext* pScriptContext = + CFXJSE_Engine* pScriptContext = pWidgetNode->GetDocument()->GetScriptContext(); WideStringView wsRef; binditems.GetRef(wsRef); diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp index 9f1ecd51c3..78decf8f06 100644 --- a/xfa/fxfa/cxfa_textprovider.cpp +++ b/xfa/fxfa/cxfa_textprovider.cpp @@ -12,6 +12,7 @@ #include "core/fxcrt/xml/cfx_xmlelement.h" #include "core/fxcrt/xml/cfx_xmlnode.h" +#include "fxjs/cfxjse_engine.h" #include "fxjs/cfxjse_value.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" @@ -29,7 +30,6 @@ #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_localevalue.h" #include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) { diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 82eec9e16d..ddada38722 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -11,6 +11,7 @@ #include "core/fxcrt/xml/cfx_xmlelement.h" #include "core/fxcrt/xml/cfx_xmlnode.h" +#include "fxjs/cfxjse_engine.h" #include "third_party/base/stl_util.h" #include "xfa/fde/cfde_textout.h" #include "xfa/fxfa/cxfa_ffapp.h" @@ -23,7 +24,6 @@ #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_localevalue.h" #include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/xfa_utils.h" class CXFA_WidgetLayoutData { @@ -618,7 +618,7 @@ int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script, return XFA_EVENTERROR_Success; CXFA_FFDoc* pDoc = GetDoc(); - CXFA_ScriptContext* pContext = pDoc->GetXFADoc()->GetScriptContext(); + CFXJSE_Engine* pContext = pDoc->GetXFADoc()->GetScriptContext(); pContext->SetEventParam(*pEventParam); pContext->SetRunAtType((XFA_ATTRIBUTEENUM)script.GetRunAt()); std::vector<CXFA_Node*> refNodes; diff --git a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp index ecf2a98915..1f20f291e6 100644 --- a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp @@ -7,12 +7,12 @@ #include "xfa/fxfa/parser/cscript_eventpseudomodel.h" #include "fxjs/cfxjse_arguments.h" +#include "fxjs/cfxjse_engine.h" #include "xfa/fxfa/cxfa_eventparam.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/cxfa_ffwidgethandler.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/xfa_utils.h" namespace { @@ -54,7 +54,7 @@ CScript_EventPseudoModel::~CScript_EventPseudoModel() {} void CScript_EventPseudoModel::Property(CFXJSE_Value* pValue, XFA_Event dwFlag, bool bSetting) { - CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CFXJSE_Engine* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) return; @@ -198,7 +198,7 @@ void CScript_EventPseudoModel::Target(CFXJSE_Value* pValue, Property(pValue, XFA_Event::Target, bSetting); } void CScript_EventPseudoModel::Emit(CFXJSE_Arguments* pArguments) { - CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CFXJSE_Engine* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } @@ -217,7 +217,7 @@ void CScript_EventPseudoModel::Emit(CFXJSE_Arguments* pArguments) { pWidgetHandler->ProcessEvent(pEventParam->m_pTarget, pEventParam); } void CScript_EventPseudoModel::Reset(CFXJSE_Arguments* pArguments) { - CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CFXJSE_Engine* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp index f1eaff8c93..c074e0ed2e 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp @@ -9,12 +9,12 @@ #include <memory> #include "fxjs/cfxjse_arguments.h" +#include "fxjs/cfxjse_engine.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" @@ -244,7 +244,7 @@ void CScript_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) { if (pValue->IsObject()) { pNode = ToNode(pValue.get(), nullptr); } else if (pValue->IsString()) { - CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CFXJSE_Engine* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) return; @@ -364,7 +364,7 @@ void CScript_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) { int32_t iExpLength = wsExpression.GetLength(); while (iStart < iExpLength) { iStart = XFA_FilterName(wsExpression.AsStringView(), iStart, wsName); - CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CFXJSE_Engine* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) return; @@ -425,7 +425,7 @@ void CScript_HostPseudoModel::SetFocus(CFXJSE_Arguments* pArguments) { if (pValue->IsObject()) { pNode = ToNode(pValue.get(), nullptr); } else if (pValue->IsString()) { - CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CFXJSE_Engine* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) return; diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp index e35a3b8aa0..3195b8448d 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp @@ -9,6 +9,7 @@ #include <set> #include "fxjs/cfxjse_arguments.h" +#include "fxjs/cfxjse_engine.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_arraynodelist.h" @@ -20,7 +21,6 @@ #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_contentlayoutitem.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp index a1136b1ddf..ff98953590 100644 --- a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp @@ -7,10 +7,10 @@ #include "xfa/fxfa/parser/cscript_signaturepseudomodel.h" #include "fxjs/cfxjse_arguments.h" +#include "fxjs/cfxjse_engine.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/xfa_utils.h" CScript_SignaturePseudoModel::CScript_SignaturePseudoModel( diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp index cd60f47bed..3ab1a988b5 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -7,6 +7,7 @@ #include "xfa/fxfa/parser/cxfa_document.h" #include "core/fxcrt/fx_extension.h" +#include "fxjs/cfxjse_engine.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/parser/cscript_datawindow.h" #include "xfa/fxfa/parser/cscript_eventpseudomodel.h" @@ -18,7 +19,6 @@ #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" @@ -284,15 +284,15 @@ CXFA_LocaleMgr* CXFA_Document::GetLocalMgr() { return m_pLocalMgr.get(); } -CXFA_ScriptContext* CXFA_Document::InitScriptContext(v8::Isolate* pIsolate) { - CXFA_ScriptContext* result = GetScriptContext(); +CFXJSE_Engine* CXFA_Document::InitScriptContext(v8::Isolate* pIsolate) { + CFXJSE_Engine* result = GetScriptContext(); result->Initialize(pIsolate); return result; } -CXFA_ScriptContext* CXFA_Document::GetScriptContext() { +CFXJSE_Engine* CXFA_Document::GetScriptContext() { if (!m_pScriptContext) - m_pScriptContext = pdfium::MakeUnique<CXFA_ScriptContext>(this); + m_pScriptContext = pdfium::MakeUnique<CFXJSE_Engine>(this); return m_pScriptContext.get(); } diff --git a/xfa/fxfa/parser/cxfa_document.h b/xfa/fxfa/parser/cxfa_document.h index 69154b21e8..7b71f7bf56 100644 --- a/xfa/fxfa/parser/cxfa_document.h +++ b/xfa/fxfa/parser/cxfa_document.h @@ -55,14 +55,14 @@ class CXFA_LayoutProcessor; class CXFA_DocumentParser; class CXFA_ContainerLayoutItem; class CXFA_FFNotify; -class CXFA_ScriptContext; +class CFXJSE_Engine; class CXFA_Document { public: explicit CXFA_Document(CXFA_DocumentParser* pParser); ~CXFA_Document(); - CXFA_ScriptContext* InitScriptContext(v8::Isolate* pIsolate); + CFXJSE_Engine* InitScriptContext(v8::Isolate* pIsolate); CXFA_Node* GetRoot() const { return m_pRootNode; } @@ -74,7 +74,7 @@ class CXFA_Document { CXFA_Node* GetNotBindNode(const std::vector<CXFA_Object*>& arrayNodes); CXFA_LayoutProcessor* GetLayoutProcessor(); CXFA_LayoutProcessor* GetDocLayout(); - CXFA_ScriptContext* GetScriptContext(); + CFXJSE_Engine* GetScriptContext(); void SetRoot(CXFA_Node* pNewRoot); @@ -111,7 +111,7 @@ class CXFA_Document { private: CXFA_DocumentParser* m_pParser; CXFA_Node* m_pRootNode; - std::unique_ptr<CXFA_ScriptContext> m_pScriptContext; + std::unique_ptr<CFXJSE_Engine> m_pScriptContext; std::unique_ptr<CXFA_LayoutProcessor> m_pLayoutProcessor; std::unique_ptr<CXFA_LocaleMgr> m_pLocalMgr; std::unique_ptr<CScript_DataWindow> m_pScriptDataWindow; diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index a9e5449e3f..759d19de79 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/cxfa_layoutpagemgr.h" +#include "fxjs/cfxjse_engine.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_containerlayoutitem.h" @@ -17,7 +18,6 @@ #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_object.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_contentareacontainerlayoutitem.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_layoutitem.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h" diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 0a95b5f0ee..f9333187a2 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -19,6 +19,7 @@ #include "core/fxcrt/xml/cfx_xmlelement.h" #include "core/fxcrt/xml/cfx_xmlnode.h" #include "core/fxcrt/xml/cfx_xmltext.h" +#include "fxjs/cfxjse_engine.h" #include "fxjs/cfxjse_value.h" #include "third_party/base/logging.h" #include "third_party/base/ptr_util.h" @@ -32,7 +33,6 @@ #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_occur.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/cxfa_simple_parser.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h" #include "xfa/fxfa/parser/xfa_basic_data.h" @@ -970,7 +970,7 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { } WideString wsExpression = WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView()); - CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CFXJSE_Engine* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) return; CXFA_Node* refNode = this; @@ -1029,7 +1029,7 @@ void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue, WideString wsExpression, uint32_t dwFlag, CXFA_Node* refNode) { - CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CFXJSE_Engine* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) return; XFA_RESOLVENODE_RS resoveNodeRS; @@ -1073,7 +1073,7 @@ void CXFA_Node::Script_TreeClass_All(CFXJSE_Value* pValue, void CXFA_Node::Script_TreeClass_Nodes(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CFXJSE_Engine* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) return; if (bSetting) { @@ -4259,7 +4259,7 @@ bool CXFA_Node::TryContent(WideString& wsContent, } if (pNode) { if (bScriptModify) { - CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CFXJSE_Engine* pScriptContext = m_pDocument->GetScriptContext(); if (pScriptContext) { m_pDocument->GetScriptContext()->AddNodesOfRunScript(this); } @@ -4622,7 +4622,7 @@ CXFA_Node* CXFA_Node::GetNextSameClassSibling(XFA_Element eType) const { } int32_t CXFA_Node::GetNodeSameNameIndex() const { - CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CFXJSE_Engine* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return -1; } @@ -4630,7 +4630,7 @@ int32_t CXFA_Node::GetNodeSameNameIndex() const { } int32_t CXFA_Node::GetNodeSameClassIndex() const { - CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CFXJSE_Engine* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return -1; } @@ -4638,7 +4638,7 @@ int32_t CXFA_Node::GetNodeSameClassIndex() const { } void CXFA_Node::GetSOMExpression(WideString& wsSOMExpression) { - CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); + CFXJSE_Engine* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp index bc91c66f77..289149998e 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.cpp +++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp @@ -7,10 +7,10 @@ #include "xfa/fxfa/parser/cxfa_nodehelper.h" #include "core/fxcrt/fx_extension.h" +#include "fxjs/cfxjse_engine.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" @@ -313,11 +313,10 @@ bool CXFA_NodeHelper::CreateNode_ForCondition(WideString& wsCondition) { return false; } -bool CXFA_NodeHelper::ResolveNodes_CreateNode( - WideString wsName, - WideString wsCondition, - bool bLastNode, - CXFA_ScriptContext* pScriptContext) { +bool CXFA_NodeHelper::ResolveNodes_CreateNode(WideString wsName, + WideString wsCondition, + bool bLastNode, + CFXJSE_Engine* pScriptContext) { if (!m_pCreateParent) { return false; } diff --git a/xfa/fxfa/parser/cxfa_nodehelper.h b/xfa/fxfa/parser/cxfa_nodehelper.h index 4c7d7ae10c..6c63a7b4ae 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.h +++ b/xfa/fxfa/parser/cxfa_nodehelper.h @@ -11,7 +11,7 @@ #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" -class CXFA_ScriptContext; +class CFXJSE_Engine; enum XFA_LOGIC_TYPE { XFA_LOGIC_NoTransparent, @@ -56,7 +56,7 @@ class CXFA_NodeHelper { bool ResolveNodes_CreateNode(WideString wsName, WideString wsCondition, bool bLastNode, - CXFA_ScriptContext* pScriptContext); + CFXJSE_Engine* pScriptContext); bool CreateNode_ForCondition(WideString& wsCondition); void SetCreateNodeType(CXFA_Node* refNode); bool NodeIsProperty(CXFA_Node* refNode); diff --git a/xfa/fxfa/parser/cxfa_nodelist.cpp b/xfa/fxfa/parser/cxfa_nodelist.cpp index cea1f127a6..cbee420870 100644 --- a/xfa/fxfa/parser/cxfa_nodelist.cpp +++ b/xfa/fxfa/parser/cxfa_nodelist.cpp @@ -9,9 +9,9 @@ #include <memory> #include "core/fxcrt/fx_extension.h" +#include "fxjs/cfxjse_engine.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) : CXFA_Object(pDocument, diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp index 4d0ec516b2..a72ad7b3f6 100644 --- a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp @@ -11,6 +11,7 @@ #include <vector> #include "core/fxcrt/fx_extension.h" +#include "fxjs/cfxjse_engine.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/parser/cxfa_document.h" @@ -18,7 +19,6 @@ #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_nodehelper.h" #include "xfa/fxfa/parser/cxfa_object.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" @@ -669,7 +669,7 @@ void CXFA_ResolveProcessor::DoPredicateFilter(int32_t iCurIndex, return; } - CXFA_ScriptContext* pContext = rnd.m_pSC; + CFXJSE_Engine* pContext = rnd.m_pSC; wsExpression = wsCondition.Mid(2, wsCondition.GetLength() - 3); for (int32_t i = iFoundCount - 1; i >= 0; i--) { auto pRetValue = pdfium::MakeUnique<CFXJSE_Value>(rnd.m_pSC->GetRuntime()); @@ -781,7 +781,7 @@ void CXFA_ResolveProcessor::SetIndexDataBind(WideString& wsNextCondition, } } -CXFA_ResolveNodesData::CXFA_ResolveNodesData(CXFA_ScriptContext* pSC) +CXFA_ResolveNodesData::CXFA_ResolveNodesData(CFXJSE_Engine* pSC) : m_pSC(pSC), m_CurObject(nullptr), m_wsName(), diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.h b/xfa/fxfa/parser/cxfa_resolveprocessor.h index b48ee36476..c12dfdc80d 100644 --- a/xfa/fxfa/parser/cxfa_resolveprocessor.h +++ b/xfa/fxfa/parser/cxfa_resolveprocessor.h @@ -13,14 +13,14 @@ #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" class CXFA_NodeHelper; -class CXFA_ScriptContext; +class CFXJSE_Engine; class CXFA_ResolveNodesData { public: - explicit CXFA_ResolveNodesData(CXFA_ScriptContext* pSC = nullptr); + explicit CXFA_ResolveNodesData(CFXJSE_Engine* pSC = nullptr); ~CXFA_ResolveNodesData(); - CXFA_ScriptContext* m_pSC; + CFXJSE_Engine* m_pSC; CXFA_Object* m_CurObject; WideString m_wsName; XFA_HashCode m_uHashName; diff --git a/xfa/fxfa/parser/cxfa_valuearray.cpp b/xfa/fxfa/parser/cxfa_valuearray.cpp index eded624c36..83ffe6b275 100644 --- a/xfa/fxfa/parser/cxfa_valuearray.cpp +++ b/xfa/fxfa/parser/cxfa_valuearray.cpp @@ -8,7 +8,7 @@ #include <algorithm> -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" +#include "fxjs/cfxjse_engine.h" CXFA_ValueArray::CXFA_ValueArray(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} @@ -19,7 +19,7 @@ std::vector<CXFA_Object*> CXFA_ValueArray::GetAttributeObject() { std::vector<CXFA_Object*> result(m_Values.size()); std::transform(m_Values.begin(), m_Values.end(), result.begin(), [](const std::unique_ptr<CFXJSE_Value>& value) { - return CXFA_ScriptContext::ToObject(value.get(), nullptr); + return CFXJSE_Engine::ToObject(value.get(), nullptr); }); return result; } diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 373412ebf9..12a1ba77c4 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -12,6 +12,7 @@ #include "core/fxcrt/fx_extension.h" #include "core/fxcrt/xml/cfx_xmlelement.h" #include "core/fxcrt/xml/cfx_xmlnode.h" +#include "fxjs/cfxjse_engine.h" #include "third_party/base/logging.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/parser/cxfa_document.h" @@ -19,7 +20,6 @@ #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_occur.h" -#include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h" #include "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" |