diff options
Diffstat (limited to 'fxjs/xfa')
27 files changed, 487 insertions, 487 deletions
diff --git a/fxjs/xfa/cjx_container.cpp b/fxjs/xfa/cjx_container.cpp index ddf5ba12ef..6b0d488a4f 100644 --- a/fxjs/xfa/cjx_container.cpp +++ b/fxjs/xfa/cjx_container.cpp @@ -24,17 +24,17 @@ CJX_Container::CJX_Container(CXFA_Node* node) : CJX_Node(node) { CJX_Container::~CJX_Container() {} -CJS_Return CJX_Container::getDelta( +CJS_Result CJX_Container::getDelta( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Container::getDeltas( +CJS_Result CJX_Container::getDeltas( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { auto* pEngine = static_cast<CFXJSE_Engine*>(runtime); - return CJS_Return::Success(pEngine->NewXFAObject( + return CJS_Result::Success(pEngine->NewXFAObject( new CXFA_ArrayNodeList(GetDocument()), GetDocument()->GetScriptContext()->GetJseNormalClass()->GetTemplate())); } diff --git a/fxjs/xfa/cjx_datawindow.cpp b/fxjs/xfa/cjx_datawindow.cpp index b03e24161d..dbd672a702 100644 --- a/fxjs/xfa/cjx_datawindow.cpp +++ b/fxjs/xfa/cjx_datawindow.cpp @@ -24,28 +24,28 @@ CJX_DataWindow::CJX_DataWindow(CScript_DataWindow* window) CJX_DataWindow::~CJX_DataWindow() {} -CJS_Return CJX_DataWindow::moveCurrentRecord( +CJS_Result CJX_DataWindow::moveCurrentRecord( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_DataWindow::record( +CJS_Result CJX_DataWindow::record( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_DataWindow::gotoRecord( +CJS_Result CJX_DataWindow::gotoRecord( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_DataWindow::isRecordGroup( +CJS_Result CJX_DataWindow::isRecordGroup( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return::Success(); + return CJS_Result::Success(); } void CJX_DataWindow::recordsBefore(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_delta.cpp b/fxjs/xfa/cjx_delta.cpp index 791fd213df..edf17b9469 100644 --- a/fxjs/xfa/cjx_delta.cpp +++ b/fxjs/xfa/cjx_delta.cpp @@ -20,12 +20,12 @@ CJX_Delta::CJX_Delta(CXFA_Delta* delta) : CJX_Object(delta) { CJX_Delta::~CJX_Delta() {} -CJS_Return CJX_Delta::restore(CFX_V8* runtime, +CJS_Result CJX_Delta::restore(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } void CJX_Delta::currentValue(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_desc.cpp b/fxjs/xfa/cjx_desc.cpp index 03379cedbc..004fa447b1 100644 --- a/fxjs/xfa/cjx_desc.cpp +++ b/fxjs/xfa/cjx_desc.cpp @@ -20,12 +20,12 @@ CJX_Desc::CJX_Desc(CXFA_Desc* desc) : CJX_Node(desc) { CJX_Desc::~CJX_Desc() {} -CJS_Return CJX_Desc::metadata(CFX_V8* runtime, +CJS_Result CJX_Desc::metadata(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 0 && params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(runtime->NewString("")); + return CJS_Result::Success(runtime->NewString("")); } void CJX_Desc::use(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_eventpseudomodel.cpp b/fxjs/xfa/cjx_eventpseudomodel.cpp index 3adf1e39a8..b80f8f3754 100644 --- a/fxjs/xfa/cjx_eventpseudomodel.cpp +++ b/fxjs/xfa/cjx_eventpseudomodel.cpp @@ -169,41 +169,41 @@ void CJX_EventPseudoModel::target(CFXJSE_Value* pValue, Property(pValue, XFA_Event::Target, bSetting); } -CJS_Return CJX_EventPseudoModel::emit( +CJS_Result CJX_EventPseudoModel::emit( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); if (!pScriptContext) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); if (!pEventParam) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_FFWidgetHandler* pWidgetHandler = pNotify->GetWidgetHandler(); if (!pWidgetHandler) - return CJS_Return::Success(); + return CJS_Result::Success(); pWidgetHandler->ProcessEvent(pEventParam->m_pTarget.Get(), pEventParam); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_EventPseudoModel::reset( +CJS_Result CJX_EventPseudoModel::reset( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); if (!pScriptContext) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); if (pEventParam) pEventParam->Reset(); - return CJS_Return::Success(); + return CJS_Result::Success(); } void CJX_EventPseudoModel::Property(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_exclgroup.cpp b/fxjs/xfa/cjx_exclgroup.cpp index 3a7f9dd2fb..a5ddc940f1 100644 --- a/fxjs/xfa/cjx_exclgroup.cpp +++ b/fxjs/xfa/cjx_exclgroup.cpp @@ -30,67 +30,67 @@ CJX_ExclGroup::CJX_ExclGroup(CXFA_ExclGroup* group) : CJX_Node(group) { CJX_ExclGroup::~CJX_ExclGroup() {} -CJS_Return CJX_ExclGroup::execEvent( +CJS_Result CJX_ExclGroup::execEvent( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); execSingleEventByName(runtime->ToWideString(params[0]).AsStringView(), XFA_Element::ExclGroup); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_ExclGroup::execInitialize( +CJS_Result CJX_ExclGroup::execInitialize( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (pNotify) pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize, false, true); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_ExclGroup::execCalculate( +CJS_Result CJX_ExclGroup::execCalculate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (pNotify) pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false, true); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_ExclGroup::execValidate( +CJS_Result CJX_ExclGroup::execValidate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* notify = GetDocument()->GetNotify(); if (!notify) - return CJS_Return::Success(runtime->NewBoolean(false)); + return CJS_Result::Success(runtime->NewBoolean(false)); int32_t iRet = notify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Validate, false, true); - return CJS_Return::Success(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error)); + return CJS_Result::Success(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error)); } -CJS_Return CJX_ExclGroup::selectedMember( +CJS_Result CJX_ExclGroup::selectedMember( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_Node* node = GetXFANode(); if (!node->IsWidgetReady()) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); CXFA_Node* pReturnNode = nullptr; if (params.empty()) { @@ -100,14 +100,14 @@ CJS_Return CJX_ExclGroup::selectedMember( runtime->ToWideString(params[0]).AsStringView(), true); } if (!pReturnNode) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); CFXJSE_Value* value = GetDocument()->GetScriptContext()->GetJSValueFromMap(pReturnNode); if (!value) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); - return CJS_Return::Success( + return CJS_Result::Success( value->DirectGetValue().Get(runtime->GetIsolate())); } diff --git a/fxjs/xfa/cjx_field.cpp b/fxjs/xfa/cjx_field.cpp index c1210b9808..bb84588ece 100644 --- a/fxjs/xfa/cjx_field.cpp +++ b/fxjs/xfa/cjx_field.cpp @@ -38,175 +38,175 @@ CJX_Field::CJX_Field(CXFA_Field* field) : CJX_Container(field) { CJX_Field::~CJX_Field() {} -CJS_Return CJX_Field::clearItems( +CJS_Result CJX_Field::clearItems( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { CXFA_Node* node = GetXFANode(); if (node->IsWidgetReady()) node->DeleteItem(-1, true, false); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Field::execEvent( +CJS_Result CJX_Field::execEvent( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); WideString eventString = runtime->ToWideString(params[0]); int32_t iRet = execSingleEventByName(eventString.AsStringView(), XFA_Element::Field); if (eventString != L"validate") - return CJS_Return::Success(); + return CJS_Result::Success(); - return CJS_Return::Success(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error)); + return CJS_Result::Success(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error)); } -CJS_Return CJX_Field::execInitialize( +CJS_Result CJX_Field::execInitialize( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (pNotify) { pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize, false, false); } - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Field::deleteItem( +CJS_Result CJX_Field::deleteItem( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_Node* node = GetXFANode(); if (!node->IsWidgetReady()) - return CJS_Return::Success(); + return CJS_Result::Success(); bool bValue = node->DeleteItem(runtime->ToInt32(params[0]), true, true); - return CJS_Return::Success(runtime->NewBoolean(bValue)); + return CJS_Result::Success(runtime->NewBoolean(bValue)); } -CJS_Return CJX_Field::getSaveItem( +CJS_Result CJX_Field::getSaveItem( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); int32_t iIndex = runtime->ToInt32(params[0]); if (iIndex < 0) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); CXFA_Node* node = GetXFANode(); if (!node->IsWidgetReady()) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); Optional<WideString> value = node->GetChoiceListItem(iIndex, true); if (!value) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); - return CJS_Return::Success( + return CJS_Result::Success( runtime->NewString(value->UTF8Encode().AsStringView())); } -CJS_Return CJX_Field::boundItem( +CJS_Result CJX_Field::boundItem( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_Node* node = GetXFANode(); if (!node->IsWidgetReady()) - return CJS_Return::Success(); + return CJS_Result::Success(); WideString value = runtime->ToWideString(params[0]); WideString boundValue = node->GetItemValue(value.AsStringView()); - return CJS_Return::Success( + return CJS_Result::Success( runtime->NewString(boundValue.UTF8Encode().AsStringView())); } -CJS_Return CJX_Field::getItemState( +CJS_Result CJX_Field::getItemState( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_Node* node = GetXFANode(); if (!node->IsWidgetReady()) - return CJS_Return::Success(); + return CJS_Result::Success(); int32_t state = node->GetItemState(runtime->ToInt32(params[0])); - return CJS_Return::Success(runtime->NewBoolean(state != 0)); + return CJS_Result::Success(runtime->NewBoolean(state != 0)); } -CJS_Return CJX_Field::execCalculate( +CJS_Result CJX_Field::execCalculate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (pNotify) { pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false, false); } - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Field::getDisplayItem( +CJS_Result CJX_Field::getDisplayItem( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); int32_t iIndex = runtime->ToInt32(params[0]); if (iIndex < 0) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); CXFA_Node* node = GetXFANode(); if (!node->IsWidgetReady()) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); Optional<WideString> value = node->GetChoiceListItem(iIndex, false); if (!value) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); - return CJS_Return::Success( + return CJS_Result::Success( runtime->NewString(value->UTF8Encode().AsStringView())); } -CJS_Return CJX_Field::setItemState( +CJS_Result CJX_Field::setItemState( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 2) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_Node* node = GetXFANode(); if (!node->IsWidgetReady()) - return CJS_Return::Success(); + return CJS_Result::Success(); int32_t iIndex = runtime->ToInt32(params[0]); if (runtime->ToInt32(params[1]) != 0) { node->SetItemState(iIndex, true, true, true, true); - return CJS_Return::Success(); + return CJS_Result::Success(); } if (node->GetItemState(iIndex)) node->SetItemState(iIndex, false, true, true, true); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Field::addItem(CFX_V8* runtime, +CJS_Result CJX_Field::addItem(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1 && params.size() != 2) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_Node* node = GetXFANode(); if (!node->IsWidgetReady()) - return CJS_Return::Success(); + return CJS_Result::Success(); WideString label; if (params.size() >= 1) @@ -217,22 +217,22 @@ CJS_Return CJX_Field::addItem(CFX_V8* runtime, value = runtime->ToWideString(params[1]); node->InsertItem(label, value, true); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Field::execValidate( +CJS_Result CJX_Field::execValidate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(runtime->NewBoolean(false)); + return CJS_Result::Success(runtime->NewBoolean(false)); int32_t iRet = pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Validate, false, false); - return CJS_Return::Success(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error)); + return CJS_Result::Success(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error)); } void CJX_Field::defaultValue(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_form.cpp b/fxjs/xfa/cjx_form.cpp index 3bbdb72bfb..a59edd01ef 100644 --- a/fxjs/xfa/cjx_form.cpp +++ b/fxjs/xfa/cjx_form.cpp @@ -31,16 +31,16 @@ CJX_Form::CJX_Form(CXFA_Form* form) : CJX_Model(form) { CJX_Form::~CJX_Form() {} -CJS_Return CJX_Form::formNodes( +CJS_Result CJX_Form::formNodes( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_Node* pDataNode = ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[0])); if (!pDataNode) - return CJS_Return::Failure(JSMessage::kValueError); + return CJS_Result::Failure(JSMessage::kValueError); std::vector<CXFA_Node*> formItems; CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(GetDocument()); @@ -49,79 +49,79 @@ CJS_Return CJX_Form::formNodes( CFXJSE_Value* value = GetDocument()->GetScriptContext()->GetJSValueFromMap(pFormNodes); if (!value) - return CJS_Return::Success(runtime->NewNull()); - return CJS_Return::Success( + return CJS_Result::Success(runtime->NewNull()); + return CJS_Result::Success( value->DirectGetValue().Get(runtime->GetIsolate())); } -CJS_Return CJX_Form::remerge(CFX_V8* runtime, +CJS_Result CJX_Form::remerge(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); GetDocument()->DoDataRemerge(true); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Form::execInitialize( +CJS_Result CJX_Form::execInitialize( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (pNotify) pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize, false, true); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Form::recalculate( +CJS_Result CJX_Form::recalculate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { CXFA_EventParam* pEventParam = GetDocument()->GetScriptContext()->GetEventParam(); if (pEventParam->m_eType == XFA_EVENT_Calculate || pEventParam->m_eType == XFA_EVENT_InitCalculate) { - return CJS_Return::Success(); + return CJS_Result::Success(); } if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify || runtime->ToInt32(params[0]) != 0) - return CJS_Return::Success(); + return CJS_Result::Success(); pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false, true); pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Validate, false, true); pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Ready, true, true); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Form::execCalculate( +CJS_Result CJX_Form::execCalculate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (pNotify) pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false, true); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Form::execValidate( +CJS_Result CJX_Form::execValidate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 0) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(runtime->NewBoolean(false)); + return CJS_Result::Success(runtime->NewBoolean(false)); int32_t iRet = pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Validate, false, true); - return CJS_Return::Success(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error)); + return CJS_Result::Success(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error)); } diff --git a/fxjs/xfa/cjx_hostpseudomodel.cpp b/fxjs/xfa/cjx_hostpseudomodel.cpp index 8cf82b30d4..748641ab8a 100644 --- a/fxjs/xfa/cjx_hostpseudomodel.cpp +++ b/fxjs/xfa/cjx_hostpseudomodel.cpp @@ -239,37 +239,37 @@ void CJX_HostPseudoModel::name(CFXJSE_Value* pValue, pNotify->GetAppProvider()->GetAppName().UTF8Encode().AsStringView()); } -CJS_Return CJX_HostPseudoModel::gotoURL( +CJS_Result CJX_HostPseudoModel::gotoURL( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) - return CJS_Return::Success(); + return CJS_Result::Success(); if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_FFDoc* hDoc = pNotify->GetHDOC(); WideString URL = runtime->ToWideString(params[0]); hDoc->GetDocEnvironment()->GotoURL(hDoc, URL); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_HostPseudoModel::openList( +CJS_Result CJX_HostPseudoModel::openList( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) - return CJS_Return::Success(); + return CJS_Result::Success(); if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_Node* pNode = nullptr; if (params[0]->IsObject()) { @@ -278,11 +278,11 @@ CJS_Return CJX_HostPseudoModel::openList( } else if (params[0]->IsString()) { CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); if (!pScriptContext) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_Object* pObject = pScriptContext->GetThisObject(); if (!pObject) - return CJS_Return::Success(); + return CJS_Result::Success(); uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; @@ -291,35 +291,35 @@ CJS_Return CJX_HostPseudoModel::openList( pObject, runtime->ToWideString(params[0]).AsStringView(), &resolveNodeRS, dwFlag, nullptr); if (!iRet || !resolveNodeRS.objects.front()->IsNode()) - return CJS_Return::Success(); + return CJS_Result::Success(); pNode = resolveNodeRS.objects.front()->AsNode(); } CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor(); if (!pDocLayout) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_FFWidget* hWidget = XFA_GetWidgetFromLayoutItem(pDocLayout->GetLayoutItem(pNode)); if (!hWidget) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_FFDoc* hDoc = pNotify->GetHDOC(); hDoc->GetDocEnvironment()->SetFocusWidget(hDoc, hWidget); pNotify->OpenDropDownList(hWidget); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_HostPseudoModel::response( +CJS_Result CJX_HostPseudoModel::response( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.empty() || params.size() > 4) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(); + return CJS_Result::Success(); WideString question; if (params.size() >= 1) @@ -339,25 +339,25 @@ CJS_Return CJX_HostPseudoModel::response( WideString answer = pNotify->GetAppProvider()->Response(question, title, defaultAnswer, mark); - return CJS_Return::Success( + return CJS_Result::Success( runtime->NewString(answer.UTF8Encode().AsStringView())); } -CJS_Return CJX_HostPseudoModel::documentInBatch( +CJS_Result CJX_HostPseudoModel::documentInBatch( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return::Success(runtime->NewNumber(0)); + return CJS_Result::Success(runtime->NewNumber(0)); } -CJS_Return CJX_HostPseudoModel::resetData( +CJS_Result CJX_HostPseudoModel::resetData( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() > 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(); + return CJS_Result::Success(); WideString expression; if (params.size() >= 1) @@ -365,7 +365,7 @@ CJS_Return CJX_HostPseudoModel::resetData( if (expression.IsEmpty()) { pNotify->ResetData(nullptr); - return CJS_Return::Success(); + return CJS_Result::Success(); } int32_t iStart = 0; @@ -376,11 +376,11 @@ CJS_Return CJX_HostPseudoModel::resetData( iStart = FilterName(expression.AsStringView(), iStart, wsName); CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); if (!pScriptContext) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_Object* pObject = pScriptContext->GetThisObject(); if (!pObject) - return CJS_Return::Success(); + return CJS_Result::Success(); uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; @@ -396,42 +396,42 @@ CJS_Return CJX_HostPseudoModel::resetData( if (!pNode) pNotify->ResetData(nullptr); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_HostPseudoModel::beep( +CJS_Result CJX_HostPseudoModel::beep( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) - return CJS_Return::Success(); + return CJS_Result::Success(); if (params.size() > 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(); + return CJS_Result::Success(); uint32_t dwType = 4; if (params.size() >= 1) dwType = runtime->ToInt32(params[0]); pNotify->GetAppProvider()->Beep(dwType); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_HostPseudoModel::setFocus( +CJS_Result CJX_HostPseudoModel::setFocus( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) - return CJS_Return::Success(); + return CJS_Result::Success(); if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_Node* pNode = nullptr; if (params.size() >= 1) { @@ -441,11 +441,11 @@ CJS_Return CJX_HostPseudoModel::setFocus( } else if (params[0]->IsString()) { CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); if (!pScriptContext) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_Object* pObject = pScriptContext->GetThisObject(); if (!pObject) - return CJS_Return::Success(); + return CJS_Result::Success(); uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; @@ -454,47 +454,47 @@ CJS_Return CJX_HostPseudoModel::setFocus( pObject, runtime->ToWideString(params[0]).AsStringView(), &resolveNodeRS, dwFlag, nullptr); if (!iRet || !resolveNodeRS.objects.front()->IsNode()) - return CJS_Return::Success(); + return CJS_Result::Success(); pNode = resolveNodeRS.objects.front()->AsNode(); } } pNotify->SetFocusWidgetNode(pNode); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_HostPseudoModel::getFocus( +CJS_Result CJX_HostPseudoModel::getFocus( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_Node* pNode = pNotify->GetFocusWidgetNode(); if (!pNode) - return CJS_Return::Success(); + return CJS_Result::Success(); CFXJSE_Value* value = GetDocument()->GetScriptContext()->GetJSValueFromMap(pNode); if (!value) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); - return CJS_Return::Success( + return CJS_Result::Success( value->DirectGetValue().Get(runtime->GetIsolate())); } -CJS_Return CJX_HostPseudoModel::messageBox( +CJS_Result CJX_HostPseudoModel::messageBox( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) - return CJS_Return::Success(); + return CJS_Result::Success(); if (params.empty() || params.size() > 4) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(); + return CJS_Result::Success(); WideString message; if (params.size() >= 1) @@ -520,27 +520,27 @@ CJS_Return CJX_HostPseudoModel::messageBox( int32_t iValue = pNotify->GetAppProvider()->MsgBox(message, title, messageType, buttonType); - return CJS_Return::Success(runtime->NewNumber(iValue)); + return CJS_Result::Success(runtime->NewNumber(iValue)); } -CJS_Return CJX_HostPseudoModel::documentCountInBatch( +CJS_Result CJX_HostPseudoModel::documentCountInBatch( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return::Success(runtime->NewNumber(0)); + return CJS_Result::Success(runtime->NewNumber(0)); } -CJS_Return CJX_HostPseudoModel::print( +CJS_Result CJX_HostPseudoModel::print( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) - return CJS_Return::Success(); + return CJS_Result::Success(); if (params.size() != 8) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(); + return CJS_Result::Success(); uint32_t dwOptions = 0; if (runtime->ToBoolean(params[0])) @@ -561,27 +561,27 @@ CJS_Return CJX_HostPseudoModel::print( CXFA_FFDoc* hDoc = pNotify->GetHDOC(); hDoc->GetDocEnvironment()->Print(hDoc, nStartPage, nEndPage, dwOptions); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_HostPseudoModel::importData( +CJS_Result CJX_HostPseudoModel::importData( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.empty() || params.size() > 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_HostPseudoModel::exportData( +CJS_Result CJX_HostPseudoModel::exportData( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.empty() || params.size() > 2) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(); + return CJS_Result::Success(); WideString filePath; if (params.size() >= 1) @@ -593,39 +593,39 @@ CJS_Return CJX_HostPseudoModel::exportData( CXFA_FFDoc* hDoc = pNotify->GetHDOC(); hDoc->GetDocEnvironment()->ExportData(hDoc, filePath, XDP); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_HostPseudoModel::pageUp( +CJS_Result CJX_HostPseudoModel::pageUp( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t nCurPage = hDoc->GetDocEnvironment()->GetCurrentPage(hDoc); int32_t nNewPage = 0; if (nCurPage <= 1) - return CJS_Return::Success(); + return CJS_Result::Success(); nNewPage = nCurPage - 1; hDoc->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_HostPseudoModel::pageDown( +CJS_Result CJX_HostPseudoModel::pageDown( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t nCurPage = hDoc->GetDocEnvironment()->GetCurrentPage(hDoc); int32_t nPageCount = hDoc->GetDocEnvironment()->CountPages(hDoc); if (!nPageCount || nCurPage == nPageCount) - return CJS_Return::Success(); + return CJS_Result::Success(); int32_t nNewPage = 0; if (nCurPage >= nPageCount) @@ -634,5 +634,5 @@ CJS_Return CJX_HostPseudoModel::pageDown( nNewPage = nCurPage + 1; hDoc->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage); - return CJS_Return::Success(); + return CJS_Result::Success(); } diff --git a/fxjs/xfa/cjx_instancemanager.cpp b/fxjs/xfa/cjx_instancemanager.cpp index ce00af18e6..b36fddc4fc 100644 --- a/fxjs/xfa/cjx_instancemanager.cpp +++ b/fxjs/xfa/cjx_instancemanager.cpp @@ -133,15 +133,15 @@ int32_t CJX_InstanceManager::MoveInstance(int32_t iTo, int32_t iFrom) { return 0; } -CJS_Return CJX_InstanceManager::moveInstance( +CJS_Result CJX_InstanceManager::moveInstance( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { CXFA_Document* doc = static_cast<CFXJSE_Engine*>(runtime)->GetDocument(); if (doc->GetFormType() != FormType::kXFAFull) - return CJS_Return::Failure(JSMessage::kNotSupportedError); + return CJS_Result::Failure(JSMessage::kNotSupportedError); if (params.size() != 2) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); int32_t iFrom = runtime->ToInt32(params[0]); int32_t iTo = runtime->ToInt32(params[1]); @@ -149,7 +149,7 @@ CJS_Return CJX_InstanceManager::moveInstance( CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_Node* pToInstance = GetXFANode()->GetItemIfExists(iTo); if (pToInstance && pToInstance->GetElementType() == XFA_Element::Subform) @@ -161,32 +161,32 @@ CJS_Return CJX_InstanceManager::moveInstance( pNotify->RunSubformIndexChange(pFromInstance); } - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_InstanceManager::removeInstance( +CJS_Result CJX_InstanceManager::removeInstance( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { CXFA_Document* doc = static_cast<CFXJSE_Engine*>(runtime)->GetDocument(); if (doc->GetFormType() != FormType::kXFAFull) - return CJS_Return::Failure(JSMessage::kNotSupportedError); + return CJS_Result::Failure(JSMessage::kNotSupportedError); if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); int32_t iIndex = runtime->ToInt32(params[0]); int32_t iCount = GetXFANode()->GetCount(); if (iIndex < 0 || iIndex >= iCount) - return CJS_Return::Failure(JSMessage::kInvalidInputError); + return CJS_Result::Failure(JSMessage::kInvalidInputError); CXFA_Occur* occur = GetXFANode()->GetOccurIfExists(); int32_t iMin = occur ? occur->GetMin() : CXFA_Occur::kDefaultMin; if (iCount - 1 < iMin) - return CJS_Return::Failure(JSMessage::kTooManyOccurances); + return CJS_Result::Failure(JSMessage::kTooManyOccurances); CXFA_Node* pRemoveInstance = GetXFANode()->GetItemIfExists(iIndex); if (!pRemoveInstance) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); GetXFANode()->RemoveItem(pRemoveInstance, true); @@ -205,32 +205,32 @@ CJS_Return CJX_InstanceManager::removeInstance( pLayoutPro->AddChangedContainer( ToNode(GetDocument()->GetXFAObject(XFA_HASHCODE_Form))); } - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_InstanceManager::setInstances( +CJS_Result CJX_InstanceManager::setInstances( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { CXFA_Document* doc = static_cast<CFXJSE_Engine*>(runtime)->GetDocument(); if (doc->GetFormType() != FormType::kXFAFull) - return CJS_Return::Failure(JSMessage::kNotSupportedError); + return CJS_Result::Failure(JSMessage::kNotSupportedError); if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); SetInstances(runtime->ToInt32(params[0])); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_InstanceManager::addInstance( +CJS_Result CJX_InstanceManager::addInstance( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { CXFA_Document* doc = static_cast<CFXJSE_Engine*>(runtime)->GetDocument(); if (doc->GetFormType() != FormType::kXFAFull) - return CJS_Return::Failure(JSMessage::kNotSupportedError); + return CJS_Result::Failure(JSMessage::kNotSupportedError); if (!params.empty() && params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); bool fFlags = true; if (params.size() == 1) @@ -240,11 +240,11 @@ CJS_Return CJX_InstanceManager::addInstance( CXFA_Occur* occur = GetXFANode()->GetOccurIfExists(); int32_t iMax = occur ? occur->GetMax() : CXFA_Occur::kDefaultMax; if (iMax >= 0 && iCount >= iMax) - return CJS_Return::Failure(JSMessage::kTooManyOccurances); + return CJS_Result::Failure(JSMessage::kTooManyOccurances); CXFA_Node* pNewInstance = GetXFANode()->CreateInstanceIfPossible(fFlags); if (!pNewInstance) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); GetXFANode()->InsertItem(pNewInstance, iCount, iCount, false); @@ -262,21 +262,21 @@ CJS_Return CJX_InstanceManager::addInstance( CFXJSE_Value* value = GetDocument()->GetScriptContext()->GetJSValueFromMap(pNewInstance); if (!value) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); - return CJS_Return::Success( + return CJS_Result::Success( value->DirectGetValue().Get(runtime->GetIsolate())); } -CJS_Return CJX_InstanceManager::insertInstance( +CJS_Result CJX_InstanceManager::insertInstance( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { CXFA_Document* doc = static_cast<CFXJSE_Engine*>(runtime)->GetDocument(); if (doc->GetFormType() != FormType::kXFAFull) - return CJS_Return::Failure(JSMessage::kNotSupportedError); + return CJS_Result::Failure(JSMessage::kNotSupportedError); if (params.size() != 1 && params.size() != 2) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); int32_t iIndex = runtime->ToInt32(params[0]); bool bBind = false; @@ -285,16 +285,16 @@ CJS_Return CJX_InstanceManager::insertInstance( int32_t iCount = GetXFANode()->GetCount(); if (iIndex < 0 || iIndex > iCount) - return CJS_Return::Failure(JSMessage::kInvalidInputError); + return CJS_Result::Failure(JSMessage::kInvalidInputError); CXFA_Occur* occur = GetXFANode()->GetOccurIfExists(); int32_t iMax = occur ? occur->GetMax() : CXFA_Occur::kDefaultMax; if (iMax >= 0 && iCount >= iMax) - return CJS_Return::Failure(JSMessage::kInvalidInputError); + return CJS_Result::Failure(JSMessage::kInvalidInputError); CXFA_Node* pNewInstance = GetXFANode()->CreateInstanceIfPossible(bBind); if (!pNewInstance) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); GetXFANode()->InsertItem(pNewInstance, iIndex, iCount, true); @@ -311,9 +311,9 @@ CJS_Return CJX_InstanceManager::insertInstance( CFXJSE_Value* value = GetDocument()->GetScriptContext()->GetJSValueFromMap(pNewInstance); if (!value) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); - return CJS_Return::Success( + return CJS_Result::Success( value->DirectGetValue().Get(runtime->GetIsolate())); } diff --git a/fxjs/xfa/cjx_layoutpseudomodel.cpp b/fxjs/xfa/cjx_layoutpseudomodel.cpp index aa73135607..6985c5061f 100644 --- a/fxjs/xfa/cjx_layoutpseudomodel.cpp +++ b/fxjs/xfa/cjx_layoutpseudomodel.cpp @@ -69,17 +69,17 @@ void CJX_LayoutPseudoModel::ready(CFXJSE_Value* pValue, pValue->SetBoolean(iStatus >= 2); } -CJS_Return CJX_LayoutPseudoModel::HWXY( +CJS_Result CJX_LayoutPseudoModel::HWXY( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params, XFA_LAYOUTMODEL_HWXY layoutModel) { if (params.empty() || params.size() > 3) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_Node* pNode = ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[0])); if (!pNode) - return CJS_Return::Success(); + return CJS_Result::Success(); WideString unit(L"pt"); if (params.size() >= 2) { @@ -90,12 +90,12 @@ CJS_Return CJX_LayoutPseudoModel::HWXY( int32_t iIndex = params.size() >= 3 ? runtime->ToInt32(params[2]) : 0; CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor(); if (!pDocLayout) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_ContentLayoutItem* pLayoutItem = ToContentLayoutItem(pDocLayout->GetLayoutItem(pNode)); if (!pLayoutItem) - return CJS_Return::Success(); + return CJS_Result::Success(); while (iIndex > 0 && pLayoutItem) { pLayoutItem = pLayoutItem->GetNext(); @@ -103,7 +103,7 @@ CJS_Return CJX_LayoutPseudoModel::HWXY( } if (!pLayoutItem) - return CJS_Return::Success(runtime->NewNumber(0.0)); + return CJS_Result::Success(runtime->NewNumber(0.0)); CXFA_Measurement measure; CFX_RectF rtRect = pLayoutItem->GetRect(true); @@ -124,39 +124,39 @@ CJS_Return CJX_LayoutPseudoModel::HWXY( float fValue = measure.ToUnit(CXFA_Measurement::GetUnitFromString(unit.AsStringView())); - return CJS_Return::Success( + return CJS_Result::Success( runtime->NewNumber(FXSYS_round(fValue * 1000) / 1000.0f)); } -CJS_Return CJX_LayoutPseudoModel::h( +CJS_Result CJX_LayoutPseudoModel::h( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { return HWXY(runtime, params, XFA_LAYOUTMODEL_H); } -CJS_Return CJX_LayoutPseudoModel::w( +CJS_Result CJX_LayoutPseudoModel::w( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { return HWXY(runtime, params, XFA_LAYOUTMODEL_W); } -CJS_Return CJX_LayoutPseudoModel::x( +CJS_Result CJX_LayoutPseudoModel::x( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { return HWXY(runtime, params, XFA_LAYOUTMODEL_X); } -CJS_Return CJX_LayoutPseudoModel::y( +CJS_Result CJX_LayoutPseudoModel::y( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { return HWXY(runtime, params, XFA_LAYOUTMODEL_Y); } -CJS_Return CJX_LayoutPseudoModel::NumberedPageCount(CFX_V8* runtime, +CJS_Result CJX_LayoutPseudoModel::NumberedPageCount(CFX_V8* runtime, bool bNumbered) { CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor(); if (!pDocLayout) - return CJS_Return::Success(); + return CJS_Result::Success(); int32_t iPageCount = 0; int32_t iPageNum = pDocLayout->CountPages(); @@ -173,42 +173,42 @@ CJS_Return CJX_LayoutPseudoModel::NumberedPageCount(CFX_V8* runtime, } else { iPageCount = iPageNum; } - return CJS_Return::Success(runtime->NewNumber(iPageCount)); + return CJS_Result::Success(runtime->NewNumber(iPageCount)); } -CJS_Return CJX_LayoutPseudoModel::pageCount( +CJS_Result CJX_LayoutPseudoModel::pageCount( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { return NumberedPageCount(runtime, true); } -CJS_Return CJX_LayoutPseudoModel::pageSpan( +CJS_Result CJX_LayoutPseudoModel::pageSpan( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_Node* pNode = ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[0])); if (!pNode) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor(); if (!pDocLayout) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_ContentLayoutItem* pLayoutItem = ToContentLayoutItem(pDocLayout->GetLayoutItem(pNode)); if (!pLayoutItem) - return CJS_Return::Success(runtime->NewNumber(-1)); + return CJS_Result::Success(runtime->NewNumber(-1)); int32_t iLast = pLayoutItem->GetLast()->GetPage()->GetPageIndex(); int32_t iFirst = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); int32_t iPageSpan = iLast - iFirst + 1; - return CJS_Return::Success(runtime->NewNumber(iPageSpan)); + return CJS_Result::Success(runtime->NewNumber(iPageSpan)); } -CJS_Return CJX_LayoutPseudoModel::page( +CJS_Result CJX_LayoutPseudoModel::page( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { return PageInternals(runtime, params, false); @@ -345,11 +345,11 @@ std::vector<CXFA_Node*> CJX_LayoutPseudoModel::GetObjArray( return retArray; } -CJS_Return CJX_LayoutPseudoModel::pageContent( +CJS_Result CJX_LayoutPseudoModel::pageContent( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.empty() || params.size() > 3) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); int32_t iIndex = 0; if (params.size() >= 1) @@ -365,41 +365,41 @@ CJS_Return CJX_LayoutPseudoModel::pageContent( CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor(); if (!pDocLayout) - return CJS_Return::Success(); + return CJS_Result::Success(); auto pArrayNodeList = pdfium::MakeUnique<CXFA_ArrayNodeList>(GetDocument()); pArrayNodeList->SetArrayNodeList( GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea)); // TODO(dsinclair): Who owns the array once we release it? Won't this leak? - return CJS_Return::Success(static_cast<CFXJSE_Engine*>(runtime)->NewXFAObject( + return CJS_Result::Success(static_cast<CFXJSE_Engine*>(runtime)->NewXFAObject( pArrayNodeList.release(), GetDocument()->GetScriptContext()->GetJseNormalClass()->GetTemplate())); } -CJS_Return CJX_LayoutPseudoModel::absPageCount( +CJS_Result CJX_LayoutPseudoModel::absPageCount( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { return NumberedPageCount(runtime, false); } -CJS_Return CJX_LayoutPseudoModel::absPageCountInBatch( +CJS_Result CJX_LayoutPseudoModel::absPageCountInBatch( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return::Success(runtime->NewNumber(0)); + return CJS_Result::Success(runtime->NewNumber(0)); } -CJS_Return CJX_LayoutPseudoModel::sheetCountInBatch( +CJS_Result CJX_LayoutPseudoModel::sheetCountInBatch( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return::Success(runtime->NewNumber(0)); + return CJS_Result::Success(runtime->NewNumber(0)); } -CJS_Return CJX_LayoutPseudoModel::relayout( +CJS_Result CJX_LayoutPseudoModel::relayout( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { CXFA_Node* pRootNode = GetDocument()->GetRoot(); @@ -411,78 +411,78 @@ CJS_Return CJX_LayoutPseudoModel::relayout( pLayoutProcessor->AddChangedContainer(pContentRootNode); pLayoutProcessor->SetForceReLayout(true); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_LayoutPseudoModel::absPageSpan( +CJS_Result CJX_LayoutPseudoModel::absPageSpan( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { return pageSpan(runtime, params); } -CJS_Return CJX_LayoutPseudoModel::absPageInBatch( +CJS_Result CJX_LayoutPseudoModel::absPageInBatch( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(runtime->NewNumber(0)); + return CJS_Result::Success(runtime->NewNumber(0)); } -CJS_Return CJX_LayoutPseudoModel::sheetInBatch( +CJS_Result CJX_LayoutPseudoModel::sheetInBatch( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(runtime->NewNumber(0)); + return CJS_Result::Success(runtime->NewNumber(0)); } -CJS_Return CJX_LayoutPseudoModel::sheet( +CJS_Result CJX_LayoutPseudoModel::sheet( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { return PageInternals(runtime, params, true); } -CJS_Return CJX_LayoutPseudoModel::relayoutPageArea( +CJS_Result CJX_LayoutPseudoModel::relayoutPageArea( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_LayoutPseudoModel::sheetCount( +CJS_Result CJX_LayoutPseudoModel::sheetCount( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { return NumberedPageCount(runtime, false); } -CJS_Return CJX_LayoutPseudoModel::absPage( +CJS_Result CJX_LayoutPseudoModel::absPage( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { return PageInternals(runtime, params, true); } -CJS_Return CJX_LayoutPseudoModel::PageInternals( +CJS_Result CJX_LayoutPseudoModel::PageInternals( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params, bool bAbsPage) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_Node* pNode = ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[0])); if (!pNode) - return CJS_Return::Success(runtime->NewNumber(0)); + return CJS_Result::Success(runtime->NewNumber(0)); CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor(); if (!pDocLayout) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_ContentLayoutItem* pLayoutItem = ToContentLayoutItem(pDocLayout->GetLayoutItem(pNode)); if (!pLayoutItem) - return CJS_Return::Success(runtime->NewNumber(-1)); + return CJS_Result::Success(runtime->NewNumber(-1)); int32_t iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); - return CJS_Return::Success(runtime->NewNumber(bAbsPage ? iPage : iPage + 1)); + return CJS_Result::Success(runtime->NewNumber(bAbsPage ? iPage : iPage + 1)); } diff --git a/fxjs/xfa/cjx_layoutpseudomodel.h b/fxjs/xfa/cjx_layoutpseudomodel.h index 3d14b8570a..3fd77ef6b5 100644 --- a/fxjs/xfa/cjx_layoutpseudomodel.h +++ b/fxjs/xfa/cjx_layoutpseudomodel.h @@ -52,15 +52,15 @@ class CJX_LayoutPseudoModel : public CJX_Object { JSE_PROP(ready); private: - CJS_Return NumberedPageCount(CFX_V8* runtime, bool bNumbered); - CJS_Return HWXY(CFX_V8* runtime, + CJS_Result NumberedPageCount(CFX_V8* runtime, bool bNumbered); + CJS_Result HWXY(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params, XFA_LAYOUTMODEL_HWXY layoutModel); std::vector<CXFA_Node*> GetObjArray(CXFA_LayoutProcessor* pDocLayout, int32_t iPageNo, const WideString& wsType, bool bOnPageArea); - CJS_Return PageInternals(CFX_V8* runtime, + CJS_Result PageInternals(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params, bool bAbsPage); diff --git a/fxjs/xfa/cjx_list.cpp b/fxjs/xfa/cjx_list.cpp index 89f483bf8e..e86e1fa7c5 100644 --- a/fxjs/xfa/cjx_list.cpp +++ b/fxjs/xfa/cjx_list.cpp @@ -31,61 +31,61 @@ CXFA_List* CJX_List::GetXFAList() { return ToList(GetXFAObject()); } -CJS_Return CJX_List::append(CFX_V8* runtime, +CJS_Result CJX_List::append(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); auto* pNode = ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[0])); if (!pNode) - return CJS_Return::Failure(JSMessage::kValueError); + return CJS_Result::Failure(JSMessage::kValueError); GetXFAList()->Append(pNode); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_List::insert(CFX_V8* runtime, +CJS_Result CJX_List::insert(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 2) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); auto* pNewNode = ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[0])); if (!pNewNode) - return CJS_Return::Failure(JSMessage::kValueError); + return CJS_Result::Failure(JSMessage::kValueError); auto* pBeforeNode = ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[1])); GetXFAList()->Insert(pNewNode, pBeforeNode); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_List::remove(CFX_V8* runtime, +CJS_Result CJX_List::remove(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); auto* pNode = ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[0])); if (!pNode) - return CJS_Return::Failure(JSMessage::kValueError); + return CJS_Result::Failure(JSMessage::kValueError); GetXFAList()->Remove(pNode); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_List::item(CFX_V8* runtime, +CJS_Result CJX_List::item(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); int32_t index = runtime->ToInt32(params[0]); size_t cast_index = static_cast<size_t>(index); if (index < 0 || cast_index >= GetXFAList()->GetLength()) - return CJS_Return::Failure(JSMessage::kInvalidInputError); + return CJS_Result::Failure(JSMessage::kInvalidInputError); - return CJS_Return::Success(static_cast<CFXJSE_Engine*>(runtime)->NewXFAObject( + return CJS_Result::Success(static_cast<CFXJSE_Engine*>(runtime)->NewXFAObject( GetXFAList()->Item(cast_index), GetDocument()->GetScriptContext()->GetJseNormalClass()->GetTemplate())); } diff --git a/fxjs/xfa/cjx_logpseudomodel.cpp b/fxjs/xfa/cjx_logpseudomodel.cpp index 49f3350463..27d37ad127 100644 --- a/fxjs/xfa/cjx_logpseudomodel.cpp +++ b/fxjs/xfa/cjx_logpseudomodel.cpp @@ -25,7 +25,7 @@ CJX_LogPseudoModel::CJX_LogPseudoModel(CScript_LogPseudoModel* model) CJX_LogPseudoModel::~CJX_LogPseudoModel() {} -CJS_Return CJX_LogPseudoModel::message( +CJS_Result CJX_LogPseudoModel::message( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { // Uncomment to allow using xfa.log.message(""); from JS. @@ -35,29 +35,29 @@ CJS_Return CJX_LogPseudoModel::message( // fprintf(stderr, " %ls\n", WideString::FromUTF8(*str).c_str()); // } - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_LogPseudoModel::traceEnabled( +CJS_Result CJX_LogPseudoModel::traceEnabled( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_LogPseudoModel::traceActivate( +CJS_Result CJX_LogPseudoModel::traceActivate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_LogPseudoModel::traceDeactivate( +CJS_Result CJX_LogPseudoModel::traceDeactivate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_LogPseudoModel::trace( +CJS_Result CJX_LogPseudoModel::trace( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return::Success(); + return CJS_Result::Success(); } diff --git a/fxjs/xfa/cjx_manifest.cpp b/fxjs/xfa/cjx_manifest.cpp index 1ca86cc4bf..b53c7edd85 100644 --- a/fxjs/xfa/cjx_manifest.cpp +++ b/fxjs/xfa/cjx_manifest.cpp @@ -21,13 +21,13 @@ CJX_Manifest::CJX_Manifest(CXFA_Manifest* manifest) : CJX_Node(manifest) { CJX_Manifest::~CJX_Manifest() {} -CJS_Return CJX_Manifest::evaluate( +CJS_Result CJX_Manifest::evaluate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success( + return CJS_Result::Success( runtime->NewBoolean(GetXFANode()->IsWidgetReady())); } diff --git a/fxjs/xfa/cjx_model.cpp b/fxjs/xfa/cjx_model.cpp index 97d25175fe..61004e2d1a 100644 --- a/fxjs/xfa/cjx_model.cpp +++ b/fxjs/xfa/cjx_model.cpp @@ -25,17 +25,17 @@ CJX_Model::CJX_Model(CXFA_Node* node) : CJX_Node(node) { CJX_Model::~CJX_Model() {} -CJS_Return CJX_Model::clearErrorList( +CJS_Result CJX_Model::clearErrorList( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Model::createNode( +CJS_Result CJX_Model::createNode( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.empty() || params.size() > 3) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); WideString name; if (params.size() > 1) @@ -49,11 +49,11 @@ CJS_Return CJX_Model::createNode( XFA_Element eType = CXFA_Node::NameToElement(tagName); CXFA_Node* pNewNode = GetXFANode()->CreateSamePacketNode(eType); if (!pNewNode) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); if (!name.IsEmpty()) { if (!pNewNode->HasAttribute(XFA_Attribute::Name)) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); pNewNode->JSObject()->SetAttribute(XFA_Attribute::Name, name.AsStringView(), true); @@ -64,23 +64,23 @@ CJS_Return CJX_Model::createNode( CFXJSE_Value* value = GetDocument()->GetScriptContext()->GetJSValueFromMap(pNewNode); if (!value) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); - return CJS_Return::Success( + return CJS_Result::Success( value->DirectGetValue().Get(runtime->GetIsolate())); } -CJS_Return CJX_Model::isCompatibleNS( +CJS_Result CJX_Model::isCompatibleNS( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); WideString nameSpace; if (params.size() >= 1) nameSpace = runtime->ToWideString(params[0]); - return CJS_Return::Success( + return CJS_Result::Success( runtime->NewBoolean(TryNamespace().value_or(WideString()) == nameSpace)); } diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp index 9a85d94f0d..fed94094a7 100644 --- a/fxjs/xfa/cjx_node.cpp +++ b/fxjs/xfa/cjx_node.cpp @@ -107,83 +107,83 @@ CXFA_Node* CJX_Node::GetXFANode() const { return ToNode(GetXFAObject()); } -CJS_Return CJX_Node::applyXSL(CFX_V8* runtime, +CJS_Result CJX_Node::applyXSL(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); // TODO(weili): check whether we need to implement this, pdfium:501. - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Node::assignNode( +CJS_Result CJX_Node::assignNode( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.empty() || params.size() > 3) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); // TODO(weili): check whether we need to implement this, pdfium:501. - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Node::clone(CFX_V8* runtime, +CJS_Result CJX_Node::clone(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_Node* pCloneNode = GetXFANode()->Clone(runtime->ToBoolean(params[0])); CFXJSE_Value* value = GetDocument()->GetScriptContext()->GetJSValueFromMap(pCloneNode); if (!value) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); - return CJS_Return::Success( + return CJS_Result::Success( value->DirectGetValue().Get(runtime->GetIsolate())); } -CJS_Return CJX_Node::getAttribute( +CJS_Result CJX_Node::getAttribute( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); WideString expression = runtime->ToWideString(params[0]); - return CJS_Return::Success(runtime->NewString( + return CJS_Result::Success(runtime->NewString( GetAttribute(expression.AsStringView()).UTF8Encode().AsStringView())); } -CJS_Return CJX_Node::getElement( +CJS_Result CJX_Node::getElement( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.empty() || params.size() > 2) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); WideString expression = runtime->ToWideString(params[0]); int32_t iValue = params.size() >= 2 ? runtime->ToInt32(params[1]) : 0; CXFA_Node* pNode = GetOrCreateProperty<CXFA_Node>( iValue, CXFA_Node::NameToElement(expression)); if (!pNode) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); CFXJSE_Value* value = GetDocument()->GetScriptContext()->GetJSValueFromMap(pNode); if (!value) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); - return CJS_Return::Success( + return CJS_Result::Success( value->DirectGetValue().Get(runtime->GetIsolate())); } -CJS_Return CJX_Node::isPropertySpecified( +CJS_Result CJX_Node::isPropertySpecified( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.empty() || params.size() > 3) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); WideString expression = runtime->ToWideString(params[0]); XFA_Attribute attr = CXFA_Node::NameToAttribute(expression.AsStringView()); if (attr != XFA_Attribute::Unknown && HasAttribute(attr)) - return CJS_Return::Success(runtime->NewBoolean(true)); + return CJS_Result::Success(runtime->NewBoolean(true)); bool bParent = params.size() < 2 || runtime->ToBoolean(params[1]); int32_t iIndex = params.size() == 3 ? runtime->ToInt32(params[2]) : 0; @@ -195,17 +195,17 @@ CJS_Return CJX_Node::isPropertySpecified( bHas = jsnode->HasAttribute(attr) || !!jsnode->GetOrCreateProperty<CXFA_Node>(iIndex, eType); } - return CJS_Return::Success(runtime->NewBoolean(bHas)); + return CJS_Result::Success(runtime->NewBoolean(bHas)); } -CJS_Return CJX_Node::loadXML(CFX_V8* runtime, +CJS_Result CJX_Node::loadXML(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.empty() || params.size() > 3) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); ByteString expression = runtime->ToByteString(params[0]); if (expression.IsEmpty()) - return CJS_Return::Success(); + return CJS_Result::Success(); bool bIgnoreRoot = true; if (params.size() >= 2) @@ -218,7 +218,7 @@ CJS_Return CJX_Node::loadXML(CFX_V8* runtime, auto pParser = pdfium::MakeUnique<CXFA_DocumentParser>(GetDocument()); CFX_XMLNode* pXMLNode = pParser->ParseXMLData(expression); if (!pXMLNode) - return CJS_Return::Success(); + return CJS_Result::Success(); if (bIgnoreRoot && (pXMLNode->GetType() != FX_XMLNODE_Element || @@ -274,7 +274,7 @@ CJS_Return CJX_Node::loadXML(CFX_V8* runtime, pParser->ConstructXFANode(pFakeRoot, pFakeXMLRoot); pFakeRoot = pParser->GetRootNode(); if (!pFakeRoot) - return CJS_Return::Success(); + return CJS_Result::Success(); if (bOverwrite) { CXFA_Node* pChild = GetXFANode()->GetFirstChild(); @@ -322,37 +322,37 @@ CJS_Return CJX_Node::loadXML(CFX_V8* runtime, } pFakeRoot->SetFlag(XFA_NodeFlag_HasRemovedChildren); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Node::saveFilteredXML( +CJS_Result CJX_Node::saveFilteredXML( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { // TODO(weili): Check whether we need to implement this, pdfium:501. - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Node::saveXML(CFX_V8* runtime, +CJS_Result CJX_Node::saveXML(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() > 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); if (params.size() == 1 && runtime->ToWideString(params[0]) != L"pretty") - return CJS_Return::Failure(JSMessage::kValueError); + return CJS_Result::Failure(JSMessage::kValueError); // TODO(weili): Check whether we need to save pretty print XML, pdfium:501. ByteString bsXMLHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; if (GetXFANode()->GetPacketType() != XFA_PacketType::Form && GetXFANode()->GetPacketType() != XFA_PacketType::Datasets) { - return CJS_Return::Success(runtime->NewString("")); + return CJS_Result::Success(runtime->NewString("")); } CFX_XMLNode* pElement = nullptr; if (GetXFANode()->GetPacketType() == XFA_PacketType::Datasets) { pElement = GetXFANode()->GetXMLMappingNode(); if (!pElement || pElement->GetType() != FX_XMLNODE_Element) { - return CJS_Return::Success( + return CJS_Result::Success( runtime->NewString(bsXMLHeader.AsStringView())); } @@ -368,30 +368,30 @@ CJS_Return CJX_Node::saveXML(CFX_V8* runtime, pElement->Save(pMemoryStream); } - return CJS_Return::Success(runtime->NewString( + return CJS_Result::Success(runtime->NewString( ByteStringView(pMemoryStream->GetBuffer(), pMemoryStream->GetSize()))); } -CJS_Return CJX_Node::setAttribute( +CJS_Result CJX_Node::setAttribute( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 2) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); WideString attributeValue = runtime->ToWideString(params[0]); WideString attribute = runtime->ToWideString(params[1]); SetAttribute(attribute.AsStringView(), attributeValue.AsStringView(), true); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Node::setElement( +CJS_Result CJX_Node::setElement( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1 && params.size() != 2) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); // TODO(weili): check whether we need to implement this, pdfium:501. - return CJS_Return::Success(); + return CJS_Result::Success(); } void CJX_Node::id(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp index be6879544c..27d1f1524f 100644 --- a/fxjs/xfa/cjx_object.cpp +++ b/fxjs/xfa/cjx_object.cpp @@ -13,7 +13,7 @@ #include "core/fxcrt/xml/cfx_xmltext.h" #include "fxjs/cfxjse_engine.h" #include "fxjs/cfxjse_value.h" -#include "fxjs/cjs_return.h" +#include "fxjs/cjs_result.h" #include "fxjs/xfa/cjx_boolean.h" #include "fxjs/xfa/cjx_draw.h" #include "fxjs/xfa/cjx_field.h" @@ -166,12 +166,12 @@ bool CJX_Object::HasMethod(const WideString& func) const { return pdfium::ContainsKey(method_specs_, func.UTF8Encode()); } -CJS_Return CJX_Object::RunMethod( +CJS_Result CJX_Object::RunMethod( const WideString& func, const std::vector<v8::Local<v8::Value>>& params) { auto it = method_specs_.find(func.UTF8Encode()); if (it == method_specs_.end()) - return CJS_Return::Failure(JSMessage::kUnknownMethod); + return CJS_Result::Failure(JSMessage::kUnknownMethod); return it->second(this, GetXFAObject()->GetDocument()->GetScriptContext(), params); diff --git a/fxjs/xfa/cjx_object.h b/fxjs/xfa/cjx_object.h index 4116f378ca..a88900e73e 100644 --- a/fxjs/xfa/cjx_object.h +++ b/fxjs/xfa/cjx_object.h @@ -31,7 +31,7 @@ class CXFA_Node; class CXFA_Object; struct XFA_MAPMODULEDATA; -typedef CJS_Return (*CJX_MethodCall)( +typedef CJS_Result (*CJX_MethodCall)( CJX_Object* obj, CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params); @@ -71,7 +71,7 @@ class CJX_Object { CXFA_LayoutItem* GetLayoutItem() const { return layout_item_; } bool HasMethod(const WideString& func) const; - CJS_Return RunMethod(const WideString& func, + CJS_Result RunMethod(const WideString& func, const std::vector<v8::Local<v8::Value>>& params); bool HasAttribute(XFA_Attribute eAttr); diff --git a/fxjs/xfa/cjx_packet.cpp b/fxjs/xfa/cjx_packet.cpp index ae706ceaf4..5673f8aecd 100644 --- a/fxjs/xfa/cjx_packet.cpp +++ b/fxjs/xfa/cjx_packet.cpp @@ -28,40 +28,40 @@ CJX_Packet::CJX_Packet(CXFA_Packet* packet) : CJX_Node(packet) { CJX_Packet::~CJX_Packet() {} -CJS_Return CJX_Packet::getAttribute( +CJS_Result CJX_Packet::getAttribute( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); WideString attributeValue; CFX_XMLElement* element = ToXMLElement(GetXFANode()->GetXMLMappingNode()); if (element) attributeValue = element->GetAttribute(runtime->ToWideString(params[0])); - return CJS_Return::Success( + return CJS_Result::Success( runtime->NewString(attributeValue.UTF8Encode().AsStringView())); } -CJS_Return CJX_Packet::setAttribute( +CJS_Result CJX_Packet::setAttribute( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 2) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CFX_XMLElement* element = ToXMLElement(GetXFANode()->GetXMLMappingNode()); if (element) { element->SetAttribute(runtime->ToWideString(params[1]), runtime->ToWideString(params[0])); } - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); } -CJS_Return CJX_Packet::removeAttribute( +CJS_Result CJX_Packet::removeAttribute( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CFX_XMLElement* pElement = ToXMLElement(GetXFANode()->GetXMLMappingNode()); if (pElement) { @@ -69,7 +69,7 @@ CJS_Return CJX_Packet::removeAttribute( if (pElement->HasAttribute(name)) pElement->RemoveAttribute(name); } - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); } void CJX_Packet::content(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_signaturepseudomodel.cpp b/fxjs/xfa/cjx_signaturepseudomodel.cpp index 49a4f1540f..0a604a5b40 100644 --- a/fxjs/xfa/cjx_signaturepseudomodel.cpp +++ b/fxjs/xfa/cjx_signaturepseudomodel.cpp @@ -26,38 +26,38 @@ CJX_SignaturePseudoModel::CJX_SignaturePseudoModel( CJX_SignaturePseudoModel::~CJX_SignaturePseudoModel() {} -CJS_Return CJX_SignaturePseudoModel::verifySignature( +CJS_Result CJX_SignaturePseudoModel::verifySignature( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.empty() || params.size() > 4) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(runtime->NewNumber(0)); + return CJS_Result::Success(runtime->NewNumber(0)); } -CJS_Return CJX_SignaturePseudoModel::sign( +CJS_Result CJX_SignaturePseudoModel::sign( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() < 3 || params.size() > 7) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(runtime->NewBoolean(false)); + return CJS_Result::Success(runtime->NewBoolean(false)); } -CJS_Return CJX_SignaturePseudoModel::enumerate( +CJS_Result CJX_SignaturePseudoModel::enumerate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_SignaturePseudoModel::clear( +CJS_Result CJX_SignaturePseudoModel::clear( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.empty() || params.size() > 2) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(runtime->NewBoolean(false)); + return CJS_Result::Success(runtime->NewBoolean(false)); } diff --git a/fxjs/xfa/cjx_source.cpp b/fxjs/xfa/cjx_source.cpp index 0b24b8f4b4..6a710951fa 100644 --- a/fxjs/xfa/cjx_source.cpp +++ b/fxjs/xfa/cjx_source.cpp @@ -37,146 +37,146 @@ CJX_Source::CJX_Source(CXFA_Source* src) : CJX_Node(src) { CJX_Source::~CJX_Source() {} -CJS_Return CJX_Source::next(CFX_V8* runtime, +CJS_Result CJX_Source::next(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::cancelBatch( +CJS_Result CJX_Source::cancelBatch( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::first(CFX_V8* runtime, +CJS_Result CJX_Source::first(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::updateBatch( +CJS_Result CJX_Source::updateBatch( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::previous( +CJS_Result CJX_Source::previous( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::isBOF(CFX_V8* runtime, +CJS_Result CJX_Source::isBOF(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::isEOF(CFX_V8* runtime, +CJS_Result CJX_Source::isEOF(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::cancel(CFX_V8* runtime, +CJS_Result CJX_Source::cancel(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::update(CFX_V8* runtime, +CJS_Result CJX_Source::update(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::open(CFX_V8* runtime, +CJS_Result CJX_Source::open(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::deleteItem( +CJS_Result CJX_Source::deleteItem( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::addNew(CFX_V8* runtime, +CJS_Result CJX_Source::addNew(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::requery( +CJS_Result CJX_Source::requery( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::resync(CFX_V8* runtime, +CJS_Result CJX_Source::resync(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::close(CFX_V8* runtime, +CJS_Result CJX_Source::close(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::last(CFX_V8* runtime, +CJS_Result CJX_Source::last(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Source::hasDataChanged( +CJS_Result CJX_Source::hasDataChanged( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(); + return CJS_Result::Success(); } void CJX_Source::db(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_subform.cpp b/fxjs/xfa/cjx_subform.cpp index c313cb4364..c08d2e684c 100644 --- a/fxjs/xfa/cjx_subform.cpp +++ b/fxjs/xfa/cjx_subform.cpp @@ -28,56 +28,56 @@ CJX_Subform::CJX_Subform(CXFA_Node* node) : CJX_Container(node) { CJX_Subform::~CJX_Subform() {} -CJS_Return CJX_Subform::execEvent( +CJS_Result CJX_Subform::execEvent( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); execSingleEventByName(runtime->ToWideString(params[0]).AsStringView(), XFA_Element::Subform); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Subform::execInitialize( +CJS_Result CJX_Subform::execInitialize( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (pNotify) pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize, false, true); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Subform::execCalculate( +CJS_Result CJX_Subform::execCalculate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (pNotify) pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false, true); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Subform::execValidate( +CJS_Result CJX_Subform::execValidate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return::Success(runtime->NewBoolean(false)); + return CJS_Result::Success(runtime->NewBoolean(false)); int32_t iRet = pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Validate, false, true); - return CJS_Return::Success(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error)); + return CJS_Result::Success(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error)); } void CJX_Subform::locale(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_template.cpp b/fxjs/xfa/cjx_template.cpp index 8f27b64bfb..b97d5e3634 100644 --- a/fxjs/xfa/cjx_template.cpp +++ b/fxjs/xfa/cjx_template.cpp @@ -27,60 +27,60 @@ CJX_Template::CJX_Template(CXFA_Template* tmpl) : CJX_Model(tmpl) { CJX_Template::~CJX_Template() {} -CJS_Return CJX_Template::formNodes( +CJS_Result CJX_Template::formNodes( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(runtime->NewBoolean(true)); + return CJS_Result::Success(runtime->NewBoolean(true)); } -CJS_Return CJX_Template::remerge( +CJS_Result CJX_Template::remerge( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); GetDocument()->DoDataRemerge(true); - return CJS_Return::Success(); + return CJS_Result::Success(); } -CJS_Return CJX_Template::execInitialize( +CJS_Result CJX_Template::execInitialize( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success( + return CJS_Result::Success( runtime->NewBoolean(GetXFANode()->IsWidgetReady())); } -CJS_Return CJX_Template::recalculate( +CJS_Result CJX_Template::recalculate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(runtime->NewBoolean(true)); + return CJS_Result::Success(runtime->NewBoolean(true)); } -CJS_Return CJX_Template::execCalculate( +CJS_Result CJX_Template::execCalculate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success( + return CJS_Result::Success( runtime->NewBoolean(GetXFANode()->IsWidgetReady())); } -CJS_Return CJX_Template::execValidate( +CJS_Result CJX_Template::execValidate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success( + return CJS_Result::Success( runtime->NewBoolean(GetXFANode()->IsWidgetReady())); } diff --git a/fxjs/xfa/cjx_tree.cpp b/fxjs/xfa/cjx_tree.cpp index be74b44a93..9787b9b885 100644 --- a/fxjs/xfa/cjx_tree.cpp +++ b/fxjs/xfa/cjx_tree.cpp @@ -29,16 +29,16 @@ CJX_Tree::CJX_Tree(CXFA_Object* obj) : CJX_Object(obj) { CJX_Tree::~CJX_Tree() {} -CJS_Return CJX_Tree::resolveNode( +CJS_Result CJX_Tree::resolveNode( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); WideString expression = runtime->ToWideString(params[0]); CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); if (!pScriptContext) - return CJS_Return::Success(); + return CJS_Result::Success(); CXFA_Object* refNode = GetXFAObject(); if (refNode->GetElementType() == XFA_Element::Xfa) @@ -51,7 +51,7 @@ CJS_Return CJX_Tree::resolveNode( if (!pScriptContext->ResolveObjects(ToNode(refNode), expression.AsStringView(), &resolveNodeRS, dwFlag, nullptr)) { - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); } if (resolveNodeRS.dwFlags == XFA_ResolveNode_RSType_Nodes) { @@ -59,9 +59,9 @@ CJS_Return CJX_Tree::resolveNode( CFXJSE_Value* value = GetDocument()->GetScriptContext()->GetJSValueFromMap(pObject); if (!value) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); - return CJS_Return::Success( + return CJS_Result::Success( value->DirectGetValue().Get(runtime->GetIsolate())); } @@ -69,22 +69,22 @@ CJS_Return CJX_Tree::resolveNode( resolveNodeRS.pScriptAttribute; if (!lpAttributeInfo || lpAttributeInfo->eValueType != XFA_ScriptType::Object) { - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); } auto pValue = pdfium::MakeUnique<CFXJSE_Value>(pScriptContext->GetIsolate()); CJX_Object* jsObject = resolveNodeRS.objects.front()->JSObject(); (jsObject->*(lpAttributeInfo->callback))(pValue.get(), false, lpAttributeInfo->attribute); - return CJS_Return::Success( + return CJS_Result::Success( pValue->DirectGetValue().Get(runtime->GetIsolate())); } -CJS_Return CJX_Tree::resolveNodes( +CJS_Result CJX_Tree::resolveNodes( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_Object* refNode = GetXFAObject(); if (refNode->GetElementType() == XFA_Element::Xfa) @@ -92,7 +92,7 @@ CJS_Return CJX_Tree::resolveNodes( CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); if (!pScriptContext) - return CJS_Return::Success(); + return CJS_Result::Success(); auto pValue = pdfium::MakeUnique<CFXJSE_Value>(pScriptContext->GetIsolate()); ResolveNodeList(pValue.get(), runtime->ToWideString(params[0]), @@ -100,7 +100,7 @@ CJS_Return CJX_Tree::resolveNodes( XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings, ToNode(refNode)); - return CJS_Return::Success( + return CJS_Result::Success( pValue->DirectGetValue().Get(runtime->GetIsolate())); } diff --git a/fxjs/xfa/cjx_treelist.cpp b/fxjs/xfa/cjx_treelist.cpp index 0c023003e4..acf5307e8f 100644 --- a/fxjs/xfa/cjx_treelist.cpp +++ b/fxjs/xfa/cjx_treelist.cpp @@ -28,22 +28,22 @@ CXFA_TreeList* CJX_TreeList::GetXFATreeList() { return ToTreeList(GetXFAObject()); } -CJS_Return CJX_TreeList::namedItem( +CJS_Result CJX_TreeList::namedItem( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); CXFA_Node* pNode = GetXFATreeList()->NamedItem( runtime->ToWideString(params[0]).AsStringView()); if (!pNode) - return CJS_Return::Success(); + return CJS_Result::Success(); CFXJSE_Value* value = GetDocument()->GetScriptContext()->GetJSValueFromMap(pNode); if (!value) - return CJS_Return::Success(runtime->NewNull()); + return CJS_Result::Success(runtime->NewNull()); - return CJS_Return::Success( + return CJS_Result::Success( value->DirectGetValue().Get(runtime->GetIsolate())); } diff --git a/fxjs/xfa/cjx_wsdlconnection.cpp b/fxjs/xfa/cjx_wsdlconnection.cpp index 198d4f2f98..dec20d7163 100644 --- a/fxjs/xfa/cjx_wsdlconnection.cpp +++ b/fxjs/xfa/cjx_wsdlconnection.cpp @@ -22,13 +22,13 @@ CJX_WsdlConnection::CJX_WsdlConnection(CXFA_WsdlConnection* connection) CJX_WsdlConnection::~CJX_WsdlConnection() {} -CJS_Return CJX_WsdlConnection::execute( +CJS_Result CJX_WsdlConnection::execute( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty() && params.size() != 1) - return CJS_Return::Failure(JSMessage::kParamError); + return CJS_Result::Failure(JSMessage::kParamError); - return CJS_Return::Success(runtime->NewBoolean(false)); + return CJS_Result::Success(runtime->NewBoolean(false)); } void CJX_WsdlConnection::dataDescription(CFXJSE_Value* pValue, |