7#ifndef FXJS_XFA_CFXJSE_ENGINE_H_
8#define FXJS_XFA_CFXJSE_ENGINE_H_
15#include "core/fxcrt/mask.h"
16#include "core/fxcrt/unowned_ptr.h"
17#include "fxjs/cfx_v8.h"
18#include "fxjs/xfa/cfxjse_context.h"
19#include "v8/include/cppgc/persistent.h"
20#include "v8/include/v8-forward.h"
21#include "v8/include/v8-persistent-handle.h"
22#include "xfa/fxfa/cxfa_eventparam.h"
23#include "xfa/fxfa/parser/cxfa_document.h"
24#include "xfa/fxfa/parser/cxfa_script.h"
25#include "xfa/fxfa/parser/xfa_basic_data.h"
28class CFXJSE_FormCalcContext;
52 CPPGC_STACK_ALLOCATED();
79 v8::Local<v8::Value> value);
83 v8::Isolate* pIsolate,
84 v8::Local<v8::Object> pObject,
85 ByteStringView szPropName);
87 v8::Local<v8::Object> pObject,
88 ByteStringView szPropName,
89 v8::Local<v8::Value> pValue);
91 v8::Isolate* pIsolate,
92 v8::Local<v8::Object> pObject,
93 ByteStringView szPropName);
95 v8::Local<v8::Object> pObject,
96 ByteStringView szPropName,
97 v8::Local<v8::Value> pValue);
99 const v8::FunctionCallbackInfo<v8::Value>& info,
100 const WideString& functionName);
102 v8::Local<v8::Object> pObject,
103 ByteStringView szPropName,
106 v8::Local<v8::Object> pObject,
107 ByteStringView szPropName,
110 CFXJSE_Engine(CXFA_Document* pDocument, CJS_Runtime* fxjs_runtime);
114 CPPGC_STACK_ALLOCATED();
133 WideStringView wsScript,
137 WideStringView wsExpression,
142 WideStringView wsExpression,
171 CFXJSE_Context* GetJseContext()
const {
return m_JsContext.get(); }
176 WideStringView propname,
177 v8::Local<v8::Value>* pValue,
179 bool UpdateNodeByFlag(
CXFA_Node* refNode,
180 WideStringView propname,
181 v8::Local<v8::Value> pValue,
183 bool IsStrictScopeInJavaScript();
186 CFXJSE_Context* VariablesContextForScriptNode(CXFA_Script* pScriptNode);
187 bool QueryVariableValue(CXFA_Script* pScriptNode,
188 ByteStringView szPropName,
189 v8::Local<v8::Value>* pValue);
190 bool UpdateVariableValue(CXFA_Script* pScriptNode,
191 ByteStringView szPropName,
192 v8::Local<v8::Value> pValue);
193 void RunVariablesScript(CXFA_Script* pScriptNode);
195 UnownedPtr<CJS_Runtime>
const m_pSubordinateRuntime;
196 cppgc::WeakPersistent<CXFA_Document>
const m_pDocument;
197 std::unique_ptr<CFXJSE_Context> m_JsContext;
206 cppgc::Persistent<CXFA_Node> m_pTarget;
210 std::unique_ptr<CFXJSE_NodeHelper>
const m_NodeHelper;
211 std::unique_ptr<CFXJSE_ResolveProcessor>
const m_ResolveProcessor;
212 std::unique_ptr<CFXJSE_FormCalcContext> m_FormCalcContext;
213 cppgc::Persistent<CXFA_Object> m_pThisObject;
215 bool m_bResolvingNodes =
false;
const FXJSE_CLASS_DESCRIPTOR kNormalClassDescriptor
const FXJSE_CLASS_DESCRIPTOR kGlobalClassDescriptor
const FXJSE_CLASS_DESCRIPTOR kVariablesClassDescriptor
EventParamScope(CFXJSE_Engine *pEngine, CXFA_Node *pTarget, CXFA_EventParam *pEventParam)
ResolveResult & operator=(const ResolveResult &that)
XFA_SCRIPTATTRIBUTEINFO script_attribute
ResolveResult(const ResolveResult &that)
void SetRunAtType(XFA_AttributeValue eRunAt)
static CJS_Result NormalMethodCall(const v8::FunctionCallbackInfo< v8::Value > &info, const WideString &functionName)
bool IsResolvingNodes() const
CXFA_Object * ToXFAObject(v8::Local< v8::Value > obj)
CXFA_Node * GetEventTarget() const
static v8::Local< v8::Value > NormalPropertyGetter(v8::Isolate *pIsolate, v8::Local< v8::Object > pObject, ByteStringView szPropName)
static void GlobalPropertySetter(v8::Isolate *pIsolate, v8::Local< v8::Object > pObject, ByteStringView szPropName, v8::Local< v8::Value > pValue)
CFXJSE_Engine(CXFA_Document *pDocument, CJS_Runtime *fxjs_runtime)
static FXJSE_ClassPropType GlobalPropTypeGetter(v8::Isolate *pIsolate, v8::Local< v8::Object > pObject, ByteStringView szPropName, bool bQueryIn)
CXFA_EventParam * GetEventParam() const
static CXFA_Object * ToObject(const v8::FunctionCallbackInfo< v8::Value > &info)
CXFA_Object * GetThisObject() const
CXFA_Script::Type GetType()
CFXJSE_Class * GetJseNormalClass() const
void AddNodesOfRunScript(CXFA_Node *pNode)
void SetNodesOfRunScript(std::vector< cppgc::Persistent< CXFA_Node > > *pArray)
static v8::Local< v8::Value > GlobalPropertyGetter(v8::Isolate *pIsolate, v8::Local< v8::Object > pObject, ByteStringView szPropName)
friend class EventParamScope
static FXJSE_ClassPropType NormalPropTypeGetter(v8::Isolate *pIsolate, v8::Local< v8::Object > pObject, ByteStringView szPropName, bool bQueryIn)
static CXFA_Object * ToObject(v8::Isolate *pIsolate, CFXJSE_Value *pValue)
absl::optional< ResolveResult > ResolveObjectsWithBindNode(CXFA_Object *refObject, WideStringView wsExpression, Mask< XFA_ResolveFlag > dwStyles, CXFA_Node *bindNode)
CFXJSE_Context * GetJseContextForTest() const
v8::Local< v8::Object > NewNormalXFAObject(CXFA_Object *obj)
CFXJSE_Context::ExecutionResult RunScript(CXFA_Script::Type eScriptType, WideStringView wsScript, CXFA_Object *pThisObject)
static void NormalPropertySetter(v8::Isolate *pIsolate, v8::Local< v8::Object > pObject, ByteStringView szPropName, v8::Local< v8::Value > pValue)
CXFA_Node * LastObjectFromUpArray()
~CFXJSE_Engine() override
absl::optional< ResolveResult > ResolveObjects(CXFA_Object *refObject, WideStringView wsExpression, Mask< XFA_ResolveFlag > dwStyles)
static CXFA_Object * ToObject(v8::Isolate *pIsolate, v8::Local< v8::Value > value)
static CXFA_Object * ToObject(CFXJSE_HostObject *pHostObj)
CXFA_Document * GetDocument() const
void AddObjectToUpArray(CXFA_Node *pNode)
v8::Local< v8::Object > GetOrCreateJSBindingFromMap(CXFA_Object *pObject)
virtual CJX_Object * AsCJXObject()
CFXJSE_Engine::ResolveResult m_Result
CFXJSE_ScopeUtil_IsolateHandleContext(CFXJSE_Context *pContext)
static CJS_Result Failure(const WideString &str)
bool HasMethod(const WideString &func) const
CXFA_Object * GetXFAObject() const
CXFA_FFNotify * GetNotify() const
CFXJSE_Engine * GetScriptContext() const
CXFA_Object * GetXFAObject(XFA_HashCode wsNodeNameHash)
CXFA_Node * GetRoot() const
IJS_Runtime * GetIJSRuntime() const
CXFA_FFDoc * GetFFDoc() const
XFA_Element GetElementType() const
CXFA_Document * GetDocument() const
static CXFA_Script * FromNode(CXFA_Node *pNode)
CXFA_Script * GetScriptNode() const
CXFA_Node * GetThisNode() const
static CXFA_Variables * FromNode(CXFA_Node *pNode)
static WideString FromUTF8(ByteStringView str)
bool EqualsASCII(ByteStringView that) const
CXFA_ThisProxy * ToThisProxy(CXFA_Object *pObj)
CXFA_Node * ToNode(CXFA_Object *pObj)
bool IsUndefined(v8::Local< v8::Value > value)
XFA_ATTRIBUTE_CALLBACK callback