diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-06-08 18:23:05 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-08 18:23:05 +0000 |
commit | 1699982f45d01cb18585eba80cce5326a63d3b67 (patch) | |
tree | 537d81d989632bab75fda37f5b587e1309e60d5d /fxjs/xfa | |
parent | f29479d47156d180c0b71f6c98aa4de37c2a7ee2 (diff) | |
download | pdfium-1699982f45d01cb18585eba80cce5326a63d3b67.tar.xz |
Ensure CJS_Return() with error always includes a message.
Change the signature of the constructors to make it impossible to
do this otherwise.
Change-Id: I14e88d98a1128f2d599459ce9337cd6d079469fe
Reviewed-on: https://pdfium-review.googlesource.com/34531
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/xfa')
-rw-r--r-- | fxjs/xfa/cjx_container.cpp | 2 | ||||
-rw-r--r-- | fxjs/xfa/cjx_datawindow.cpp | 8 | ||||
-rw-r--r-- | fxjs/xfa/cjx_delta.cpp | 2 | ||||
-rw-r--r-- | fxjs/xfa/cjx_eventpseudomodel.cpp | 16 | ||||
-rw-r--r-- | fxjs/xfa/cjx_exclgroup.cpp | 6 | ||||
-rw-r--r-- | fxjs/xfa/cjx_field.cpp | 24 | ||||
-rw-r--r-- | fxjs/xfa/cjx_form.cpp | 12 | ||||
-rw-r--r-- | fxjs/xfa/cjx_hostpseudomodel.cpp | 84 | ||||
-rw-r--r-- | fxjs/xfa/cjx_instancemanager.cpp | 8 | ||||
-rw-r--r-- | fxjs/xfa/cjx_layoutpseudomodel.cpp | 22 | ||||
-rw-r--r-- | fxjs/xfa/cjx_list.cpp | 6 | ||||
-rw-r--r-- | fxjs/xfa/cjx_logpseudomodel.cpp | 10 | ||||
-rw-r--r-- | fxjs/xfa/cjx_model.cpp | 2 | ||||
-rw-r--r-- | fxjs/xfa/cjx_node.cpp | 20 | ||||
-rw-r--r-- | fxjs/xfa/cjx_object.cpp | 3 | ||||
-rw-r--r-- | fxjs/xfa/cjx_signaturepseudomodel.cpp | 2 | ||||
-rw-r--r-- | fxjs/xfa/cjx_source.cpp | 34 | ||||
-rw-r--r-- | fxjs/xfa/cjx_subform.cpp | 6 | ||||
-rw-r--r-- | fxjs/xfa/cjx_template.cpp | 2 | ||||
-rw-r--r-- | fxjs/xfa/cjx_tree.cpp | 4 | ||||
-rw-r--r-- | fxjs/xfa/cjx_treelist.cpp | 2 |
21 files changed, 138 insertions, 137 deletions
diff --git a/fxjs/xfa/cjx_container.cpp b/fxjs/xfa/cjx_container.cpp index e5dbfe8258..0e58a7ea22 100644 --- a/fxjs/xfa/cjx_container.cpp +++ b/fxjs/xfa/cjx_container.cpp @@ -27,7 +27,7 @@ CJX_Container::~CJX_Container() {} CJS_Return CJX_Container::getDelta( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Container::getDeltas( diff --git a/fxjs/xfa/cjx_datawindow.cpp b/fxjs/xfa/cjx_datawindow.cpp index cdb6aab207..1f5b6ec7b6 100644 --- a/fxjs/xfa/cjx_datawindow.cpp +++ b/fxjs/xfa/cjx_datawindow.cpp @@ -27,25 +27,25 @@ CJX_DataWindow::~CJX_DataWindow() {} CJS_Return CJX_DataWindow::moveCurrentRecord( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_DataWindow::record( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_DataWindow::gotoRecord( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_DataWindow::isRecordGroup( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return(true); + return CJS_Return(); } void CJX_DataWindow::recordsBefore(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_delta.cpp b/fxjs/xfa/cjx_delta.cpp index 1da5953ea1..9732f4eecb 100644 --- a/fxjs/xfa/cjx_delta.cpp +++ b/fxjs/xfa/cjx_delta.cpp @@ -24,7 +24,7 @@ CJS_Return CJX_Delta::restore(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } void CJX_Delta::currentValue(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_eventpseudomodel.cpp b/fxjs/xfa/cjx_eventpseudomodel.cpp index d2364c8f32..a6c5560b03 100644 --- a/fxjs/xfa/cjx_eventpseudomodel.cpp +++ b/fxjs/xfa/cjx_eventpseudomodel.cpp @@ -174,22 +174,22 @@ CJS_Return CJX_EventPseudoModel::emit( const std::vector<v8::Local<v8::Value>>& params) { CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); if (!pScriptContext) - return CJS_Return(true); + return CJS_Return(); CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); if (!pEventParam) - return CJS_Return(true); + return CJS_Return(); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return(true); + return CJS_Return(); CXFA_FFWidgetHandler* pWidgetHandler = pNotify->GetWidgetHandler(); if (!pWidgetHandler) - return CJS_Return(true); + return CJS_Return(); pWidgetHandler->ProcessEvent(pEventParam->m_pTarget, pEventParam); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_EventPseudoModel::reset( @@ -197,14 +197,14 @@ CJS_Return CJX_EventPseudoModel::reset( const std::vector<v8::Local<v8::Value>>& params) { CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); if (!pScriptContext) - return CJS_Return(true); + return CJS_Return(); CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); if (!pEventParam) - return CJS_Return(true); + return CJS_Return(); pEventParam->Reset(); - return CJS_Return(true); + return CJS_Return(); } void CJX_EventPseudoModel::Property(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_exclgroup.cpp b/fxjs/xfa/cjx_exclgroup.cpp index 2b66484073..6e44e56079 100644 --- a/fxjs/xfa/cjx_exclgroup.cpp +++ b/fxjs/xfa/cjx_exclgroup.cpp @@ -38,7 +38,7 @@ CJS_Return CJX_ExclGroup::execEvent( execSingleEventByName(runtime->ToWideString(params[0]).AsStringView(), XFA_Element::ExclGroup); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_ExclGroup::execInitialize( @@ -51,7 +51,7 @@ CJS_Return CJX_ExclGroup::execInitialize( if (pNotify) pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize, false, true); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_ExclGroup::execCalculate( @@ -64,7 +64,7 @@ CJS_Return CJX_ExclGroup::execCalculate( if (pNotify) pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false, true); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_ExclGroup::execValidate( diff --git a/fxjs/xfa/cjx_field.cpp b/fxjs/xfa/cjx_field.cpp index d3f0280d3f..3beb868f1d 100644 --- a/fxjs/xfa/cjx_field.cpp +++ b/fxjs/xfa/cjx_field.cpp @@ -44,7 +44,7 @@ CJS_Return CJX_Field::clearItems( CXFA_Node* node = GetXFANode(); if (node->IsWidgetReady()) node->DeleteItem(-1, true, false); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Field::execEvent( @@ -57,7 +57,7 @@ CJS_Return CJX_Field::execEvent( int32_t iRet = execSingleEventByName(eventString.AsStringView(), XFA_Element::Field); if (eventString != L"validate") - return CJS_Return(true); + return CJS_Return(); return CJS_Return(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error)); } @@ -73,7 +73,7 @@ CJS_Return CJX_Field::execInitialize( pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize, false, false); } - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Field::deleteItem( @@ -84,7 +84,7 @@ CJS_Return CJX_Field::deleteItem( CXFA_Node* node = GetXFANode(); if (!node->IsWidgetReady()) - return CJS_Return(true); + return CJS_Return(); bool bValue = node->DeleteItem(runtime->ToInt32(params[0]), true, true); return CJS_Return(runtime->NewBoolean(bValue)); @@ -119,7 +119,7 @@ CJS_Return CJX_Field::boundItem( CXFA_Node* node = GetXFANode(); if (!node->IsWidgetReady()) - return CJS_Return(true); + return CJS_Return(); WideString value = runtime->ToWideString(params[0]); WideString boundValue = node->GetItemValue(value.AsStringView()); @@ -134,7 +134,7 @@ CJS_Return CJX_Field::getItemState( CXFA_Node* node = GetXFANode(); if (!node->IsWidgetReady()) - return CJS_Return(true); + return CJS_Return(); int32_t state = node->GetItemState(runtime->ToInt32(params[0])); return CJS_Return(runtime->NewBoolean(state != 0)); @@ -151,7 +151,7 @@ CJS_Return CJX_Field::execCalculate( pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false, false); } - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Field::getDisplayItem( @@ -183,17 +183,17 @@ CJS_Return CJX_Field::setItemState( CXFA_Node* node = GetXFANode(); if (!node->IsWidgetReady()) - return CJS_Return(true); + return CJS_Return(); int32_t iIndex = runtime->ToInt32(params[0]); if (runtime->ToInt32(params[1]) != 0) { node->SetItemState(iIndex, true, true, true, true); - return CJS_Return(true); + return CJS_Return(); } if (node->GetItemState(iIndex)) node->SetItemState(iIndex, false, true, true, true); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Field::addItem(CFX_V8* runtime, @@ -203,7 +203,7 @@ CJS_Return CJX_Field::addItem(CFX_V8* runtime, CXFA_Node* node = GetXFANode(); if (!node->IsWidgetReady()) - return CJS_Return(true); + return CJS_Return(); WideString label; if (params.size() >= 1) @@ -214,7 +214,7 @@ CJS_Return CJX_Field::addItem(CFX_V8* runtime, value = runtime->ToWideString(params[1]); node->InsertItem(label, value, true); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Field::execValidate( diff --git a/fxjs/xfa/cjx_form.cpp b/fxjs/xfa/cjx_form.cpp index fa244b3af6..d1d50ad8f3 100644 --- a/fxjs/xfa/cjx_form.cpp +++ b/fxjs/xfa/cjx_form.cpp @@ -59,7 +59,7 @@ CJS_Return CJX_Form::remerge(CFX_V8* runtime, return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); GetDocument()->DoDataRemerge(true); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Form::execInitialize( @@ -72,7 +72,7 @@ CJS_Return CJX_Form::execInitialize( if (pNotify) pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize, false, true); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Form::recalculate( @@ -82,19 +82,19 @@ CJS_Return CJX_Form::recalculate( GetDocument()->GetScriptContext()->GetEventParam(); if (pEventParam->m_eType == XFA_EVENT_Calculate || pEventParam->m_eType == XFA_EVENT_InitCalculate) { - return CJS_Return(true); + return CJS_Return(); } if (params.size() != 1) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify || runtime->ToInt32(params[0]) != 0) - return CJS_Return(true); + return CJS_Return(); 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(true); + return CJS_Return(); } CJS_Return CJX_Form::execCalculate( @@ -107,7 +107,7 @@ CJS_Return CJX_Form::execCalculate( if (pNotify) pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false, true); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Form::execValidate( diff --git a/fxjs/xfa/cjx_hostpseudomodel.cpp b/fxjs/xfa/cjx_hostpseudomodel.cpp index fe26d3161d..2d9b1bf712 100644 --- a/fxjs/xfa/cjx_hostpseudomodel.cpp +++ b/fxjs/xfa/cjx_hostpseudomodel.cpp @@ -243,33 +243,33 @@ CJS_Return CJX_HostPseudoModel::gotoURL( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) - return CJS_Return(true); + return CJS_Return(); if (params.size() != 1) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return(true); + return CJS_Return(); CXFA_FFDoc* hDoc = pNotify->GetHDOC(); WideString URL = runtime->ToWideString(params[0]); hDoc->GetDocEnvironment()->GotoURL(hDoc, URL); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_HostPseudoModel::openList( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) - return CJS_Return(true); + return CJS_Return(); if (params.size() != 1) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return(true); + return CJS_Return(); 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(true); + return CJS_Return(); CXFA_Object* pObject = pScriptContext->GetThisObject(); if (!pObject) - return CJS_Return(true); + return CJS_Return(); uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; @@ -291,24 +291,24 @@ CJS_Return CJX_HostPseudoModel::openList( pObject, runtime->ToWideString(params[0]).AsStringView(), &resolveNodeRS, dwFlag, nullptr); if (!iRet || !resolveNodeRS.objects.front()->IsNode()) - return CJS_Return(true); + return CJS_Return(); pNode = resolveNodeRS.objects.front()->AsNode(); } CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor(); if (!pDocLayout) - return CJS_Return(true); + return CJS_Return(); CXFA_FFWidget* hWidget = XFA_GetWidgetFromLayoutItem(pDocLayout->GetLayoutItem(pNode)); if (!hWidget) - return CJS_Return(true); + return CJS_Return(); CXFA_FFDoc* hDoc = pNotify->GetHDOC(); hDoc->GetDocEnvironment()->SetFocusWidget(hDoc, hWidget); pNotify->OpenDropDownList(hWidget); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_HostPseudoModel::response( @@ -319,7 +319,7 @@ CJS_Return CJX_HostPseudoModel::response( CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return(true); + return CJS_Return(); WideString question; if (params.size() >= 1) @@ -356,7 +356,7 @@ CJS_Return CJX_HostPseudoModel::resetData( CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return(true); + return CJS_Return(); WideString expression; if (params.size() >= 1) @@ -364,7 +364,7 @@ CJS_Return CJX_HostPseudoModel::resetData( if (expression.IsEmpty()) { pNotify->ResetData(nullptr); - return CJS_Return(true); + return CJS_Return(); } int32_t iStart = 0; @@ -375,11 +375,11 @@ CJS_Return CJX_HostPseudoModel::resetData( iStart = FilterName(expression.AsStringView(), iStart, wsName); CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); if (!pScriptContext) - return CJS_Return(true); + return CJS_Return(); CXFA_Object* pObject = pScriptContext->GetThisObject(); if (!pObject) - return CJS_Return(true); + return CJS_Return(); uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; @@ -395,42 +395,42 @@ CJS_Return CJX_HostPseudoModel::resetData( if (!pNode) pNotify->ResetData(nullptr); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_HostPseudoModel::beep( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) - return CJS_Return(true); + return CJS_Return(); if (params.size() > 1) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return(true); + return CJS_Return(); uint32_t dwType = 4; if (params.size() >= 1) dwType = runtime->ToInt32(params[0]); pNotify->GetAppProvider()->Beep(dwType); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_HostPseudoModel::setFocus( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) - return CJS_Return(true); + return CJS_Return(); if (params.size() != 1) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return(true); + return CJS_Return(); CXFA_Node* pNode = nullptr; if (params.size() >= 1) { @@ -440,11 +440,11 @@ CJS_Return CJX_HostPseudoModel::setFocus( } else if (params[0]->IsString()) { CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); if (!pScriptContext) - return CJS_Return(true); + return CJS_Return(); CXFA_Object* pObject = pScriptContext->GetThisObject(); if (!pObject) - return CJS_Return(true); + return CJS_Return(); uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; @@ -453,13 +453,13 @@ CJS_Return CJX_HostPseudoModel::setFocus( pObject, runtime->ToWideString(params[0]).AsStringView(), &resolveNodeRS, dwFlag, nullptr); if (!iRet || !resolveNodeRS.objects.front()->IsNode()) - return CJS_Return(true); + return CJS_Return(); pNode = resolveNodeRS.objects.front()->AsNode(); } } pNotify->SetFocusWidgetNode(pNode); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_HostPseudoModel::getFocus( @@ -467,11 +467,11 @@ CJS_Return CJX_HostPseudoModel::getFocus( const std::vector<v8::Local<v8::Value>>& params) { CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return(true); + return CJS_Return(); CXFA_Node* pNode = pNotify->GetFocusWidgetNode(); if (!pNode) - return CJS_Return(true); + return CJS_Return(); CFXJSE_Value* value = GetDocument()->GetScriptContext()->GetJSValueFromMap(pNode); @@ -485,14 +485,14 @@ CJS_Return CJX_HostPseudoModel::messageBox( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) - return CJS_Return(true); + return CJS_Return(); if (params.empty() || params.size() > 4) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return(true); + return CJS_Return(); WideString message; if (params.size() >= 1) @@ -531,14 +531,14 @@ CJS_Return CJX_HostPseudoModel::print( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) - return CJS_Return(true); + return CJS_Return(); if (params.size() != 8) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return(true); + return CJS_Return(); uint32_t dwOptions = 0; if (runtime->ToBoolean(params[0])) @@ -559,7 +559,7 @@ CJS_Return CJX_HostPseudoModel::print( CXFA_FFDoc* hDoc = pNotify->GetHDOC(); hDoc->GetDocEnvironment()->Print(hDoc, nStartPage, nEndPage, dwOptions); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_HostPseudoModel::importData( @@ -568,7 +568,7 @@ CJS_Return CJX_HostPseudoModel::importData( if (params.empty() || params.size() > 1) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_HostPseudoModel::exportData( @@ -579,7 +579,7 @@ CJS_Return CJX_HostPseudoModel::exportData( CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return(true); + return CJS_Return(); WideString filePath; if (params.size() >= 1) @@ -591,7 +591,7 @@ CJS_Return CJX_HostPseudoModel::exportData( CXFA_FFDoc* hDoc = pNotify->GetHDOC(); hDoc->GetDocEnvironment()->ExportData(hDoc, filePath, XDP); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_HostPseudoModel::pageUp( @@ -599,17 +599,17 @@ CJS_Return CJX_HostPseudoModel::pageUp( const std::vector<v8::Local<v8::Value>>& params) { CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return(true); + return CJS_Return(); CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t nCurPage = hDoc->GetDocEnvironment()->GetCurrentPage(hDoc); int32_t nNewPage = 0; if (nCurPage <= 1) - return CJS_Return(true); + return CJS_Return(); nNewPage = nCurPage - 1; hDoc->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_HostPseudoModel::pageDown( @@ -617,13 +617,13 @@ CJS_Return CJX_HostPseudoModel::pageDown( const std::vector<v8::Local<v8::Value>>& params) { CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return(true); + return CJS_Return(); 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(true); + return CJS_Return(); int32_t nNewPage = 0; if (nCurPage >= nPageCount) @@ -632,5 +632,5 @@ CJS_Return CJX_HostPseudoModel::pageDown( nNewPage = nCurPage + 1; hDoc->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage); - return CJS_Return(true); + return CJS_Return(); } diff --git a/fxjs/xfa/cjx_instancemanager.cpp b/fxjs/xfa/cjx_instancemanager.cpp index 081b685efa..f8df62cdbc 100644 --- a/fxjs/xfa/cjx_instancemanager.cpp +++ b/fxjs/xfa/cjx_instancemanager.cpp @@ -144,7 +144,7 @@ CJS_Return CJX_InstanceManager::moveInstance( CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return(true); + return CJS_Return(); CXFA_Node* pToInstance = GetXFANode()->GetItemIfExists(iTo); if (pToInstance && pToInstance->GetElementType() == XFA_Element::Subform) @@ -156,7 +156,7 @@ CJS_Return CJX_InstanceManager::moveInstance( pNotify->RunSubformIndexChange(pFromInstance); } - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_InstanceManager::removeInstance( @@ -196,7 +196,7 @@ CJS_Return CJX_InstanceManager::removeInstance( pLayoutPro->AddChangedContainer( ToNode(GetDocument()->GetXFAObject(XFA_HASHCODE_Form))); } - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_InstanceManager::setInstances( @@ -206,7 +206,7 @@ CJS_Return CJX_InstanceManager::setInstances( return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); SetInstances(runtime->ToInt32(params[0])); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_InstanceManager::addInstance( diff --git a/fxjs/xfa/cjx_layoutpseudomodel.cpp b/fxjs/xfa/cjx_layoutpseudomodel.cpp index 6a01d2914e..0ae4871d09 100644 --- a/fxjs/xfa/cjx_layoutpseudomodel.cpp +++ b/fxjs/xfa/cjx_layoutpseudomodel.cpp @@ -78,7 +78,7 @@ CJS_Return CJX_LayoutPseudoModel::HWXY( CXFA_Node* pNode = ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[0])); if (!pNode) - return CJS_Return(true); + return CJS_Return(); WideString unit(L"pt"); if (params.size() >= 2) { @@ -90,11 +90,11 @@ CJS_Return CJX_LayoutPseudoModel::HWXY( CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor(); if (!pDocLayout) - return CJS_Return(true); + return CJS_Return(); CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); if (!pLayoutItem) - return CJS_Return(true); + return CJS_Return(); while (iIndex > 0 && pLayoutItem) { pLayoutItem = pLayoutItem->GetNext(); @@ -154,7 +154,7 @@ CJS_Return CJX_LayoutPseudoModel::NumberedPageCount(CFX_V8* runtime, bool bNumbered) { CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor(); if (!pDocLayout) - return CJS_Return(true); + return CJS_Return(); int32_t iPageCount = 0; int32_t iPageNum = pDocLayout->CountPages(); @@ -189,11 +189,11 @@ CJS_Return CJX_LayoutPseudoModel::pageSpan( CXFA_Node* pNode = ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[0])); if (!pNode) - return CJS_Return(true); + return CJS_Return(); CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor(); if (!pDocLayout) - return CJS_Return(true); + return CJS_Return(); CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); if (!pLayoutItem) @@ -365,11 +365,11 @@ CJS_Return CJX_LayoutPseudoModel::pageContent( CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) - return CJS_Return(true); + return CJS_Return(); CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor(); if (!pDocLayout) - return CJS_Return(true); + return CJS_Return(); auto pArrayNodeList = pdfium::MakeUnique<CXFA_ArrayNodeList>(GetDocument()); pArrayNodeList->SetArrayNodeList( @@ -411,7 +411,7 @@ CJS_Return CJX_LayoutPseudoModel::relayout( pLayoutProcessor->AddChangedContainer(pContentRootNode); pLayoutProcessor->SetForceReLayout(true); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_LayoutPseudoModel::absPageSpan( @@ -445,7 +445,7 @@ CJS_Return CJX_LayoutPseudoModel::sheet( CJS_Return CJX_LayoutPseudoModel::relayoutPageArea( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_LayoutPseudoModel::sheetCount( @@ -474,7 +474,7 @@ CJS_Return CJX_LayoutPseudoModel::PageInternals( CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor(); if (!pDocLayout) - return CJS_Return(true); + return CJS_Return(); CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); if (!pLayoutItem) diff --git a/fxjs/xfa/cjx_list.cpp b/fxjs/xfa/cjx_list.cpp index 4340e3b089..b6ac47ec79 100644 --- a/fxjs/xfa/cjx_list.cpp +++ b/fxjs/xfa/cjx_list.cpp @@ -42,7 +42,7 @@ CJS_Return CJX_List::append(CFX_V8* runtime, return CJS_Return(JSGetStringFromID(JSMessage::kValueError)); GetXFAList()->Append(pNode); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_List::insert(CFX_V8* runtime, @@ -58,7 +58,7 @@ CJS_Return CJX_List::insert(CFX_V8* runtime, auto* pBeforeNode = ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[1])); GetXFAList()->Insert(pNewNode, pBeforeNode); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_List::remove(CFX_V8* runtime, @@ -72,7 +72,7 @@ CJS_Return CJX_List::remove(CFX_V8* runtime, return CJS_Return(JSGetStringFromID(JSMessage::kValueError)); GetXFAList()->Remove(pNode); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_List::item(CFX_V8* runtime, diff --git a/fxjs/xfa/cjx_logpseudomodel.cpp b/fxjs/xfa/cjx_logpseudomodel.cpp index 18093f5263..93772ed03d 100644 --- a/fxjs/xfa/cjx_logpseudomodel.cpp +++ b/fxjs/xfa/cjx_logpseudomodel.cpp @@ -35,29 +35,29 @@ CJS_Return CJX_LogPseudoModel::message( // fprintf(stderr, " %ls\n", WideString::FromUTF8(*str).c_str()); // } - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_LogPseudoModel::traceEnabled( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_LogPseudoModel::traceActivate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_LogPseudoModel::traceDeactivate( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_LogPseudoModel::trace( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return(true); + return CJS_Return(); } diff --git a/fxjs/xfa/cjx_model.cpp b/fxjs/xfa/cjx_model.cpp index 857d6a4b01..688b30350a 100644 --- a/fxjs/xfa/cjx_model.cpp +++ b/fxjs/xfa/cjx_model.cpp @@ -28,7 +28,7 @@ CJX_Model::~CJX_Model() {} CJS_Return CJX_Model::clearErrorList( CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Model::createNode( diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp index a07aa4cb2c..7c472db6c9 100644 --- a/fxjs/xfa/cjx_node.cpp +++ b/fxjs/xfa/cjx_node.cpp @@ -117,7 +117,7 @@ CJS_Return CJX_Node::applyXSL(CFX_V8* runtime, return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); // TODO(weili): check whether we need to implement this, pdfium:501. - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Node::assignNode( @@ -127,7 +127,7 @@ CJS_Return CJX_Node::assignNode( return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); // TODO(weili): check whether we need to implement this, pdfium:501. - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Node::clone(CFX_V8* runtime, @@ -206,7 +206,7 @@ CJS_Return CJX_Node::loadXML(CFX_V8* runtime, ByteString expression = runtime->ToByteString(params[0]); if (expression.IsEmpty()) - return CJS_Return(true); + return CJS_Return(); bool bIgnoreRoot = true; if (params.size() >= 2) @@ -218,11 +218,11 @@ CJS_Return CJX_Node::loadXML(CFX_V8* runtime, auto pParser = pdfium::MakeUnique<CXFA_DocumentParser>(GetDocument()); if (!pParser) - return CJS_Return(true); + return CJS_Return(); CFX_XMLNode* pXMLNode = pParser->ParseXMLData(expression); if (!pXMLNode) - return CJS_Return(true); + return CJS_Return(); if (bIgnoreRoot && (pXMLNode->GetType() != FX_XMLNODE_Element || @@ -278,7 +278,7 @@ CJS_Return CJX_Node::loadXML(CFX_V8* runtime, pParser->ConstructXFANode(pFakeRoot, pFakeXMLRoot); pFakeRoot = pParser->GetRootNode(); if (!pFakeRoot) - return CJS_Return(true); + return CJS_Return(); if (bOverwrite) { CXFA_Node* pChild = GetXFANode()->GetFirstChild(); @@ -326,14 +326,14 @@ CJS_Return CJX_Node::loadXML(CFX_V8* runtime, } pFakeRoot->SetFlag(XFA_NodeFlag_HasRemovedChildren); - return CJS_Return(true); + return CJS_Return(); } CJS_Return 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(true); + return CJS_Return(); } CJS_Return CJX_Node::saveXML(CFX_V8* runtime, @@ -383,7 +383,7 @@ CJS_Return CJX_Node::setAttribute( WideString attributeValue = runtime->ToWideString(params[0]); WideString attribute = runtime->ToWideString(params[1]); SetAttribute(attribute.AsStringView(), attributeValue.AsStringView(), true); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Node::setElement( @@ -393,7 +393,7 @@ CJS_Return CJX_Node::setElement( return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); // TODO(weili): check whether we need to implement this, pdfium:501. - return CJS_Return(true); + return CJS_Return(); } void CJX_Node::id(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp index ba914221bd..d357c56091 100644 --- a/fxjs/xfa/cjx_object.cpp +++ b/fxjs/xfa/cjx_object.cpp @@ -172,7 +172,8 @@ CJS_Return CJX_Object::RunMethod( const std::vector<v8::Local<v8::Value>>& params) { auto it = method_specs_.find(func.UTF8Encode()); if (it == method_specs_.end()) - return CJS_Return(false); + return CJS_Return(JSMessage::kUnknownMethod); + return it->second(this, GetXFAObject()->GetDocument()->GetScriptContext(), params); } diff --git a/fxjs/xfa/cjx_signaturepseudomodel.cpp b/fxjs/xfa/cjx_signaturepseudomodel.cpp index 304177884b..0e4d560da3 100644 --- a/fxjs/xfa/cjx_signaturepseudomodel.cpp +++ b/fxjs/xfa/cjx_signaturepseudomodel.cpp @@ -47,7 +47,7 @@ CJS_Return CJX_SignaturePseudoModel::enumerate( const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_SignaturePseudoModel::clear( diff --git a/fxjs/xfa/cjx_source.cpp b/fxjs/xfa/cjx_source.cpp index 7576e7718d..98772b5acf 100644 --- a/fxjs/xfa/cjx_source.cpp +++ b/fxjs/xfa/cjx_source.cpp @@ -41,7 +41,7 @@ CJS_Return CJX_Source::next(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::cancelBatch( @@ -49,14 +49,14 @@ CJS_Return CJX_Source::cancelBatch( const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::first(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::updateBatch( @@ -64,7 +64,7 @@ CJS_Return CJX_Source::updateBatch( const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::previous( @@ -72,42 +72,42 @@ CJS_Return CJX_Source::previous( const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::isBOF(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::isEOF(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::cancel(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::update(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::open(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::deleteItem( @@ -115,14 +115,14 @@ CJS_Return CJX_Source::deleteItem( const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::addNew(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::requery( @@ -130,28 +130,28 @@ CJS_Return CJX_Source::requery( const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::resync(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::close(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::last(CFX_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Source::hasDataChanged( @@ -159,7 +159,7 @@ CJS_Return CJX_Source::hasDataChanged( const std::vector<v8::Local<v8::Value>>& params) { if (!params.empty()) return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); - return CJS_Return(true); + return CJS_Return(); } void CJX_Source::db(CFXJSE_Value* pValue, diff --git a/fxjs/xfa/cjx_subform.cpp b/fxjs/xfa/cjx_subform.cpp index 52f08655ca..042bd85119 100644 --- a/fxjs/xfa/cjx_subform.cpp +++ b/fxjs/xfa/cjx_subform.cpp @@ -36,7 +36,7 @@ CJS_Return CJX_Subform::execEvent( execSingleEventByName(runtime->ToWideString(params[0]).AsStringView(), XFA_Element::Subform); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Subform::execInitialize( @@ -49,7 +49,7 @@ CJS_Return CJX_Subform::execInitialize( if (pNotify) pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize, false, true); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Subform::execCalculate( @@ -62,7 +62,7 @@ CJS_Return CJX_Subform::execCalculate( if (pNotify) pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false, true); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Subform::execValidate( diff --git a/fxjs/xfa/cjx_template.cpp b/fxjs/xfa/cjx_template.cpp index 6612a7c5c2..0b9c3b2472 100644 --- a/fxjs/xfa/cjx_template.cpp +++ b/fxjs/xfa/cjx_template.cpp @@ -42,7 +42,7 @@ CJS_Return CJX_Template::remerge( return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); GetDocument()->DoDataRemerge(true); - return CJS_Return(true); + return CJS_Return(); } CJS_Return CJX_Template::execInitialize( diff --git a/fxjs/xfa/cjx_tree.cpp b/fxjs/xfa/cjx_tree.cpp index 219953d1d4..442a82d1e6 100644 --- a/fxjs/xfa/cjx_tree.cpp +++ b/fxjs/xfa/cjx_tree.cpp @@ -38,7 +38,7 @@ CJS_Return CJX_Tree::resolveNode( WideString expression = runtime->ToWideString(params[0]); CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); if (!pScriptContext) - return CJS_Return(true); + return CJS_Return(); CXFA_Object* refNode = GetXFAObject(); if (refNode->GetElementType() == XFA_Element::Xfa) @@ -90,7 +90,7 @@ CJS_Return CJX_Tree::resolveNodes( CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); if (!pScriptContext) - return CJS_Return(true); + return CJS_Return(); auto pValue = pdfium::MakeUnique<CFXJSE_Value>(pScriptContext->GetIsolate()); ResolveNodeList(pValue.get(), runtime->ToWideString(params[0]), diff --git a/fxjs/xfa/cjx_treelist.cpp b/fxjs/xfa/cjx_treelist.cpp index 904e09370f..b608734e3c 100644 --- a/fxjs/xfa/cjx_treelist.cpp +++ b/fxjs/xfa/cjx_treelist.cpp @@ -37,7 +37,7 @@ CJS_Return CJX_TreeList::namedItem( CXFA_Node* pNode = GetXFATreeList()->NamedItem( runtime->ToWideString(params[0]).AsStringView()); if (!pNode) - return CJS_Return(true); + return CJS_Return(); CFXJSE_Value* value = GetDocument()->GetScriptContext()->GetJSValueFromMap(pNode); |