summaryrefslogtreecommitdiff
path: root/fxjs/xfa/cjx_source.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_source.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_source.cpp')
-rw-r--r--fxjs/xfa/cjx_source.cpp146
1 files changed, 94 insertions, 52 deletions
diff --git a/fxjs/xfa/cjx_source.cpp b/fxjs/xfa/cjx_source.cpp
index 3197231811..17512b3e63 100644
--- a/fxjs/xfa/cjx_source.cpp
+++ b/fxjs/xfa/cjx_source.cpp
@@ -6,8 +6,10 @@
#include "fxjs/xfa/cjx_source.h"
-#include "fxjs/cfxjse_arguments.h"
+#include <vector>
+
#include "fxjs/cfxjse_value.h"
+#include "fxjs/js_resources.h"
#include "xfa/fxfa/parser/cxfa_source.h"
const CJX_MethodSpec CJX_Source::MethodSpecs[] = {
@@ -36,87 +38,127 @@ CJX_Source::CJX_Source(CXFA_Source* src) : CJX_Node(src) {
CJX_Source::~CJX_Source() {}
-void CJX_Source::next(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"next");
+CJS_Return CJX_Source::next(CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::cancelBatch(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"cancelBatch");
+CJS_Return CJX_Source::cancelBatch(
+ CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::first(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"first");
+CJS_Return CJX_Source::first(CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::updateBatch(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"updateBatch");
+CJS_Return CJX_Source::updateBatch(
+ CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::previous(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"previous");
+CJS_Return CJX_Source::previous(
+ CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::isBOF(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"isBOF");
+CJS_Return CJX_Source::isBOF(CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::isEOF(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"isEOF");
+CJS_Return CJX_Source::isEOF(CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::cancel(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"cancel");
+CJS_Return CJX_Source::cancel(CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::update(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"update");
+CJS_Return CJX_Source::update(CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::open(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"open");
+CJS_Return CJX_Source::open(CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::deleteItem(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"delete");
+CJS_Return CJX_Source::deleteItem(
+ CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::addNew(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"addNew");
+CJS_Return CJX_Source::addNew(CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::requery(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"requery");
+CJS_Return CJX_Source::requery(
+ CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::resync(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"resync");
+CJS_Return CJX_Source::resync(CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::close(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"close");
+CJS_Return CJX_Source::close(CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::last(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"last");
+CJS_Return CJX_Source::last(CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}
-void CJX_Source::hasDataChanged(CFXJSE_Arguments* pArguments) {
- if (pArguments->GetLength() != 0)
- ThrowParamCountMismatchException(L"hasDataChanged");
+CJS_Return CJX_Source::hasDataChanged(
+ CJS_V8* runtime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ if (!params.empty())
+ return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+ return CJS_Return(true);
}