From cb22f9ad9265f40b1104ed2b09488ccc6ec9e5aa Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 11 Dec 2017 22:01:08 +0000 Subject: [xfa] Refactor CJX method signatures. This CL changes the CJX methods from void (*)(CFXJSE_Arguments*) to CJS_Return (*)(CJS_V8* runtime, const std::vector>& params) which is closer to how CJS works in practice. Change-Id: I3a3129268acfe4262dfeb04179919ed19f6c24e1 Reviewed-on: https://pdfium-review.googlesource.com/20491 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- fxjs/xfa/cjx_manifest.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'fxjs/xfa/cjx_manifest.cpp') diff --git a/fxjs/xfa/cjx_manifest.cpp b/fxjs/xfa/cjx_manifest.cpp index 066ba29e15..6d5da2c60e 100644 --- a/fxjs/xfa/cjx_manifest.cpp +++ b/fxjs/xfa/cjx_manifest.cpp @@ -6,8 +6,10 @@ #include "fxjs/xfa/cjx_manifest.h" -#include "fxjs/cfxjse_arguments.h" +#include + #include "fxjs/cfxjse_value.h" +#include "fxjs/js_resources.h" #include "xfa/fxfa/parser/cxfa_manifest.h" const CJX_MethodSpec CJX_Manifest::MethodSpecs[] = { @@ -20,16 +22,12 @@ CJX_Manifest::CJX_Manifest(CXFA_Manifest* manifest) : CJX_Node(manifest) { CJX_Manifest::~CJX_Manifest() {} -void CJX_Manifest::evaluate(CFXJSE_Arguments* pArguments) { - if (pArguments->GetLength() != 0) { - ThrowParamCountMismatchException(L"evaluate"); - return; - } +CJS_Return CJX_Manifest::evaluate( + CJS_V8* runtime, + const std::vector>& params) { + if (!params.empty()) + return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); CXFA_WidgetData* pWidgetData = GetXFANode()->GetWidgetData(); - if (!pWidgetData) { - pArguments->GetReturnValue()->SetBoolean(false); - return; - } - pArguments->GetReturnValue()->SetBoolean(true); + return CJS_Return(runtime->NewBoolean(!!pWidgetData)); } -- cgit v1.2.3