summaryrefslogtreecommitdiff
path: root/fxjs/xfa/cjx_manifest.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-12-11 22:01:08 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-11 22:01:08 +0000
commitcb22f9ad9265f40b1104ed2b09488ccc6ec9e5aa (patch)
tree4aaa14dfb0528268fb9a9a94a4cac82df1af4602 /fxjs/xfa/cjx_manifest.cpp
parent731526e3b9f32ceac1cdac600fe3ecd55a0bc9b5 (diff)
downloadpdfium-cb22f9ad9265f40b1104ed2b09488ccc6ec9e5aa.tar.xz
[xfa] Refactor CJX method signatures.
This CL changes the CJX methods from void (*)(CFXJSE_Arguments*) to CJS_Return (*)(CJS_V8* runtime, const std::vector<v8::Local<v8::Value>>& params) which is closer to how CJS works in practice. Change-Id: I3a3129268acfe4262dfeb04179919ed19f6c24e1 Reviewed-on: https://pdfium-review.googlesource.com/20491 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/xfa/cjx_manifest.cpp')
-rw-r--r--fxjs/xfa/cjx_manifest.cpp20
1 files changed, 9 insertions, 11 deletions
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 <vector>
+
#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<v8::Local<v8::Value>>& 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));
}