diff options
Diffstat (limited to 'fxjs/xfa/cjx_node.cpp')
-rw-r--r-- | fxjs/xfa/cjx_node.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
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, |