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/cjx_object.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'fxjs/cjx_object.cpp') diff --git a/fxjs/cjx_object.cpp b/fxjs/cjx_object.cpp index 21eb3c8921..fbbcc00365 100644 --- a/fxjs/cjx_object.cpp +++ b/fxjs/cjx_object.cpp @@ -6,12 +6,13 @@ #include "fxjs/cjx_object.h" -#include #include #include "core/fxcrt/fx_extension.h" #include "core/fxcrt/xml/cfx_xmltext.h" +#include "fxjs/cfxjse_engine.h" #include "fxjs/cfxjse_value.h" +#include "fxjs/cjs_return.h" #include "third_party/base/ptr_util.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/cxfa_ffwidget.h" @@ -103,11 +104,14 @@ bool CJX_Object::HasMethod(const WideString& func) const { return pdfium::ContainsKey(method_specs_, func.UTF8Encode()); } -void CJX_Object::RunMethod(const WideString& func, CFXJSE_Arguments* args) { +CJS_Return CJX_Object::RunMethod( + const WideString& func, + const std::vector>& params) { auto it = method_specs_.find(func.UTF8Encode()); if (it == method_specs_.end()) - return; - it->second(this, args); + return CJS_Return(false); + return it->second(this, GetXFAObject()->GetDocument()->GetScriptContext(), + params); } void CJX_Object::ThrowInvalidPropertyException() const { -- cgit v1.2.3