summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-10-24 21:40:24 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-25 18:14:09 +0000
commit80435cb746fa7bd22cf062ab39829ec86000fd21 (patch)
tree9085fa57d5f49eac4b56b065ca572f424c9f744b /fpdfsdk
parente85107bc8ab5bbd5b2d3f97fd6071d7ce4a78bcc (diff)
downloadpdfium-80435cb746fa7bd22cf062ab39829ec86000fd21.tar.xz
Convert JS input params to v8::Local<v8::Value>>s
This CL converts the JS set_* methods and the JSMethod methods to accept v8::Local<v8::Value> objects instead of CJS_Value objects. Change-Id: I6de41305deff458eba515bdc3462522b502f74ad Reviewed-on: https://pdfium-review.googlesource.com/16670 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/javascript/Annot.cpp10
-rw-r--r--fpdfsdk/javascript/Annot.h10
-rw-r--r--fpdfsdk/javascript/Document.cpp299
-rw-r--r--fpdfsdk/javascript/Document.h160
-rw-r--r--fpdfsdk/javascript/Field.cpp332
-rw-r--r--fpdfsdk/javascript/Field.h175
-rw-r--r--fpdfsdk/javascript/Icon.cpp2
-rw-r--r--fpdfsdk/javascript/Icon.h4
-rw-r--r--fpdfsdk/javascript/JS_Define.h12
-rw-r--r--fpdfsdk/javascript/JS_Value.cpp27
-rw-r--r--fpdfsdk/javascript/JS_Value.h8
-rw-r--r--fpdfsdk/javascript/PublicMethods.cpp358
-rw-r--r--fpdfsdk/javascript/PublicMethods.h98
-rw-r--r--fpdfsdk/javascript/app.cpp168
-rw-r--r--fpdfsdk/javascript/app.h70
-rw-r--r--fpdfsdk/javascript/cjs_runtime.cpp2
-rw-r--r--fpdfsdk/javascript/cjs_runtime.h2
-rw-r--r--fpdfsdk/javascript/color.cpp112
-rw-r--r--fpdfsdk/javascript/color.h38
-rw-r--r--fpdfsdk/javascript/console.cpp8
-rw-r--r--fpdfsdk/javascript/console.h8
-rw-r--r--fpdfsdk/javascript/event.cpp52
-rw-r--r--fpdfsdk/javascript/event.h46
-rw-r--r--fpdfsdk/javascript/global.cpp43
-rw-r--r--fpdfsdk/javascript/report.cpp4
-rw-r--r--fpdfsdk/javascript/report.h4
-rw-r--r--fpdfsdk/javascript/util.cpp53
-rw-r--r--fpdfsdk/javascript/util.h10
28 files changed, 1059 insertions, 1056 deletions
diff --git a/fpdfsdk/javascript/Annot.cpp b/fpdfsdk/javascript/Annot.cpp
index d80c75525a..a068e28008 100644
--- a/fpdfsdk/javascript/Annot.cpp
+++ b/fpdfsdk/javascript/Annot.cpp
@@ -50,10 +50,10 @@ bool Annot::get_hidden(CJS_Runtime* pRuntime,
}
bool Annot::set_hidden(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
// May invalidate m_pAnnot.
- bool bHidden = pRuntime->ToBoolean(vp.ToV8Value());
+ bool bHidden = pRuntime->ToBoolean(vp);
if (!m_pAnnot) {
*sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -88,10 +88,10 @@ bool Annot::get_name(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool Annot::set_name(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
// May invalidate m_pAnnot.
- WideString annotName = pRuntime->ToWideString(vp.ToV8Value());
+ WideString annotName = pRuntime->ToWideString(vp);
if (!m_pAnnot) {
*sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -116,7 +116,7 @@ bool Annot::get_type(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool Annot::set_type(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
*sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
diff --git a/fpdfsdk/javascript/Annot.h b/fpdfsdk/javascript/Annot.h
index 00872a4ed4..94b67622e5 100644
--- a/fpdfsdk/javascript/Annot.h
+++ b/fpdfsdk/javascript/Annot.h
@@ -17,14 +17,18 @@ class Annot : public CJS_EmbedObj {
bool get_hidden(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_hidden(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_name(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_name(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_name(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_type(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_type(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_type(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
void SetSDKAnnot(CPDFSDK_BAAnnot* annot);
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index 22fe8b4c80..9404ded0c8 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -178,7 +178,7 @@ bool Document::get_num_fields(CJS_Runtime* pRuntime,
}
bool Document::set_num_fields(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
*sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -197,15 +197,15 @@ bool Document::get_dirty(CJS_Runtime* pRuntime,
}
bool Document::set_dirty(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
if (!m_pFormFillEnv) {
*sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
}
- pRuntime->ToBoolean(vp.ToV8Value()) ? m_pFormFillEnv->SetChangeMark()
- : m_pFormFillEnv->ClearChangeMark();
+ pRuntime->ToBoolean(vp) ? m_pFormFillEnv->SetChangeMark()
+ : m_pFormFillEnv->ClearChangeMark();
return true;
}
@@ -218,7 +218,7 @@ bool Document::get_ADBE(CJS_Runtime* pRuntime,
}
bool Document::set_ADBE(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
@@ -237,7 +237,7 @@ bool Document::get_page_num(CJS_Runtime* pRuntime,
}
bool Document::set_page_num(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
if (!m_pFormFillEnv) {
*sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
@@ -245,7 +245,7 @@ bool Document::set_page_num(CJS_Runtime* pRuntime,
}
int iPageCount = m_pFormFillEnv->GetPageCount();
- int iPageNum = pRuntime->ToInt32(vp.ToV8Value());
+ int iPageNum = pRuntime->ToInt32(vp);
if (iPageNum >= 0 && iPageNum < iPageCount)
m_pFormFillEnv->JS_docgotoPage(iPageNum);
else if (iPageNum >= iPageCount)
@@ -257,7 +257,7 @@ bool Document::set_page_num(CJS_Runtime* pRuntime,
}
bool Document::addAnnot(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Not supported.
@@ -265,7 +265,7 @@ bool Document::addAnnot(CJS_Runtime* pRuntime,
}
bool Document::addField(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Not supported.
@@ -273,7 +273,7 @@ bool Document::addField(CJS_Runtime* pRuntime,
}
bool Document::exportAsText(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not supported.
@@ -281,7 +281,7 @@ bool Document::exportAsText(CJS_Runtime* pRuntime,
}
bool Document::exportAsFDF(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not supported.
@@ -289,7 +289,7 @@ bool Document::exportAsFDF(CJS_Runtime* pRuntime,
}
bool Document::exportAsXFDF(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not supported.
@@ -297,7 +297,7 @@ bool Document::exportAsXFDF(CJS_Runtime* pRuntime,
}
bool Document::getField(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() < 1) {
@@ -308,7 +308,7 @@ bool Document::getField(CJS_Runtime* pRuntime,
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
}
- WideString wideName = pRuntime->ToWideString(params[0].ToV8Value());
+ WideString wideName = pRuntime->ToWideString(params[0]);
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
if (pPDFForm->CountFields(wideName) <= 0) {
@@ -333,7 +333,7 @@ bool Document::getField(CJS_Runtime* pRuntime,
// Gets the name of the nth field in the document
bool Document::getNthFieldName(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() != 1) {
@@ -344,7 +344,8 @@ bool Document::getNthFieldName(CJS_Runtime* pRuntime,
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
}
- int nIndex = pRuntime->ToInt32(params[0].ToV8Value());
+ int nIndex = pRuntime->ToInt32(params[0]);
+
if (nIndex < 0) {
sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR);
return false;
@@ -360,7 +361,7 @@ bool Document::getNthFieldName(CJS_Runtime* pRuntime,
}
bool Document::importAnFDF(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not supported.
@@ -368,7 +369,7 @@ bool Document::importAnFDF(CJS_Runtime* pRuntime,
}
bool Document::importAnXFDF(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not supported.
@@ -376,7 +377,7 @@ bool Document::importAnXFDF(CJS_Runtime* pRuntime,
}
bool Document::importTextData(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not supported.
@@ -387,7 +388,7 @@ bool Document::importTextData(CJS_Runtime* pRuntime,
// all recipients.
// comment: need reader supports
bool Document::mailForm(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (!m_pFormFillEnv) {
@@ -399,17 +400,12 @@ bool Document::mailForm(CJS_Runtime* pRuntime,
return false;
}
int iLength = params.size();
- bool bUI = iLength > 0 ? pRuntime->ToBoolean(params[0].ToV8Value()) : true;
- WideString cTo =
- iLength > 1 ? pRuntime->ToWideString(params[1].ToV8Value()) : L"";
- WideString cCc =
- iLength > 2 ? pRuntime->ToWideString(params[2].ToV8Value()) : L"";
- WideString cBcc =
- iLength > 3 ? pRuntime->ToWideString(params[3].ToV8Value()) : L"";
- WideString cSubject =
- iLength > 4 ? pRuntime->ToWideString(params[4].ToV8Value()) : L"";
- WideString cMsg =
- iLength > 5 ? pRuntime->ToWideString(params[5].ToV8Value()) : L"";
+ bool bUI = iLength > 0 ? pRuntime->ToBoolean(params[0]) : true;
+ WideString cTo = iLength > 1 ? pRuntime->ToWideString(params[1]) : L"";
+ WideString cCc = iLength > 2 ? pRuntime->ToWideString(params[2]) : L"";
+ WideString cBcc = iLength > 3 ? pRuntime->ToWideString(params[3]) : L"";
+ WideString cSubject = iLength > 4 ? pRuntime->ToWideString(params[4]) : L"";
+ WideString cMsg = iLength > 5 ? pRuntime->ToWideString(params[5]) : L"";
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
ByteString sTextBuf = pInterForm->ExportFormToFDFTextBuf();
if (sTextBuf.GetLength() == 0)
@@ -430,7 +426,7 @@ bool Document::mailForm(CJS_Runtime* pRuntime,
}
bool Document::print(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (!m_pFormFillEnv) {
@@ -447,11 +443,11 @@ bool Document::print(CJS_Runtime* pRuntime,
bool bAnnotations = false;
int nlength = params.size();
if (nlength == 9) {
- if (params[8].ToV8Value()->IsObject()) {
- v8::Local<v8::Object> pObj = pRuntime->ToObject(params[8].ToV8Value());
+ if (params[8]->IsObject()) {
+ v8::Local<v8::Object> pObj = pRuntime->ToObject(params[8]);
if (CFXJS_Engine::GetObjDefnID(pObj) ==
CJS_PrintParamsObj::g_nObjDefnID) {
- v8::Local<v8::Object> pObj = pRuntime->ToObject(params[8].ToV8Value());
+ v8::Local<v8::Object> pObj = pRuntime->ToObject(params[8]);
CJS_Object* pJSObj =
static_cast<CJS_Object*>(pRuntime->GetObjectPrivate(pObj));
if (pJSObj) {
@@ -471,21 +467,21 @@ bool Document::print(CJS_Runtime* pRuntime,
}
} else {
if (nlength >= 1)
- bUI = pRuntime->ToBoolean(params[0].ToV8Value());
+ bUI = pRuntime->ToBoolean(params[0]);
if (nlength >= 2)
- nStart = pRuntime->ToInt32(params[1].ToV8Value());
+ nStart = pRuntime->ToInt32(params[1]);
if (nlength >= 3)
- nEnd = pRuntime->ToInt32(params[2].ToV8Value());
+ nEnd = pRuntime->ToInt32(params[2]);
if (nlength >= 4)
- bSilent = pRuntime->ToBoolean(params[3].ToV8Value());
+ bSilent = pRuntime->ToBoolean(params[3]);
if (nlength >= 5)
- bShrinkToFit = pRuntime->ToBoolean(params[4].ToV8Value());
+ bShrinkToFit = pRuntime->ToBoolean(params[4]);
if (nlength >= 6)
- bPrintAsImage = pRuntime->ToBoolean(params[5].ToV8Value());
+ bPrintAsImage = pRuntime->ToBoolean(params[5]);
if (nlength >= 7)
- bReverse = pRuntime->ToBoolean(params[6].ToV8Value());
+ bReverse = pRuntime->ToBoolean(params[6]);
if (nlength >= 8)
- bAnnotations = pRuntime->ToBoolean(params[7].ToV8Value());
+ bAnnotations = pRuntime->ToBoolean(params[7]);
}
if (m_pFormFillEnv) {
@@ -501,7 +497,7 @@ bool Document::print(CJS_Runtime* pRuntime,
// note: if the filed name is not rational, adobe is dumb for it.
bool Document::removeField(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() != 1) {
@@ -517,7 +513,7 @@ bool Document::removeField(CJS_Runtime* pRuntime,
sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION);
return false;
}
- WideString sFieldName = pRuntime->ToWideString(params[0].ToV8Value());
+ WideString sFieldName = pRuntime->ToWideString(params[0]);
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
std::vector<CPDFSDK_Annot::ObservedPtr> widgets;
pInterForm->GetWidgets(sFieldName, &widgets);
@@ -560,7 +556,7 @@ bool Document::removeField(CJS_Runtime* pRuntime,
// note: if the fields names r not rational, aodbe is dumb for it.
bool Document::resetForm(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (!m_pFormFillEnv) {
@@ -584,15 +580,14 @@ bool Document::resetForm(CJS_Runtime* pRuntime,
return true;
}
- if (params[0].ToV8Value()->IsString())
+ if (params[0]->IsString())
aName.SetElement(pRuntime, 0, params[0]);
else
- aName = CJS_Array(pRuntime->ToArray(params[0].ToV8Value()));
+ aName = CJS_Array(pRuntime->ToArray(params[0]));
std::vector<CPDF_FormField*> aFields;
for (int i = 0, isz = aName.GetLength(pRuntime); i < isz; ++i) {
- WideString swVal =
- pRuntime->ToWideString(aName.GetElement(pRuntime, i).ToV8Value());
+ WideString swVal = pRuntime->ToWideString(aName.GetElement(pRuntime, i));
for (int j = 0, jsz = pPDFForm->CountFields(swVal); j < jsz; ++j)
aFields.push_back(pPDFForm->GetField(j, swVal));
}
@@ -606,7 +601,7 @@ bool Document::resetForm(CJS_Runtime* pRuntime,
}
bool Document::saveAs(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not supported.
@@ -614,14 +609,14 @@ bool Document::saveAs(CJS_Runtime* pRuntime,
}
bool Document::syncAnnotScan(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool Document::submitForm(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
int nSize = params.size();
@@ -638,17 +633,16 @@ bool Document::submitForm(CJS_Runtime* pRuntime,
WideString strURL;
bool bFDF = true;
bool bEmpty = false;
- CJS_Value v(params[0]);
- if (v.ToV8Value()->IsString()) {
- strURL = pRuntime->ToWideString(params[0].ToV8Value());
+ if (params[0]->IsString()) {
+ strURL = pRuntime->ToWideString(params[0]);
if (nSize > 1)
- bFDF = pRuntime->ToBoolean(params[1].ToV8Value());
+ bFDF = pRuntime->ToBoolean(params[1]);
if (nSize > 2)
- bEmpty = pRuntime->ToBoolean(params[2].ToV8Value());
+ bEmpty = pRuntime->ToBoolean(params[2]);
if (nSize > 3)
- aFields = CJS_Array(pRuntime->ToArray(params[3].ToV8Value()));
- } else if (v.ToV8Value()->IsObject()) {
- v8::Local<v8::Object> pObj = pRuntime->ToObject(params[0].ToV8Value());
+ aFields = CJS_Array(pRuntime->ToArray(params[3]));
+ } else if (params[0]->IsObject()) {
+ v8::Local<v8::Object> pObj = pRuntime->ToObject(params[0]);
v8::Local<v8::Value> pValue = pRuntime->GetObjectProperty(pObj, L"cURL");
if (!pValue.IsEmpty())
strURL = pRuntime->ToWideString(pValue);
@@ -672,8 +666,7 @@ bool Document::submitForm(CJS_Runtime* pRuntime,
std::vector<CPDF_FormField*> fieldObjects;
for (int i = 0, sz = aFields.GetLength(pRuntime); i < sz; ++i) {
- WideString sName =
- pRuntime->ToWideString(aFields.GetElement(pRuntime, i).ToV8Value());
+ WideString sName = pRuntime->ToWideString(aFields.GetElement(pRuntime, i));
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
for (int j = 0, jsz = pPDFForm->CountFields(sName); j < jsz; ++j) {
CPDF_FormField* pField = pPDFForm->GetField(j, sName);
@@ -703,13 +696,13 @@ bool Document::get_bookmark_root(CJS_Runtime* pRuntime,
}
bool Document::set_bookmark_root(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
bool Document::mailDoc(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// TODO(tsepez): Check maximum number of allowed params.
@@ -721,20 +714,20 @@ bool Document::mailDoc(CJS_Runtime* pRuntime,
WideString cMsg = L"";
if (params.size() >= 1)
- bUI = pRuntime->ToBoolean(params[0].ToV8Value());
+ bUI = pRuntime->ToBoolean(params[0]);
if (params.size() >= 2)
- cTo = pRuntime->ToWideString(params[1].ToV8Value());
+ cTo = pRuntime->ToWideString(params[1]);
if (params.size() >= 3)
- cCc = pRuntime->ToWideString(params[2].ToV8Value());
+ cCc = pRuntime->ToWideString(params[2]);
if (params.size() >= 4)
- cBcc = pRuntime->ToWideString(params[3].ToV8Value());
+ cBcc = pRuntime->ToWideString(params[3]);
if (params.size() >= 5)
- cSubject = pRuntime->ToWideString(params[4].ToV8Value());
+ cSubject = pRuntime->ToWideString(params[4]);
if (params.size() >= 6)
- cMsg = pRuntime->ToWideString(params[5].ToV8Value());
+ cMsg = pRuntime->ToWideString(params[5]);
- if (params.size() >= 1 && params[0].ToV8Value()->IsObject()) {
- v8::Local<v8::Object> pObj = pRuntime->ToObject(params[0].ToV8Value());
+ if (params.size() >= 1 && params[0]->IsObject()) {
+ v8::Local<v8::Object> pObj = pRuntime->ToObject(params[0]);
bUI = pRuntime->ToBoolean(pRuntime->GetObjectProperty(pObj, L"bUI"));
cTo = pRuntime->ToWideString(pRuntime->GetObjectProperty(pObj, L"cTo"));
cCc = pRuntime->ToWideString(pRuntime->GetObjectProperty(pObj, L"cCc"));
@@ -759,7 +752,7 @@ bool Document::get_author(CJS_Runtime* pRuntime,
}
bool Document::set_author(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return setPropertyInternal(pRuntime, vp, "Author", sError);
}
@@ -829,7 +822,7 @@ bool Document::get_info(CJS_Runtime* pRuntime,
}
bool Document::set_info(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
*sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -854,7 +847,7 @@ bool Document::getPropertyInternal(CJS_Runtime* pRuntime,
}
bool Document::setPropertyInternal(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
const ByteString& propName,
WideString* sError) {
if (!m_pFormFillEnv) {
@@ -870,7 +863,7 @@ bool Document::setPropertyInternal(CJS_Runtime* pRuntime,
*sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION);
return false;
}
- WideString csProperty = pRuntime->ToWideString(vp.ToV8Value());
+ WideString csProperty = pRuntime->ToWideString(vp);
pDictionary->SetNewFor<CPDF_String>(propName, PDF_EncodeText(csProperty),
false);
m_pFormFillEnv->SetChangeMark();
@@ -884,7 +877,7 @@ bool Document::get_creation_date(CJS_Runtime* pRuntime,
}
bool Document::set_creation_date(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return setPropertyInternal(pRuntime, vp, "CreationDate", sError);
}
@@ -896,7 +889,7 @@ bool Document::get_creator(CJS_Runtime* pRuntime,
}
bool Document::set_creator(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return setPropertyInternal(pRuntime, vp, "Creator", sError);
}
@@ -913,7 +906,7 @@ bool Document::get_delay(CJS_Runtime* pRuntime,
}
bool Document::set_delay(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
if (!m_pFormFillEnv) {
*sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
@@ -925,7 +918,7 @@ bool Document::set_delay(CJS_Runtime* pRuntime,
return false;
}
- m_bDelay = pRuntime->ToBoolean(vp.ToV8Value());
+ m_bDelay = pRuntime->ToBoolean(vp);
if (m_bDelay) {
m_DelayData.clear();
return true;
@@ -946,7 +939,7 @@ bool Document::get_keywords(CJS_Runtime* pRuntime,
}
bool Document::set_keywords(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return setPropertyInternal(pRuntime, vp, "Keywords", sError);
}
@@ -958,7 +951,7 @@ bool Document::get_mod_date(CJS_Runtime* pRuntime,
}
bool Document::set_mod_date(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return setPropertyInternal(pRuntime, vp, "ModDate", sError);
}
@@ -970,7 +963,7 @@ bool Document::get_producer(CJS_Runtime* pRuntime,
}
bool Document::set_producer(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return setPropertyInternal(pRuntime, vp, "Producer", sError);
}
@@ -982,7 +975,7 @@ bool Document::get_subject(CJS_Runtime* pRuntime,
}
bool Document::set_subject(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return setPropertyInternal(pRuntime, vp, "Subject", sError);
}
@@ -998,7 +991,7 @@ bool Document::get_title(CJS_Runtime* pRuntime,
}
bool Document::set_title(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
if (!m_pFormFillEnv || !m_pFormFillEnv->GetUnderlyingDocument()) {
*sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
@@ -1019,7 +1012,7 @@ bool Document::get_num_pages(CJS_Runtime* pRuntime,
}
bool Document::set_num_pages(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
*sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -1034,7 +1027,7 @@ bool Document::get_external(CJS_Runtime* pRuntime,
}
bool Document::set_external(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
@@ -1047,7 +1040,7 @@ bool Document::get_filesize(CJS_Runtime* pRuntime,
}
bool Document::set_filesize(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
*sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -1060,7 +1053,7 @@ bool Document::get_mouse_x(CJS_Runtime* pRuntime,
}
bool Document::set_mouse_x(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
@@ -1072,7 +1065,7 @@ bool Document::get_mouse_y(CJS_Runtime* pRuntime,
}
bool Document::set_mouse_y(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
@@ -1089,7 +1082,7 @@ bool Document::get_URL(CJS_Runtime* pRuntime,
}
bool Document::set_URL(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
*sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -1103,9 +1096,9 @@ bool Document::get_base_URL(CJS_Runtime* pRuntime,
}
bool Document::set_base_URL(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
- m_cwBaseURL = pRuntime->ToWideString(vp.ToV8Value());
+ m_cwBaseURL = pRuntime->ToWideString(vp);
return true;
}
@@ -1123,7 +1116,7 @@ bool Document::get_calculate(CJS_Runtime* pRuntime,
}
bool Document::set_calculate(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
if (!m_pFormFillEnv) {
*sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
@@ -1131,7 +1124,7 @@ bool Document::set_calculate(CJS_Runtime* pRuntime,
}
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
- pInterForm->EnableCalculate(pRuntime->ToBoolean(vp.ToV8Value()));
+ pInterForm->EnableCalculate(pRuntime->ToBoolean(vp));
return true;
}
@@ -1160,7 +1153,7 @@ bool Document::get_document_file_name(CJS_Runtime* pRuntime,
}
bool Document::set_document_file_name(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
*sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -1179,7 +1172,7 @@ bool Document::get_path(CJS_Runtime* pRuntime,
}
bool Document::set_path(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
*sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -1192,7 +1185,7 @@ bool Document::get_page_window_rect(CJS_Runtime* pRuntime,
}
bool Document::set_page_window_rect(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
@@ -1204,34 +1197,34 @@ bool Document::get_layout(CJS_Runtime* pRuntime,
}
bool Document::set_layout(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
bool Document::addLink(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool Document::closeDoc(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool Document::getPageBox(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool Document::getAnnot(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() != 2) {
@@ -1243,8 +1236,8 @@ bool Document::getAnnot(CJS_Runtime* pRuntime,
return false;
}
- int nPageNo = pRuntime->ToInt32(params[0].ToV8Value());
- WideString swAnnotName = pRuntime->ToWideString(params[1].ToV8Value());
+ int nPageNo = pRuntime->ToInt32(params[0]);
+ WideString swAnnotName = pRuntime->ToWideString(params[1]);
CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetPageView(nPageNo);
if (!pPageView)
return false;
@@ -1278,7 +1271,7 @@ bool Document::getAnnot(CJS_Runtime* pRuntime,
}
bool Document::getAnnots(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (!m_pFormFillEnv) {
@@ -1311,9 +1304,10 @@ bool Document::getAnnots(CJS_Runtime* pRuntime,
static_cast<CJS_Annot*>(pRuntime->GetObjectPrivate(pObj));
Annot* pAnnot = static_cast<Annot*>(pJS_Annot->GetEmbedObject());
pAnnot->SetSDKAnnot(static_cast<CPDFSDK_BAAnnot*>(pSDKAnnotCur.Get()));
- annots.SetElement(
- pRuntime, i,
- pJS_Annot ? CJS_Value(pJS_Annot->ToV8Object()) : CJS_Value());
+ annots.SetElement(pRuntime, i,
+ pJS_Annot
+ ? v8::Local<v8::Value>(pJS_Annot->ToV8Object())
+ : v8::Local<v8::Value>());
}
}
if (annots.ToV8Value().IsEmpty())
@@ -1324,7 +1318,7 @@ bool Document::getAnnots(CJS_Runtime* pRuntime,
}
bool Document::getAnnot3D(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
vRet.Set(pRuntime->NewNull());
@@ -1332,21 +1326,21 @@ bool Document::getAnnot3D(CJS_Runtime* pRuntime,
}
bool Document::getAnnots3D(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool Document::getOCGs(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool Document::getLinks(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
@@ -1358,7 +1352,7 @@ bool Document::IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect) {
}
bool Document::addIcon(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() != 2) {
@@ -1366,19 +1360,19 @@ bool Document::addIcon(CJS_Runtime* pRuntime,
return false;
}
- WideString swIconName = pRuntime->ToWideString(params[0].ToV8Value());
- if (!params[1].ToV8Value()->IsObject()) {
+ WideString swIconName = pRuntime->ToWideString(params[0]);
+ if (!params[1]->IsObject()) {
sError = JSGetStringFromID(IDS_STRING_JSTYPEERROR);
return false;
}
- v8::Local<v8::Object> pJSIcon = pRuntime->ToObject(params[1].ToV8Value());
+ v8::Local<v8::Object> pJSIcon = pRuntime->ToObject(params[1]);
if (CFXJS_Engine::GetObjDefnID(pJSIcon) != CJS_Icon::g_nObjDefnID) {
sError = JSGetStringFromID(IDS_STRING_JSTYPEERROR);
return false;
}
- v8::Local<v8::Object> pObj = pRuntime->ToObject(params[1].ToV8Value());
+ v8::Local<v8::Object> pObj = pRuntime->ToObject(params[1]);
CJS_Object* obj = static_cast<CJS_Object*>(pRuntime->GetObjectPrivate(pObj));
if (!obj->GetEmbedObject()) {
sError = JSGetStringFromID(IDS_STRING_JSTYPEERROR);
@@ -1409,9 +1403,9 @@ bool Document::get_icons(CJS_Runtime* pRuntime,
static_cast<CJS_Icon*>(pRuntime->GetObjectPrivate(pObj));
Icon* pIcon = static_cast<Icon*>(pJS_Icon->GetEmbedObject());
pIcon->SetIconName(name);
- Icons.SetElement(
- pRuntime, i++,
- pJS_Icon ? CJS_Value(pJS_Icon->ToV8Object()) : CJS_Value());
+ Icons.SetElement(pRuntime, i++,
+ pJS_Icon ? v8::Local<v8::Value>(pJS_Icon->ToV8Object())
+ : v8::Local<v8::Value>());
}
if (Icons.ToV8Value().IsEmpty())
@@ -1423,14 +1417,14 @@ bool Document::get_icons(CJS_Runtime* pRuntime,
}
bool Document::set_icons(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
*sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
}
bool Document::getIcon(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() != 1) {
@@ -1438,7 +1432,7 @@ bool Document::getIcon(CJS_Runtime* pRuntime,
return false;
}
- WideString swIconName = pRuntime->ToWideString(params[0].ToV8Value());
+ WideString swIconName = pRuntime->ToWideString(params[0]);
auto it = std::find(m_IconNames.begin(), m_IconNames.end(), swIconName);
if (it == m_IconNames.end())
return false;
@@ -1458,7 +1452,7 @@ bool Document::getIcon(CJS_Runtime* pRuntime,
}
bool Document::removeIcon(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, no supported.
@@ -1466,7 +1460,7 @@ bool Document::removeIcon(CJS_Runtime* pRuntime,
}
bool Document::createDataObject(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not implemented.
@@ -1480,13 +1474,13 @@ bool Document::get_media(CJS_Runtime* pRuntime,
}
bool Document::set_media(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
bool Document::calculateNow(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (!m_pFormFillEnv) {
@@ -1510,13 +1504,13 @@ bool Document::get_collab(CJS_Runtime* pRuntime,
}
bool Document::set_collab(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
bool Document::getPageNthWord(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (!m_pFormFillEnv) {
@@ -1530,12 +1524,9 @@ bool Document::getPageNthWord(CJS_Runtime* pRuntime,
// TODO(tsepez): check maximum allowable params.
- int nPageNo =
- params.size() > 0 ? pRuntime->ToInt32(params[0].ToV8Value()) : 0;
- int nWordNo =
- params.size() > 1 ? pRuntime->ToInt32(params[1].ToV8Value()) : 0;
- bool bStrip =
- params.size() > 2 ? pRuntime->ToBoolean(params[2].ToV8Value()) : true;
+ int nPageNo = params.size() > 0 ? pRuntime->ToInt32(params[0]) : 0;
+ int nWordNo = params.size() > 1 ? pRuntime->ToInt32(params[1]) : 0;
+ bool bStrip = params.size() > 2 ? pRuntime->ToBoolean(params[2]) : true;
CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument();
if (!pDocument)
@@ -1576,10 +1567,11 @@ bool Document::getPageNthWord(CJS_Runtime* pRuntime,
return true;
}
-bool Document::getPageNthWordQuads(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool Document::getPageNthWordQuads(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -1592,7 +1584,7 @@ bool Document::getPageNthWordQuads(CJS_Runtime* pRuntime,
}
bool Document::getPageNumWords(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (!m_pFormFillEnv) {
@@ -1603,8 +1595,7 @@ bool Document::getPageNumWords(CJS_Runtime* pRuntime,
sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION);
return false;
}
- int nPageNo =
- params.size() > 0 ? pRuntime->ToInt32(params[0].ToV8Value()) : 0;
+ int nPageNo = params.size() > 0 ? pRuntime->ToInt32(params[0]) : 0;
CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument();
if (nPageNo < 0 || nPageNo >= pDocument->GetPageCount()) {
sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR);
@@ -1629,7 +1620,7 @@ bool Document::getPageNumWords(CJS_Runtime* pRuntime,
}
bool Document::getPrintParams(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
v8::Local<v8::Object> pRetObj =
@@ -1721,7 +1712,7 @@ bool Document::get_zoom(CJS_Runtime* pRuntime,
}
bool Document::set_zoom(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
@@ -1732,13 +1723,13 @@ bool Document::get_zoom_type(CJS_Runtime* pRuntime,
return true;
}
bool Document::set_zoom_type(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
bool Document::deletePages(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, no supported.
@@ -1746,7 +1737,7 @@ bool Document::deletePages(CJS_Runtime* pRuntime,
}
bool Document::extractPages(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not supported.
@@ -1754,7 +1745,7 @@ bool Document::extractPages(CJS_Runtime* pRuntime,
}
bool Document::insertPages(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not supported.
@@ -1762,7 +1753,7 @@ bool Document::insertPages(CJS_Runtime* pRuntime,
}
bool Document::replacePages(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not supported.
@@ -1770,7 +1761,7 @@ bool Document::replacePages(CJS_Runtime* pRuntime,
}
bool Document::getURL(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not supported.
@@ -1778,7 +1769,7 @@ bool Document::getURL(CJS_Runtime* pRuntime,
}
bool Document::gotoNamedDest(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() != 1) {
@@ -1790,7 +1781,7 @@ bool Document::gotoNamedDest(CJS_Runtime* pRuntime,
return false;
}
- WideString wideName = pRuntime->ToWideString(params[0].ToV8Value());
+ WideString wideName = pRuntime->ToWideString(params[0]);
CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument();
if (!pDocument)
return false;
diff --git a/fpdfsdk/javascript/Document.h b/fpdfsdk/javascript/Document.h
index 49ac75b746..4b49d7f616 100644
--- a/fpdfsdk/javascript/Document.h
+++ b/fpdfsdk/javascript/Document.h
@@ -51,329 +51,339 @@ class Document : public CJS_EmbedObj {
~Document() override;
bool get_ADBE(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_ADBE(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_ADBE(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_author(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_author(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_base_URL(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_base_URL(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_bookmark_root(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_bookmark_root(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_calculate(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_calculate(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_collab(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_collab(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_creation_date(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_creation_date(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_creator(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_creator(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_delay(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_delay(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_dirty(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_dirty(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_document_file_name(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_document_file_name(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_external(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_external(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_filesize(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_filesize(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_icons(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_icons(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_info(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_info(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_info(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_keywords(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_keywords(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_layout(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_layout(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_media(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_media(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_mod_date(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_mod_date(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_mouse_x(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_mouse_x(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_mouse_y(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_mouse_y(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_num_fields(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_num_fields(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_num_pages(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_num_pages(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_page_num(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_page_num(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_page_window_rect(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_page_window_rect(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_path(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_path(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_path(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_producer(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_producer(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_subject(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_subject(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_title(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_title(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_zoom(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_zoom(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_zoom(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_zoom_type(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_zoom_type(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_URL(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_URL(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_URL(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool addAnnot(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool addField(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool addLink(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool addIcon(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool calculateNow(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool closeDoc(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool createDataObject(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool deletePages(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool exportAsText(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool exportAsFDF(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool exportAsXFDF(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool extractPages(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getAnnot(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getAnnots(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getAnnot3D(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getAnnots3D(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getField(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getIcon(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getLinks(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getNthFieldName(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getOCGs(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getPageBox(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getPageNthWord(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getPageNthWordQuads(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getPageNumWords(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getPrintParams(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getURL(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool gotoNamedDest(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool importAnFDF(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool importAnXFDF(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool importTextData(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool insertPages(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool mailForm(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool print(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool removeField(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool replacePages(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool resetForm(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool saveAs(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool submitForm(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool syncAnnotScan(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool mailDoc(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool removeIcon(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
@@ -395,7 +405,7 @@ class Document : public CJS_EmbedObj {
const ByteString& propName,
WideString* sError);
bool setPropertyInternal(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
const ByteString& propName,
WideString* sError);
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp
index 93017c4da9..d530ef8f56 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -416,7 +416,7 @@ bool Field::get_alignment(CJS_Runtime* pRuntime,
}
bool Field::set_alignment(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -464,15 +464,14 @@ bool Field::get_border_style(CJS_Runtime* pRuntime,
}
bool Field::set_border_style(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
if (!m_bCanSet)
return false;
- ByteString byte_str =
- ByteString::FromUnicode(pRuntime->ToWideString(vp.ToV8Value()));
+ ByteString byte_str = ByteString::FromUnicode(pRuntime->ToWideString(vp));
if (m_bDelay) {
AddDelay_String(FP_BORDERSTYLE, byte_str);
} else {
@@ -562,7 +561,7 @@ bool Field::get_button_align_x(CJS_Runtime* pRuntime,
}
bool Field::set_button_align_x(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -596,7 +595,7 @@ bool Field::get_button_align_y(CJS_Runtime* pRuntime,
}
bool Field::set_button_align_y(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -624,7 +623,7 @@ bool Field::get_button_fit_bounds(CJS_Runtime* pRuntime,
}
bool Field::set_button_fit_bounds(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -652,7 +651,7 @@ bool Field::get_button_position(CJS_Runtime* pRuntime,
}
bool Field::set_button_position(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -681,7 +680,7 @@ bool Field::get_button_scale_how(CJS_Runtime* pRuntime,
}
bool Field::set_button_scale_how(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -724,7 +723,7 @@ bool Field::get_button_scale_when(CJS_Runtime* pRuntime,
}
bool Field::set_button_scale_when(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -753,7 +752,7 @@ bool Field::get_calc_order_index(CJS_Runtime* pRuntime,
}
bool Field::set_calc_order_index(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -777,7 +776,7 @@ bool Field::get_char_limit(CJS_Runtime* pRuntime,
}
bool Field::set_char_limit(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -800,7 +799,7 @@ bool Field::get_comb(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool Field::set_comb(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -827,7 +826,7 @@ bool Field::get_commit_on_sel_change(CJS_Runtime* pRuntime,
}
bool Field::set_commit_on_sel_change(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -858,9 +857,8 @@ bool Field::get_current_value_indices(CJS_Runtime* pRuntime,
CJS_Array SelArray;
for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) {
- SelArray.SetElement(
- pRuntime, i,
- CJS_Value(pRuntime->NewNumber(pFormField->GetSelectedIndex(i))));
+ SelArray.SetElement(pRuntime, i,
+ pRuntime->NewNumber(pFormField->GetSelectedIndex(i)));
}
if (SelArray.ToV8Value().IsEmpty())
vp->Set(pRuntime->NewArray());
@@ -871,19 +869,18 @@ bool Field::get_current_value_indices(CJS_Runtime* pRuntime,
}
bool Field::set_current_value_indices(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
if (!m_bCanSet)
return false;
std::vector<uint32_t> array;
- if (vp.ToV8Value()->IsNumber()) {
- array.push_back(pRuntime->ToInt32(vp.ToV8Value()));
- } else if (!vp.ToV8Value().IsEmpty() && vp.ToV8Value()->IsArray()) {
- CJS_Array SelArray(pRuntime->ToArray(vp.ToV8Value()));
+ if (vp->IsNumber()) {
+ array.push_back(pRuntime->ToInt32(vp));
+ } else if (!vp.IsEmpty() && vp->IsArray()) {
+ CJS_Array SelArray(pRuntime->ToArray(vp));
for (int i = 0, sz = SelArray.GetLength(pRuntime); i < sz; i++)
- array.push_back(
- pRuntime->ToInt32(SelArray.GetElement(pRuntime, i).ToV8Value()));
+ array.push_back(pRuntime->ToInt32(SelArray.GetElement(pRuntime, i)));
}
if (m_bDelay) {
@@ -928,7 +925,7 @@ bool Field::get_default_style(CJS_Runtime* pRuntime,
}
bool Field::set_default_style(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -953,7 +950,7 @@ bool Field::get_default_value(CJS_Runtime* pRuntime,
}
bool Field::set_default_value(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -978,7 +975,7 @@ bool Field::get_do_not_scroll(CJS_Runtime* pRuntime,
}
bool Field::set_do_not_scroll(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -1005,7 +1002,7 @@ bool Field::get_do_not_spell_check(CJS_Runtime* pRuntime,
}
bool Field::set_do_not_spell_check(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -1028,12 +1025,12 @@ bool Field::get_delay(CJS_Runtime* pRuntime,
}
bool Field::set_delay(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
if (!m_bCanSet)
return false;
- SetDelay(pRuntime->ToBoolean(vp.ToV8Value()));
+ SetDelay(pRuntime->ToBoolean(vp));
return true;
}
@@ -1070,16 +1067,16 @@ bool Field::get_display(CJS_Runtime* pRuntime,
}
bool Field::set_display(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
if (!m_bCanSet)
return false;
if (m_bDelay) {
- AddDelay_Int(FP_DISPLAY, pRuntime->ToInt32(vp.ToV8Value()));
+ AddDelay_Int(FP_DISPLAY, pRuntime->ToInt32(vp));
} else {
Field::SetDisplay(m_pFormFillEnv.Get(), m_FieldName, m_nFormControlIndex,
- pRuntime->ToInt32(vp.ToV8Value()));
+ pRuntime->ToInt32(vp));
}
return true;
}
@@ -1126,7 +1123,7 @@ bool Field::get_doc(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool Field::set_doc(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -1148,7 +1145,7 @@ bool Field::get_editable(CJS_Runtime* pRuntime,
}
bool Field::set_editable(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return m_bCanSet;
}
@@ -1172,8 +1169,7 @@ bool Field::get_export_values(CJS_Runtime* pRuntime,
CPDF_FormControl* pFormControl = pFormField->GetControl(i);
ExportValuesArray.SetElement(
pRuntime, i,
- CJS_Value(
- pRuntime->NewString(pFormControl->GetExportValue().c_str())));
+ pRuntime->NewString(pFormControl->GetExportValue().c_str()));
}
} else {
if (m_nFormControlIndex >= pFormField->CountControls())
@@ -1186,7 +1182,7 @@ bool Field::get_export_values(CJS_Runtime* pRuntime,
ExportValuesArray.SetElement(
pRuntime, 0,
- CJS_Value(pRuntime->NewString(pFormControl->GetExportValue().c_str())));
+ pRuntime->NewString(pFormControl->GetExportValue().c_str()));
}
if (ExportValuesArray.ToV8Value().IsEmpty())
@@ -1198,7 +1194,7 @@ bool Field::get_export_values(CJS_Runtime* pRuntime,
}
bool Field::set_export_values(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
@@ -1210,7 +1206,7 @@ bool Field::set_export_values(CJS_Runtime* pRuntime,
return false;
}
- return m_bCanSet && !vp.ToV8Value().IsEmpty() && vp.ToV8Value()->IsArray();
+ return m_bCanSet && !vp.IsEmpty() && vp->IsArray();
}
bool Field::get_file_select(CJS_Runtime* pRuntime,
@@ -1230,7 +1226,7 @@ bool Field::get_file_select(CJS_Runtime* pRuntime,
}
bool Field::set_file_select(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
@@ -1290,14 +1286,14 @@ bool Field::get_fill_color(CJS_Runtime* pRuntime,
}
bool Field::set_fill_color(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
if (!m_bCanSet)
return false;
- if (vp.ToV8Value().IsEmpty() || !vp.ToV8Value()->IsArray())
+ if (vp.IsEmpty() || !vp->IsArray())
return false;
return true;
}
@@ -1325,16 +1321,16 @@ bool Field::get_hidden(CJS_Runtime* pRuntime,
}
bool Field::set_hidden(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
if (!m_bCanSet)
return false;
if (m_bDelay) {
- AddDelay_Bool(FP_HIDDEN, pRuntime->ToBoolean(vp.ToV8Value()));
+ AddDelay_Bool(FP_HIDDEN, pRuntime->ToBoolean(vp));
} else {
Field::SetHidden(m_pFormFillEnv.Get(), m_FieldName, m_nFormControlIndex,
- pRuntime->ToBoolean(vp.ToV8Value()));
+ pRuntime->ToBoolean(vp));
}
return true;
}
@@ -1386,7 +1382,7 @@ bool Field::get_highlight(CJS_Runtime* pRuntime,
}
bool Field::set_highlight(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -1419,16 +1415,16 @@ bool Field::get_line_width(CJS_Runtime* pRuntime,
}
bool Field::set_line_width(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
if (!m_bCanSet)
return false;
if (m_bDelay) {
- AddDelay_Int(FP_LINEWIDTH, pRuntime->ToInt32(vp.ToV8Value()));
+ AddDelay_Int(FP_LINEWIDTH, pRuntime->ToInt32(vp));
} else {
Field::SetLineWidth(m_pFormFillEnv.Get(), m_FieldName, m_nFormControlIndex,
- pRuntime->ToInt32(vp.ToV8Value()));
+ pRuntime->ToInt32(vp));
}
return true;
}
@@ -1491,7 +1487,7 @@ bool Field::get_multiline(CJS_Runtime* pRuntime,
}
bool Field::set_multiline(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -1515,7 +1511,7 @@ bool Field::get_multiple_selection(CJS_Runtime* pRuntime,
}
bool Field::set_multiple_selection(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -1531,7 +1527,7 @@ bool Field::get_name(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool Field::set_name(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -1554,7 +1550,7 @@ bool Field::get_num_items(CJS_Runtime* pRuntime,
}
bool Field::set_num_items(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -1588,9 +1584,9 @@ bool Field::get_page(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
if (!pPageView)
return false;
- PageArray.SetElement(pRuntime, i,
- CJS_Value(pRuntime->NewNumber(
- static_cast<int32_t>(pPageView->GetPageIndex()))));
+ PageArray.SetElement(
+ pRuntime, i,
+ pRuntime->NewNumber(static_cast<int32_t>(pPageView->GetPageIndex())));
++i;
}
@@ -1603,7 +1599,7 @@ bool Field::get_page(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool Field::set_page(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
*sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -1628,7 +1624,7 @@ bool Field::get_password(CJS_Runtime* pRuntime,
}
bool Field::set_password(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -1653,7 +1649,7 @@ bool Field::get_print(CJS_Runtime* pRuntime,
}
bool Field::set_print(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
@@ -1670,7 +1666,7 @@ bool Field::set_print(CJS_Runtime* pRuntime,
if (CPDFSDK_Widget* pWidget =
pInterForm->GetWidget(pFormField->GetControl(i))) {
uint32_t dwFlags = pWidget->GetFlags();
- if (pRuntime->ToBoolean(vp.ToV8Value()))
+ if (pRuntime->ToBoolean(vp))
dwFlags |= ANNOTFLAG_PRINT;
else
dwFlags &= ~ANNOTFLAG_PRINT;
@@ -1694,7 +1690,7 @@ bool Field::set_print(CJS_Runtime* pRuntime,
pFormField->GetControl(m_nFormControlIndex)) {
if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) {
uint32_t dwFlags = pWidget->GetFlags();
- if (pRuntime->ToBoolean(vp.ToV8Value()))
+ if (pRuntime->ToBoolean(vp))
dwFlags |= ANNOTFLAG_PRINT;
else
dwFlags &= ~ANNOTFLAG_PRINT;
@@ -1728,7 +1724,7 @@ bool Field::get_radios_in_unison(CJS_Runtime* pRuntime,
}
bool Field::set_radios_in_unison(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
@@ -1749,7 +1745,7 @@ bool Field::get_readonly(CJS_Runtime* pRuntime,
}
bool Field::set_readonly(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
@@ -1771,18 +1767,14 @@ bool Field::get_rect(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
CFX_FloatRect crRect = pWidget->GetRect();
CJS_Array rcArray;
- rcArray.SetElement(
- pRuntime, 0,
- CJS_Value(pRuntime->NewNumber(static_cast<int32_t>(crRect.left))));
- rcArray.SetElement(
- pRuntime, 1,
- CJS_Value(pRuntime->NewNumber(static_cast<int32_t>(crRect.top))));
- rcArray.SetElement(
- pRuntime, 2,
- CJS_Value(pRuntime->NewNumber(static_cast<int32_t>(crRect.right))));
- rcArray.SetElement(
- pRuntime, 3,
- CJS_Value(pRuntime->NewNumber(static_cast<int32_t>(crRect.bottom))));
+ rcArray.SetElement(pRuntime, 0,
+ pRuntime->NewNumber(static_cast<int32_t>(crRect.left)));
+ rcArray.SetElement(pRuntime, 1,
+ pRuntime->NewNumber(static_cast<int32_t>(crRect.top)));
+ rcArray.SetElement(pRuntime, 2,
+ pRuntime->NewNumber(static_cast<int32_t>(crRect.right)));
+ rcArray.SetElement(pRuntime, 3,
+ pRuntime->NewNumber(static_cast<int32_t>(crRect.bottom)));
if (rcArray.ToV8Value().IsEmpty())
vp->Set(pRuntime->NewArray());
@@ -1793,23 +1785,23 @@ bool Field::get_rect(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool Field::set_rect(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
if (!m_bCanSet)
return false;
- if (vp.ToV8Value().IsEmpty() || !vp.ToV8Value()->IsArray())
+ if (vp.IsEmpty() || !vp->IsArray())
return false;
- CJS_Array rcArray(pRuntime->ToArray(vp.ToV8Value()));
+ CJS_Array rcArray(pRuntime->ToArray(vp));
float pArray[4];
- pArray[0] = static_cast<float>(
- pRuntime->ToInt32(rcArray.GetElement(pRuntime, 0).ToV8Value()));
- pArray[1] = static_cast<float>(
- pRuntime->ToInt32(rcArray.GetElement(pRuntime, 1).ToV8Value()));
- pArray[2] = static_cast<float>(
- pRuntime->ToInt32(rcArray.GetElement(pRuntime, 2).ToV8Value()));
- pArray[3] = static_cast<float>(
- pRuntime->ToInt32(rcArray.GetElement(pRuntime, 3).ToV8Value()));
+ pArray[0] =
+ static_cast<float>(pRuntime->ToInt32(rcArray.GetElement(pRuntime, 0)));
+ pArray[1] =
+ static_cast<float>(pRuntime->ToInt32(rcArray.GetElement(pRuntime, 1)));
+ pArray[2] =
+ static_cast<float>(pRuntime->ToInt32(rcArray.GetElement(pRuntime, 2)));
+ pArray[3] =
+ static_cast<float>(pRuntime->ToInt32(rcArray.GetElement(pRuntime, 3)));
CFX_FloatRect crRect(pArray);
if (m_bDelay) {
@@ -1898,7 +1890,7 @@ bool Field::get_required(CJS_Runtime* pRuntime,
}
bool Field::set_required(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
@@ -1926,7 +1918,7 @@ bool Field::get_rich_text(CJS_Runtime* pRuntime,
}
bool Field::set_rich_text(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -1939,7 +1931,7 @@ bool Field::get_rich_value(CJS_Runtime* pRuntime,
}
bool Field::set_rich_value(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
@@ -1963,7 +1955,7 @@ bool Field::get_rotation(CJS_Runtime* pRuntime,
}
bool Field::set_rotation(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -2013,11 +2005,11 @@ bool Field::get_stroke_color(CJS_Runtime* pRuntime,
}
bool Field::set_stroke_color(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
if (!m_bCanSet)
return false;
- if (vp.ToV8Value().IsEmpty() || !vp.ToV8Value()->IsArray())
+ if (vp.IsEmpty() || !vp->IsArray())
return false;
return true;
}
@@ -2070,7 +2062,7 @@ bool Field::get_style(CJS_Runtime* pRuntime,
}
bool Field::set_style(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -2083,7 +2075,7 @@ bool Field::get_submit_name(CJS_Runtime* pRuntime,
}
bool Field::set_submit_name(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
@@ -2127,11 +2119,11 @@ bool Field::get_text_color(CJS_Runtime* pRuntime,
}
bool Field::set_text_color(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
if (!m_bCanSet)
return false;
- if (vp.ToV8Value().IsEmpty() || !vp.ToV8Value()->IsArray())
+ if (vp.IsEmpty() || !vp->IsArray())
return false;
return true;
}
@@ -2166,14 +2158,13 @@ bool Field::get_text_font(CJS_Runtime* pRuntime,
}
bool Field::set_text_font(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
if (!m_bCanSet)
return false;
- return !ByteString::FromUnicode(pRuntime->ToWideString(vp.ToV8Value()))
- .IsEmpty();
+ return !ByteString::FromUnicode(pRuntime->ToWideString(vp)).IsEmpty();
}
bool Field::get_text_size(CJS_Runtime* pRuntime,
@@ -2199,7 +2190,7 @@ bool Field::get_text_size(CJS_Runtime* pRuntime,
}
bool Field::set_text_size(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -2244,7 +2235,7 @@ bool Field::get_type(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool Field::set_type(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -2263,7 +2254,7 @@ bool Field::get_user_name(CJS_Runtime* pRuntime,
}
bool Field::set_user_name(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
ASSERT(m_pFormFillEnv);
return m_bCanSet;
@@ -2287,17 +2278,15 @@ bool Field::get_value(CJS_Runtime* pRuntime,
case FIELDTYPE_LISTBOX: {
if (pFormField->CountSelectedItems() > 1) {
CJS_Array ValueArray;
- CJS_Value ElementValue;
+ v8::Local<v8::Value> ElementValue;
int iIndex;
for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) {
iIndex = pFormField->GetSelectedIndex(i);
- ElementValue = CJS_Value(
- pRuntime->NewString(pFormField->GetOptionValue(iIndex).c_str()));
- if (wcslen(
- pRuntime->ToWideString(ElementValue.ToV8Value()).c_str()) ==
- 0) {
- ElementValue = CJS_Value(pRuntime->NewString(
- pFormField->GetOptionLabel(iIndex).c_str()));
+ ElementValue =
+ pRuntime->NewString(pFormField->GetOptionValue(iIndex).c_str());
+ if (wcslen(pRuntime->ToWideString(ElementValue).c_str()) == 0) {
+ ElementValue =
+ pRuntime->NewString(pFormField->GetOptionLabel(iIndex).c_str());
}
ValueArray.SetElement(pRuntime, i, ElementValue);
}
@@ -2336,20 +2325,20 @@ bool Field::get_value(CJS_Runtime* pRuntime,
}
bool Field::set_value(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
if (!m_bCanSet)
return false;
std::vector<WideString> strArray;
- if (!vp.ToV8Value().IsEmpty() && vp.ToV8Value()->IsArray()) {
- CJS_Array ValueArray(pRuntime->ToArray(vp.ToV8Value()));
+ if (!vp.IsEmpty() && vp->IsArray()) {
+ CJS_Array ValueArray(pRuntime->ToArray(vp));
for (int i = 0, sz = ValueArray.GetLength(pRuntime); i < sz; i++) {
- CJS_Value ElementValue(ValueArray.GetElement(pRuntime, i));
- strArray.push_back(pRuntime->ToWideString(ElementValue.ToV8Value()));
+ strArray.push_back(
+ pRuntime->ToWideString(ValueArray.GetElement(pRuntime, i)));
}
} else {
- strArray.push_back(pRuntime->ToWideString(vp.ToV8Value()));
+ strArray.push_back(pRuntime->ToWideString(vp));
}
if (m_bDelay) {
@@ -2460,15 +2449,16 @@ bool Field::get_value_as_string(CJS_Runtime* pRuntime,
}
bool Field::set_value_as_string(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
-bool Field::browseForFileToSubmit(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool Field::browseForFileToSubmit(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -2487,13 +2477,13 @@ bool Field::browseForFileToSubmit(CJS_Runtime* pRuntime,
}
bool Field::buttonGetCaption(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
int nface = 0;
int iSize = params.size();
if (iSize >= 1)
- nface = pRuntime->ToInt32(params[0].ToV8Value());
+ nface = pRuntime->ToInt32(params[0]);
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
@@ -2523,11 +2513,11 @@ bool Field::buttonGetCaption(CJS_Runtime* pRuntime,
}
bool Field::buttonGetIcon(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() >= 1) {
- int nFace = pRuntime->ToInt32(params[0].ToV8Value());
+ int nFace = pRuntime->ToInt32(params[0]);
if (nFace < 0 || nFace > 2)
return false;
}
@@ -2557,28 +2547,28 @@ bool Field::buttonGetIcon(CJS_Runtime* pRuntime,
}
bool Field::buttonImportIcon(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool Field::buttonSetCaption(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return false;
}
bool Field::buttonSetIcon(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return false;
}
bool Field::checkThisBox(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
int iSize = params.size();
@@ -2588,10 +2578,10 @@ bool Field::checkThisBox(CJS_Runtime* pRuntime,
if (!m_bCanSet)
return false;
- int nWidget = pRuntime->ToInt32(params[0].ToV8Value());
+ int nWidget = pRuntime->ToInt32(params[0]);
bool bCheckit = true;
if (iSize >= 2)
- bCheckit = pRuntime->ToBoolean(params[1].ToV8Value());
+ bCheckit = pRuntime->ToBoolean(params[1]);
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
@@ -2615,14 +2605,14 @@ bool Field::checkThisBox(CJS_Runtime* pRuntime,
}
bool Field::clearItems(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool Field::defaultIsChecked(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (!m_bCanSet)
@@ -2632,7 +2622,7 @@ bool Field::defaultIsChecked(CJS_Runtime* pRuntime,
if (iSize < 1)
return false;
- int nWidget = pRuntime->ToInt32(params[0].ToV8Value());
+ int nWidget = pRuntime->ToInt32(params[0]);
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -2649,14 +2639,14 @@ bool Field::defaultIsChecked(CJS_Runtime* pRuntime,
}
bool Field::deleteItemAt(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool Field::getArray(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
@@ -2686,9 +2676,10 @@ bool Field::getArray(CJS_Runtime* pRuntime,
static_cast<CJS_Field*>(pRuntime->GetObjectPrivate(pObj));
Field* pField = static_cast<Field*>(pJSField->GetEmbedObject());
pField->AttachField(m_pJSDoc, *pStr);
- FormFieldArray.SetElement(
- pRuntime, j++,
- pJSField ? CJS_Value(pJSField->ToV8Object()) : CJS_Value());
+ FormFieldArray.SetElement(pRuntime, j++,
+ pJSField
+ ? v8::Local<v8::Value>(pJSField->ToV8Object())
+ : v8::Local<v8::Value>());
}
if (FormFieldArray.ToV8Value().IsEmpty())
@@ -2700,17 +2691,17 @@ bool Field::getArray(CJS_Runtime* pRuntime,
}
bool Field::getItemAt(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
int iSize = params.size();
int nIdx = -1;
if (iSize >= 1)
- nIdx = pRuntime->ToInt32(params[0].ToV8Value());
+ nIdx = pRuntime->ToInt32(params[0]);
bool bExport = true;
if (iSize >= 2)
- bExport = pRuntime->ToBoolean(params[1].ToV8Value());
+ bExport = pRuntime->ToBoolean(params[1]);
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
@@ -2740,26 +2731,26 @@ bool Field::getItemAt(CJS_Runtime* pRuntime,
}
bool Field::getLock(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return false;
}
bool Field::insertItemAt(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool Field::isBoxChecked(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
int nIndex = -1;
if (params.size() >= 1)
- nIndex = pRuntime->ToInt32(params[0].ToV8Value());
+ nIndex = pRuntime->ToInt32(params[0]);
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
@@ -2777,12 +2768,12 @@ bool Field::isBoxChecked(CJS_Runtime* pRuntime,
}
bool Field::isDefaultChecked(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
int nIndex = -1;
if (params.size() >= 1)
- nIndex = pRuntime->ToInt32(params[0].ToV8Value());
+ nIndex = pRuntime->ToInt32(params[0]);
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
@@ -2800,14 +2791,14 @@ bool Field::isDefaultChecked(CJS_Runtime* pRuntime,
}
bool Field::setAction(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool Field::setFocus(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
@@ -2852,56 +2843,59 @@ bool Field::setFocus(CJS_Runtime* pRuntime,
}
bool Field::setItems(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool Field::setLock(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return false;
}
-bool Field::signatureGetModifications(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool Field::signatureGetModifications(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
return false;
}
-bool Field::signatureGetSeedValue(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool Field::signatureGetSeedValue(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
return false;
}
bool Field::signatureInfo(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return false;
}
-bool Field::signatureSetSeedValue(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool Field::signatureSetSeedValue(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
return false;
}
bool Field::signatureSign(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return false;
}
bool Field::signatureValidate(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return false;
@@ -2915,7 +2909,7 @@ bool Field::get_source(CJS_Runtime* pRuntime,
}
bool Field::set_source(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
diff --git a/fpdfsdk/javascript/Field.h b/fpdfsdk/javascript/Field.h
index 8dcdbc6618..8ea8459866 100644
--- a/fpdfsdk/javascript/Field.h
+++ b/fpdfsdk/javascript/Field.h
@@ -55,396 +55,409 @@ class Field : public CJS_EmbedObj {
bool get_alignment(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_alignment(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_border_style(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_border_style(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_button_align_x(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_button_align_x(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_button_align_y(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_button_align_y(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_button_fit_bounds(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_button_fit_bounds(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_button_position(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_button_position(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_button_scale_how(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_button_scale_how(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_button_scale_when(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_button_scale_when(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_calc_order_index(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_calc_order_index(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_char_limit(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_char_limit(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_comb(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_comb(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_comb(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_commit_on_sel_change(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_commit_on_sel_change(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_current_value_indices(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_current_value_indices(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_default_style(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_default_style(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_default_value(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_default_value(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_do_not_scroll(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_do_not_scroll(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_do_not_spell_check(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_do_not_spell_check(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_delay(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_delay(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_display(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_display(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_doc(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_doc(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_doc(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_editable(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_editable(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_export_values(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_export_values(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_file_select(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_file_select(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_fill_color(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_fill_color(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_hidden(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_hidden(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_highlight(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_highlight(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_line_width(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_line_width(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_multiline(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_multiline(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_multiple_selection(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_multiple_selection(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_name(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_name(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_name(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_num_items(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_num_items(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_page(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_page(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_page(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_password(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_password(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_print(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_print(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_radios_in_unison(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_radios_in_unison(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_readonly(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_readonly(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_rect(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_rect(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_rect(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_required(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_required(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_rich_text(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_rich_text(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_rich_value(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_rich_value(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_rotation(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_rotation(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_stroke_color(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_stroke_color(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_style(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_style(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_submit_name(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_submit_name(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_text_color(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_text_color(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_text_font(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_text_font(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_text_size(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_text_size(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_type(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_type(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_type(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_user_name(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_user_name(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_value(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_value(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_value_as_string(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_value_as_string(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_source(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_source(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool browseForFileToSubmit(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool buttonGetCaption(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool buttonGetIcon(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool buttonImportIcon(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool buttonSetCaption(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool buttonSetIcon(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool checkThisBox(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool clearItems(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool defaultIsChecked(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool deleteItemAt(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getArray(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getItemAt(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool getLock(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool insertItemAt(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool isBoxChecked(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool isDefaultChecked(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool setAction(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool setFocus(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool setItems(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool setLock(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
- bool signatureGetModifications(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError);
+ bool signatureGetModifications(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError);
bool signatureGetSeedValue(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool signatureInfo(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool signatureSetSeedValue(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool signatureSign(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool signatureValidate(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
diff --git a/fpdfsdk/javascript/Icon.cpp b/fpdfsdk/javascript/Icon.cpp
index 53f549d2f2..dbd3e64cb1 100644
--- a/fpdfsdk/javascript/Icon.cpp
+++ b/fpdfsdk/javascript/Icon.cpp
@@ -31,7 +31,7 @@ bool Icon::get_name(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool Icon::set_name(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
diff --git a/fpdfsdk/javascript/Icon.h b/fpdfsdk/javascript/Icon.h
index 261ad639f9..89c185a56d 100644
--- a/fpdfsdk/javascript/Icon.h
+++ b/fpdfsdk/javascript/Icon.h
@@ -17,7 +17,9 @@ class Icon : public CJS_EmbedObj {
~Icon() override;
bool get_name(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_name(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_name(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
WideString GetIconName() const { return m_swIconName; }
void SetIconName(WideString name) { m_swIconName = name; }
diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h
index 46469d7dec..819cc9c25e 100644
--- a/fpdfsdk/javascript/JS_Define.h
+++ b/fpdfsdk/javascript/JS_Define.h
@@ -61,7 +61,8 @@ void JSPropGetter(const char* prop_name_string,
info.GetReturnValue().Set(prop_value.ToV8Value());
}
-template <class C, bool (C::*M)(CJS_Runtime*, const CJS_Value&, WideString*)>
+template <class C,
+ bool (C::*M)(CJS_Runtime*, v8::Local<v8::Value>, WideString*)>
void JSPropSetter(const char* prop_name_string,
const char* class_name_string,
v8::Local<v8::String> property,
@@ -80,8 +81,7 @@ void JSPropSetter(const char* prop_name_string,
C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
WideString sError;
- CJS_Value prop_value(value);
- if (!(pObj->*M)(pRuntime, prop_value, &sError)) {
+ if (!(pObj->*M)(pRuntime, value, &sError)) {
pRuntime->Error(
JSFormatErrorString(class_name_string, prop_name_string, sError));
}
@@ -103,7 +103,7 @@ void JSPropSetter(const char* prop_name_string,
template <class C,
bool (C::*M)(CJS_Runtime*,
- const std::vector<CJS_Value>&,
+ const std::vector<v8::Local<v8::Value>>&,
CJS_Value&,
WideString&)>
void JSMethod(const char* method_name_string,
@@ -114,9 +114,9 @@ void JSMethod(const char* method_name_string,
if (!pRuntime)
return;
- std::vector<CJS_Value> parameters;
+ std::vector<v8::Local<v8::Value>> parameters;
for (unsigned int i = 0; i < (unsigned int)info.Length(); i++)
- parameters.push_back(CJS_Value(info[i]));
+ parameters.push_back(info[i]);
CJS_Object* pJSObj =
static_cast<CJS_Object*>(pRuntime->GetObjectPrivate(info.Holder()));
diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp
index ddea0a4caa..bac338ad66 100644
--- a/fpdfsdk/javascript/JS_Value.cpp
+++ b/fpdfsdk/javascript/JS_Value.cpp
@@ -202,20 +202,20 @@ CJS_Array::CJS_Array(const CJS_Array& other) = default;
CJS_Array::~CJS_Array() {}
-CJS_Value CJS_Array::GetElement(CJS_Runtime* pRuntime, unsigned index) const {
+v8::Local<v8::Value> CJS_Array::GetElement(CJS_Runtime* pRuntime,
+ unsigned index) const {
if (!m_pArray.IsEmpty())
- return CJS_Value(
- v8::Local<v8::Value>(pRuntime->GetArrayElement(m_pArray, index)));
+ return {pRuntime->GetArrayElement(m_pArray, index)};
return {};
}
void CJS_Array::SetElement(CJS_Runtime* pRuntime,
unsigned index,
- const CJS_Value& value) {
+ v8::Local<v8::Value> value) {
if (m_pArray.IsEmpty())
m_pArray = pRuntime->NewArray();
- pRuntime->PutArrayElement(m_pArray, index, value.ToV8Value());
+ pRuntime->PutArrayElement(m_pArray, index, value);
}
int CJS_Array::GetLength(CJS_Runtime* pRuntime) const {
@@ -393,33 +393,34 @@ double JS_MakeDate(double day, double time) {
return day * 86400000 + time;
}
-std::vector<CJS_Value> ExpandKeywordParams(
+std::vector<v8::Local<v8::Value>> ExpandKeywordParams(
CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& originals,
+ const std::vector<v8::Local<v8::Value>>& originals,
size_t nKeywords,
...) {
ASSERT(nKeywords);
- std::vector<CJS_Value> result(nKeywords, CJS_Value());
+ std::vector<v8::Local<v8::Value>> result(nKeywords, v8::Local<v8::Value>());
size_t size = std::min(originals.size(), nKeywords);
for (size_t i = 0; i < size; ++i)
result[i] = originals[i];
- if (originals.size() != 1 || !originals[0].ToV8Value()->IsObject() ||
- originals[0].ToV8Value()->IsArray()) {
+ if (originals.size() != 1 || !originals[0]->IsObject() ||
+ originals[0]->IsArray()) {
return result;
}
- v8::Local<v8::Object> pObj = pRuntime->ToObject(originals[0].ToV8Value());
- result[0] = CJS_Value(); // Make unknown.
+ result[0] = v8::Local<v8::Value>(); // Make unknown.
+ v8::Local<v8::Object> pObj = pRuntime->ToObject(originals[0]);
va_list ap;
va_start(ap, nKeywords);
for (size_t i = 0; i < nKeywords; ++i) {
const wchar_t* property = va_arg(ap, const wchar_t*);
v8::Local<v8::Value> v8Value = pRuntime->GetObjectProperty(pObj, property);
if (!v8Value->IsUndefined())
- result[i] = CJS_Value(v8Value);
+ result[i] = v8Value;
}
va_end(ap);
+
return result;
}
diff --git a/fpdfsdk/javascript/JS_Value.h b/fpdfsdk/javascript/JS_Value.h
index d098812361..b97a7061e3 100644
--- a/fpdfsdk/javascript/JS_Value.h
+++ b/fpdfsdk/javascript/JS_Value.h
@@ -43,10 +43,10 @@ class CJS_Array {
int GetLength(CJS_Runtime* pRuntime) const;
// These two calls may re-enter JS (and hence invalidate objects).
- CJS_Value GetElement(CJS_Runtime* pRuntime, unsigned index) const;
+ v8::Local<v8::Value> GetElement(CJS_Runtime* pRuntime, unsigned index) const;
void SetElement(CJS_Runtime* pRuntime,
unsigned index,
- const CJS_Value& value);
+ v8::Local<v8::Value> value);
v8::Local<v8::Value> ToV8Value() const { return m_pArray; }
@@ -102,9 +102,9 @@ double JS_MakeDate(double day, double time);
// names as wchar_t string literals corresponding to each positional argument.
// The result will always contain |nKeywords| value, with unspecified ones
// being set to type VT_unknown.
-std::vector<CJS_Value> ExpandKeywordParams(
+std::vector<v8::Local<v8::Value>> ExpandKeywordParams(
CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& originals,
+ const std::vector<v8::Local<v8::Value>>& originals,
size_t nKeywords,
...);
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index 867a265b80..c0441a82a3 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -112,18 +112,21 @@ ByteString CalculateString(double dValue,
#endif
// NOLINTNEXTLINE(whitespace/parens)
-template <bool (
- *F)(CJS_Runtime*, const std::vector<CJS_Value>&, CJS_Value&, WideString&)>
+template <bool (*F)(CJS_Runtime*,
+ const std::vector<v8::Local<v8::Value>>&,
+ CJS_Value&,
+ WideString&)>
void JSGlobalFunc(const char* func_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
CJS_Runtime* pRuntime =
CJS_Runtime::CurrentRuntimeFromIsolate(info.GetIsolate());
if (!pRuntime)
return;
- std::vector<CJS_Value> parameters;
- for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) {
- parameters.push_back(CJS_Value(info[i]));
- }
+
+ std::vector<v8::Local<v8::Value>> parameters;
+ for (unsigned int i = 0; i < (unsigned int)info.Length(); i++)
+ parameters.push_back(info[i]);
+
CJS_Value valueRes;
WideString sError;
if (!(*F)(pRuntime, parameters, valueRes, sError)) {
@@ -246,11 +249,11 @@ double CJS_PublicMethods::AF_Simple(const wchar_t* sFuction,
}
CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(CJS_Runtime* pRuntime,
- CJS_Value val) {
- if (!val.ToV8Value().IsEmpty() && val.ToV8Value()->IsArray())
- return CJS_Array(pRuntime->ToArray(val.ToV8Value()));
+ v8::Local<v8::Value> val) {
+ if (!val.IsEmpty() && val->IsArray())
+ return CJS_Array(pRuntime->ToArray(val));
- WideString wsStr = pRuntime->ToWideString(val.ToV8Value());
+ WideString wsStr = pRuntime->ToWideString(val);
ByteString t = ByteString::FromUnicode(wsStr);
const char* p = t.c_str();
@@ -261,9 +264,8 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(CJS_Runtime* pRuntime,
while (*p) {
const char* pTemp = strchr(p, ch);
if (!pTemp) {
- StrArray.SetElement(
- pRuntime, nIndex,
- CJS_Value(pRuntime->NewString(StrTrim(ByteString(p)).c_str())));
+ StrArray.SetElement(pRuntime, nIndex,
+ pRuntime->NewString(StrTrim(ByteString(p)).c_str()));
break;
}
@@ -271,9 +273,8 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(CJS_Runtime* pRuntime,
strncpy(pSub, p, pTemp - p);
*(pSub + (pTemp - p)) = '\0';
- StrArray.SetElement(
- pRuntime, nIndex,
- CJS_Value(pRuntime->NewString(StrTrim(ByteString(pSub)).c_str())));
+ StrArray.SetElement(pRuntime, nIndex,
+ pRuntime->NewString(StrTrim(ByteString(pSub)).c_str()));
delete[] pSub;
nIndex++;
@@ -807,10 +808,11 @@ WideString CJS_PublicMethods::MakeFormatDate(double dDate,
// function AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrency,
// bCurrencyPrepend)
-bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFNumber_Format(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
#if _FX_OS_ != _FX_OS_ANDROID_
if (params.size() != 6) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
@@ -827,12 +829,12 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime,
if (strValue.IsEmpty())
return true;
- int iDec = pRuntime->ToInt32(params[0].ToV8Value());
- int iSepStyle = pRuntime->ToInt32(params[1].ToV8Value());
- int iNegStyle = pRuntime->ToInt32(params[2].ToV8Value());
+ int iDec = pRuntime->ToInt32(params[0]);
+ int iSepStyle = pRuntime->ToInt32(params[1]);
+ int iNegStyle = pRuntime->ToInt32(params[2]);
// params[3] is iCurrStyle, it's not used.
- WideString wstrCurrency = pRuntime->ToWideString(params[4].ToV8Value());
- bool bCurrencyPrepend = pRuntime->ToBoolean(params[5].ToV8Value());
+ WideString wstrCurrency = pRuntime->ToWideString(params[4]);
+ bool bCurrencyPrepend = pRuntime->ToBoolean(params[5]);
if (iDec < 0)
iDec = -iDec;
@@ -898,36 +900,21 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime,
if (iNegStyle == 1 || iNegStyle == 3) {
if (Field* fTarget = pEvent->Target_Field()) {
CJS_Array arColor;
- CJS_Value vColElm(pRuntime->NewString(L"RGB"));
- arColor.SetElement(pRuntime, 0, vColElm);
-
- vColElm = CJS_Value(pRuntime->NewNumber(1));
- arColor.SetElement(pRuntime, 1, vColElm);
-
- vColElm = CJS_Value(pRuntime->NewNumber(0));
- arColor.SetElement(pRuntime, 2, vColElm);
- arColor.SetElement(pRuntime, 3, vColElm);
-
- CJS_Value vProp;
- if (arColor.ToV8Value().IsEmpty())
- vProp.Set(pRuntime->NewArray());
- else
- vProp.Set(arColor.ToV8Value());
-
- fTarget->set_text_color(pRuntime, vProp, &sError); // red
+ arColor.SetElement(pRuntime, 0, pRuntime->NewString(L"RGB"));
+ arColor.SetElement(pRuntime, 1, pRuntime->NewNumber(1));
+ arColor.SetElement(pRuntime, 2, pRuntime->NewNumber(0));
+ arColor.SetElement(pRuntime, 3, pRuntime->NewNumber(0));
+ fTarget->set_text_color(pRuntime, arColor.ToV8Value(), &sError); // red
}
}
} else {
if (iNegStyle == 1 || iNegStyle == 3) {
if (Field* fTarget = pEvent->Target_Field()) {
CJS_Array arColor;
- CJS_Value vColElm(pRuntime->NewString(L"RGB"));
- arColor.SetElement(pRuntime, 0, vColElm);
-
- vColElm = CJS_Value(pRuntime->NewNumber(0));
- arColor.SetElement(pRuntime, 1, vColElm);
- arColor.SetElement(pRuntime, 2, vColElm);
- arColor.SetElement(pRuntime, 3, vColElm);
+ arColor.SetElement(pRuntime, 0, pRuntime->NewString(L"RGB"));
+ arColor.SetElement(pRuntime, 1, pRuntime->NewNumber(0));
+ arColor.SetElement(pRuntime, 2, pRuntime->NewNumber(0));
+ arColor.SetElement(pRuntime, 3, pRuntime->NewNumber(0));
CJS_Value vProp;
fTarget->get_text_color(pRuntime, &vProp, &sError);
@@ -935,15 +922,8 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime,
CFX_Color crProp = color::ConvertArrayToPWLColor(
pRuntime, CJS_Array(pRuntime->ToArray(vProp.ToV8Value())));
CFX_Color crColor = color::ConvertArrayToPWLColor(pRuntime, arColor);
- if (crColor != crProp) {
- CJS_Value value;
- if (arColor.ToV8Value().IsEmpty())
- value.Set(pRuntime->NewArray());
- else
- value.Set(arColor.ToV8Value());
-
- fTarget->set_text_color(pRuntime, value, &sError);
- }
+ if (crColor != crProp)
+ fTarget->set_text_color(pRuntime, arColor.ToV8Value(), &sError);
}
}
}
@@ -953,10 +933,11 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime,
// function AFNumber_Keystroke(nDec, sepStyle, negStyle, currStyle, strCurrency,
// bCurrencyPrepend)
-bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFNumber_Keystroke(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() < 2)
return false;
@@ -998,7 +979,7 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime,
}
}
- int iSepStyle = pRuntime->ToInt32(params[1].ToV8Value());
+ int iSepStyle = pRuntime->ToInt32(params[1]);
if (iSepStyle < 0 || iSepStyle > 3)
iSepStyle = 0;
const wchar_t cSep = iSepStyle < 2 ? L'.' : L',';
@@ -1048,10 +1029,11 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime,
}
// function AFPercent_Format(nDec, sepStyle)
-bool CJS_PublicMethods::AFPercent_Format(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFPercent_Format(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
#if _FX_OS_ != _FX_OS_ANDROID_
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
@@ -1068,11 +1050,11 @@ bool CJS_PublicMethods::AFPercent_Format(CJS_Runtime* pRuntime,
if (strValue.IsEmpty())
return true;
- int iDec = pRuntime->ToInt32(params[0].ToV8Value());
+ int iDec = pRuntime->ToInt32(params[0]);
if (iDec < 0)
iDec = -iDec;
- int iSepStyle = pRuntime->ToInt32(params[1].ToV8Value());
+ int iSepStyle = pRuntime->ToInt32(params[1]);
if (iSepStyle < 0 || iSepStyle > 3)
iSepStyle = 0;
@@ -1141,17 +1123,18 @@ bool CJS_PublicMethods::AFPercent_Format(CJS_Runtime* pRuntime,
// AFPercent_Keystroke(nDec, sepStyle)
bool CJS_PublicMethods::AFPercent_Keystroke(
CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return AFNumber_Keystroke(pRuntime, params, vRet, sError);
}
// function AFDate_FormatEx(cFormat)
-bool CJS_PublicMethods::AFDate_FormatEx(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFDate_FormatEx(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1167,7 +1150,7 @@ bool CJS_PublicMethods::AFDate_FormatEx(CJS_Runtime* pRuntime,
if (strValue.IsEmpty())
return true;
- WideString sFormat = pRuntime->ToWideString(params[0].ToV8Value());
+ WideString sFormat = pRuntime->ToWideString(params[0]);
double dDate = 0.0f;
if (strValue.Contains(L"GMT")) {
@@ -1246,10 +1229,11 @@ double CJS_PublicMethods::MakeInterDate(const WideString& strValue) {
}
// AFDate_KeystrokeEx(cFormat)
-bool CJS_PublicMethods::AFDate_KeystrokeEx(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFDate_KeystrokeEx(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() != 1) {
sError = L"AFDate_KeystrokeEx's parameters' size r not correct";
return false;
@@ -1265,7 +1249,7 @@ bool CJS_PublicMethods::AFDate_KeystrokeEx(CJS_Runtime* pRuntime,
if (strValue.IsEmpty())
return true;
- WideString sFormat = pRuntime->ToWideString(params[0].ToV8Value());
+ WideString sFormat = pRuntime->ToWideString(params[0]);
bool bWrongFormat = false;
double dRet = MakeRegularDate(strValue, sFormat, &bWrongFormat);
if (bWrongFormat || std::isnan(dRet)) {
@@ -1280,16 +1264,17 @@ bool CJS_PublicMethods::AFDate_KeystrokeEx(CJS_Runtime* pRuntime,
return true;
}
-bool CJS_PublicMethods::AFDate_Format(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFDate_Format(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- int iIndex = pRuntime->ToInt32(params[0].ToV8Value());
+ int iIndex = pRuntime->ToInt32(params[0]);
const wchar_t* cFormats[] = {L"m/d",
L"m/d/yy",
L"mm/dd/yy",
@@ -1308,22 +1293,23 @@ bool CJS_PublicMethods::AFDate_Format(CJS_Runtime* pRuntime,
if (iIndex < 0 || (static_cast<size_t>(iIndex) >= FX_ArraySize(cFormats)))
iIndex = 0;
- std::vector<CJS_Value> newParams;
- newParams.push_back(CJS_Value(pRuntime->NewString(cFormats[iIndex])));
+ std::vector<v8::Local<v8::Value>> newParams;
+ newParams.push_back(pRuntime->NewString(cFormats[iIndex]));
return AFDate_FormatEx(pRuntime, newParams, vRet, sError);
}
// AFDate_KeystrokeEx(cFormat)
-bool CJS_PublicMethods::AFDate_Keystroke(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFDate_Keystroke(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- int iIndex = pRuntime->ToInt32(params[0].ToV8Value());
+ int iIndex = pRuntime->ToInt32(params[0]);
const wchar_t* cFormats[] = {L"m/d",
L"m/d/yy",
L"mm/dd/yy",
@@ -1342,73 +1328,78 @@ bool CJS_PublicMethods::AFDate_Keystroke(CJS_Runtime* pRuntime,
if (iIndex < 0 || (static_cast<size_t>(iIndex) >= FX_ArraySize(cFormats)))
iIndex = 0;
- std::vector<CJS_Value> newParams;
- newParams.push_back(CJS_Value(pRuntime->NewString(cFormats[iIndex])));
+ std::vector<v8::Local<v8::Value>> newParams;
+ newParams.push_back(pRuntime->NewString(cFormats[iIndex]));
return AFDate_KeystrokeEx(pRuntime, newParams, vRet, sError);
}
// function AFTime_Format(ptf)
-bool CJS_PublicMethods::AFTime_Format(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFTime_Format(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- int iIndex = pRuntime->ToInt32(params[0].ToV8Value());
+ int iIndex = pRuntime->ToInt32(params[0]);
const wchar_t* cFormats[] = {L"HH:MM", L"h:MM tt", L"HH:MM:ss",
L"h:MM:ss tt"};
if (iIndex < 0 || (static_cast<size_t>(iIndex) >= FX_ArraySize(cFormats)))
iIndex = 0;
- std::vector<CJS_Value> newParams;
- newParams.push_back(CJS_Value(pRuntime->NewString(cFormats[iIndex])));
+ std::vector<v8::Local<v8::Value>> newParams;
+ newParams.push_back(pRuntime->NewString(cFormats[iIndex]));
return AFDate_FormatEx(pRuntime, newParams, vRet, sError);
}
-bool CJS_PublicMethods::AFTime_Keystroke(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFTime_Keystroke(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- int iIndex = pRuntime->ToInt32(params[0].ToV8Value());
+ int iIndex = pRuntime->ToInt32(params[0]);
const wchar_t* cFormats[] = {L"HH:MM", L"h:MM tt", L"HH:MM:ss",
L"h:MM:ss tt"};
if (iIndex < 0 || (static_cast<size_t>(iIndex) >= FX_ArraySize(cFormats)))
iIndex = 0;
- std::vector<CJS_Value> newParams;
- newParams.push_back(CJS_Value(pRuntime->NewString(cFormats[iIndex])));
+ std::vector<v8::Local<v8::Value>> newParams;
+ newParams.push_back(pRuntime->NewString(cFormats[iIndex]));
return AFDate_KeystrokeEx(pRuntime, newParams, vRet, sError);
}
-bool CJS_PublicMethods::AFTime_FormatEx(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFTime_FormatEx(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
return AFDate_FormatEx(pRuntime, params, vRet, sError);
}
-bool CJS_PublicMethods::AFTime_KeystrokeEx(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFTime_KeystrokeEx(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
return AFDate_KeystrokeEx(pRuntime, params, vRet, sError);
}
// function AFSpecial_Format(psf)
-bool CJS_PublicMethods::AFSpecial_Format(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFSpecial_Format(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1421,7 +1412,7 @@ bool CJS_PublicMethods::AFSpecial_Format(CJS_Runtime* pRuntime,
WideString wsSource = pEvent->Value();
WideString wsFormat;
- switch (pRuntime->ToInt32(params[0].ToV8Value())) {
+ switch (pRuntime->ToInt32(params[0])) {
case 0:
wsFormat = L"99999";
break;
@@ -1446,7 +1437,7 @@ bool CJS_PublicMethods::AFSpecial_Format(CJS_Runtime* pRuntime,
// function AFSpecial_KeystrokeEx(mask)
bool CJS_PublicMethods::AFSpecial_KeystrokeEx(
CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() < 1) {
@@ -1460,7 +1451,7 @@ bool CJS_PublicMethods::AFSpecial_KeystrokeEx(
return false;
WideString& valEvent = pEvent->Value();
- WideString wstrMask = pRuntime->ToWideString(params[0].ToV8Value());
+ WideString wstrMask = pRuntime->ToWideString(params[0]);
if (wstrMask.IsEmpty())
return true;
@@ -1529,7 +1520,7 @@ bool CJS_PublicMethods::AFSpecial_KeystrokeEx(
// function AFSpecial_Keystroke(psf)
bool CJS_PublicMethods::AFSpecial_Keystroke(
CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() != 1) {
@@ -1543,7 +1534,7 @@ bool CJS_PublicMethods::AFSpecial_Keystroke(
return false;
const char* cFormat = "";
- switch (pRuntime->ToInt32(params[0].ToV8Value())) {
+ switch (pRuntime->ToInt32(params[0])) {
case 0:
cFormat = "99999";
break;
@@ -1561,15 +1552,16 @@ bool CJS_PublicMethods::AFSpecial_Keystroke(
break;
}
- std::vector<CJS_Value> params2;
- params2.push_back(CJS_Value(pRuntime->NewString(cFormat)));
+ std::vector<v8::Local<v8::Value>> params2;
+ params2.push_back(pRuntime->NewString(cFormat));
return AFSpecial_KeystrokeEx(pRuntime, params2, vRet, sError);
}
-bool CJS_PublicMethods::AFMergeChange(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFMergeChange(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1606,17 +1598,18 @@ bool CJS_PublicMethods::AFMergeChange(CJS_Runtime* pRuntime,
return true;
}
-bool CJS_PublicMethods::AFParseDateEx(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFParseDateEx(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- WideString sValue = pRuntime->ToWideString(params[0].ToV8Value());
- WideString sFormat = pRuntime->ToWideString(params[1].ToV8Value());
+ WideString sValue = pRuntime->ToWideString(params[0]);
+ WideString sFormat = pRuntime->ToWideString(params[1]);
double dDate = MakeRegularDate(sValue, sFormat, nullptr);
if (std::isnan(dDate)) {
WideString swMsg;
@@ -1630,33 +1623,34 @@ bool CJS_PublicMethods::AFParseDateEx(CJS_Runtime* pRuntime,
return true;
}
-bool CJS_PublicMethods::AFSimple(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFSimple(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() != 3) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- vRet = CJS_Value(pRuntime->NewNumber(static_cast<double>(
- AF_Simple(pRuntime->ToWideString(params[0].ToV8Value()).c_str(),
- pRuntime->ToDouble(params[1].ToV8Value()),
- pRuntime->ToDouble(params[2].ToV8Value())))));
+ vRet = CJS_Value(pRuntime->NewNumber(static_cast<double>(AF_Simple(
+ pRuntime->ToWideString(params[0]).c_str(), pRuntime->ToDouble(params[1]),
+ pRuntime->ToDouble(params[2])))));
return true;
}
-bool CJS_PublicMethods::AFMakeNumber(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFMakeNumber(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- WideString ws = pRuntime->ToWideString(params[0].ToV8Value());
+ WideString ws = pRuntime->ToWideString(params[0]);
ws.Replace(L",", L".");
vRet =
CJS_Value(pRuntime->MaybeCoerceToNumber(pRuntime->NewString(ws.c_str())));
@@ -1665,18 +1659,18 @@ bool CJS_PublicMethods::AFMakeNumber(CJS_Runtime* pRuntime,
return true;
}
-bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFSimple_Calculate(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CJS_Value params1(params[1]);
- if ((params[1].ToV8Value().IsEmpty() || !params[1].ToV8Value()->IsArray()) &&
- !params1.ToV8Value()->IsString()) {
+ if ((params[1].IsEmpty() || !params[1]->IsArray()) &&
+ !params[1]->IsString()) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
@@ -1685,15 +1679,15 @@ bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime,
pRuntime->GetFormFillEnv()->GetInterForm();
CPDF_InterForm* pInterForm = pReaderInterForm->GetInterForm();
- WideString sFunction = pRuntime->ToWideString(params[0].ToV8Value());
+ WideString sFunction = pRuntime->ToWideString(params[0]);
double dValue = wcscmp(sFunction.c_str(), L"PRD") == 0 ? 1.0 : 0.0;
- CJS_Array FieldNameArray = AF_MakeArrayFromList(pRuntime, params1);
+ CJS_Array FieldNameArray = AF_MakeArrayFromList(pRuntime, params[0]);
int nFieldsCount = 0;
for (int i = 0, isz = FieldNameArray.GetLength(pRuntime); i < isz; i++) {
- WideString wsFieldName = pRuntime->ToWideString(
- FieldNameArray.GetElement(pRuntime, i).ToV8Value());
+ WideString wsFieldName =
+ pRuntime->ToWideString(FieldNameArray.GetElement(pRuntime, i));
for (int j = 0, jsz = pInterForm->CountFields(wsFieldName); j < jsz; j++) {
if (CPDF_FormField* pFormField = pInterForm->GetField(j, wsFieldName)) {
@@ -1765,10 +1759,11 @@ bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime,
/* This function validates the current event to ensure that its value is
** within the specified range. */
-bool CJS_PublicMethods::AFRange_Validate(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFRange_Validate(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() != 4) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1782,25 +1777,25 @@ bool CJS_PublicMethods::AFRange_Validate(CJS_Runtime* pRuntime,
return true;
double dEentValue = atof(ByteString::FromUnicode(pEvent->Value()).c_str());
- bool bGreaterThan = pRuntime->ToBoolean(params[0].ToV8Value());
- double dGreaterThan = pRuntime->ToDouble(params[1].ToV8Value());
- bool bLessThan = pRuntime->ToBoolean(params[2].ToV8Value());
- double dLessThan = pRuntime->ToDouble(params[3].ToV8Value());
+ bool bGreaterThan = pRuntime->ToBoolean(params[0]);
+ double dGreaterThan = pRuntime->ToDouble(params[1]);
+ bool bLessThan = pRuntime->ToBoolean(params[2]);
+ double dLessThan = pRuntime->ToDouble(params[3]);
WideString swMsg;
if (bGreaterThan && bLessThan) {
if (dEentValue < dGreaterThan || dEentValue > dLessThan)
swMsg.Format(JSGetStringFromID(IDS_STRING_JSRANGE1).c_str(),
- pRuntime->ToWideString(params[1].ToV8Value()).c_str(),
- pRuntime->ToWideString(params[3].ToV8Value()).c_str());
+ pRuntime->ToWideString(params[1]).c_str(),
+ pRuntime->ToWideString(params[3]).c_str());
} else if (bGreaterThan) {
if (dEentValue < dGreaterThan)
swMsg.Format(JSGetStringFromID(IDS_STRING_JSRANGE2).c_str(),
- pRuntime->ToWideString(params[1].ToV8Value()).c_str());
+ pRuntime->ToWideString(params[1]).c_str());
} else if (bLessThan) {
if (dEentValue > dLessThan)
swMsg.Format(JSGetStringFromID(IDS_STRING_JSRANGE3).c_str(),
- pRuntime->ToWideString(params[3].ToV8Value()).c_str());
+ pRuntime->ToWideString(params[3]).c_str());
}
if (!swMsg.IsEmpty()) {
@@ -1810,16 +1805,17 @@ bool CJS_PublicMethods::AFRange_Validate(CJS_Runtime* pRuntime,
return true;
}
-bool CJS_PublicMethods::AFExtractNums(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool CJS_PublicMethods::AFExtractNums(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- WideString str = pRuntime->ToWideString(params[0].ToV8Value());
+ WideString str = pRuntime->ToWideString(params[0]);
if (str.GetLength() > 0 && (str[0] == L'.' || str[0] == L','))
str = L"0" + str;
@@ -1830,15 +1826,13 @@ bool CJS_PublicMethods::AFExtractNums(CJS_Runtime* pRuntime,
if (std::iswdigit(wc)) {
sPart += wc;
} else if (sPart.GetLength() > 0) {
- nums.SetElement(pRuntime, nIndex,
- CJS_Value(pRuntime->NewString(sPart.c_str())));
+ nums.SetElement(pRuntime, nIndex, pRuntime->NewString(sPart.c_str()));
sPart = L"";
nIndex++;
}
}
if (sPart.GetLength() > 0)
- nums.SetElement(pRuntime, nIndex,
- CJS_Value(pRuntime->NewString(sPart.c_str())));
+ nums.SetElement(pRuntime, nIndex, pRuntime->NewString(sPart.c_str()));
if (nums.GetLength(pRuntime) > 0) {
if (nums.ToV8Value().IsEmpty())
diff --git a/fpdfsdk/javascript/PublicMethods.h b/fpdfsdk/javascript/PublicMethods.h
index 1d30832fb7..60659bad0d 100644
--- a/fpdfsdk/javascript/PublicMethods.h
+++ b/fpdfsdk/javascript/PublicMethods.h
@@ -19,91 +19,98 @@ class CJS_PublicMethods : public CJS_Object {
~CJS_PublicMethods() override {}
static bool AFNumber_Format(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
- static bool AFNumber_Keystroke(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError);
+ static bool AFNumber_Keystroke(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError);
static bool AFPercent_Format(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
- static bool AFPercent_Keystroke(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError);
+ static bool AFPercent_Keystroke(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError);
static bool AFDate_FormatEx(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
- static bool AFDate_KeystrokeEx(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError);
+ static bool AFDate_KeystrokeEx(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError);
static bool AFDate_Format(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
static bool AFDate_Keystroke(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
static bool AFTime_FormatEx(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
- WideString& sError); //
- static bool AFTime_KeystrokeEx(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError);
+ WideString& sError);
+ static bool AFTime_KeystrokeEx(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError);
static bool AFTime_Format(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
static bool AFTime_Keystroke(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
static bool AFSpecial_Format(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
- static bool AFSpecial_Keystroke(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError);
- static bool AFSpecial_KeystrokeEx(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError); //
+ static bool AFSpecial_Keystroke(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError);
+ static bool AFSpecial_KeystrokeEx(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError); //
static bool AFSimple(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
static bool AFMakeNumber(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
- static bool AFSimple_Calculate(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError);
+ static bool AFSimple_Calculate(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError);
static bool AFRange_Validate(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
static bool AFMergeChange(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
static bool AFParseDateEx(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
static bool AFExtractNums(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
@@ -175,7 +182,8 @@ class CJS_PublicMethods : public CJS_Object {
static double AF_Simple(const wchar_t* sFuction,
double dValue1,
double dValue2);
- static CJS_Array AF_MakeArrayFromList(CJS_Runtime* pRuntime, CJS_Value val);
+ static CJS_Array AF_MakeArrayFromList(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> val);
};
#endif // FPDFSDK_JAVASCRIPT_PUBLICMETHODS_H_
diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp
index cb07a0ee7b..ca440f64b3 100644
--- a/fpdfsdk/javascript/app.cpp
+++ b/fpdfsdk/javascript/app.cpp
@@ -228,9 +228,9 @@ bool app::get_active_docs(CJS_Runtime* pRuntime,
pJSDocument = static_cast<CJS_Document*>(pRuntime->GetObjectPrivate(pObj));
CJS_Array aDocs;
- aDocs.SetElement(
- pRuntime, 0,
- pJSDocument ? CJS_Value(pJSDocument->ToV8Object()) : CJS_Value());
+ aDocs.SetElement(pRuntime, 0,
+ pJSDocument ? v8::Local<v8::Value>(pJSDocument->ToV8Object())
+ : v8::Local<v8::Value>());
if (aDocs.GetLength(pRuntime) > 0) {
if (aDocs.ToV8Value().IsEmpty())
vp->Set(pRuntime->NewArray());
@@ -244,7 +244,7 @@ bool app::get_active_docs(CJS_Runtime* pRuntime,
}
bool app::set_active_docs(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -257,9 +257,9 @@ bool app::get_calculate(CJS_Runtime* pRuntime,
}
bool app::set_calculate(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
- m_bCalculate = pRuntime->ToBoolean(vp.ToV8Value());
+ m_bCalculate = pRuntime->ToBoolean(vp);
pRuntime->GetFormFillEnv()->GetInterForm()->EnableCalculate(m_bCalculate);
return true;
}
@@ -272,7 +272,7 @@ bool app::get_forms_version(CJS_Runtime* pRuntime,
}
bool app::set_forms_version(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -285,7 +285,7 @@ bool app::get_viewer_type(CJS_Runtime* pRuntime,
}
bool app::set_viewer_type(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -298,7 +298,7 @@ bool app::get_viewer_variation(CJS_Runtime* pRuntime,
}
bool app::set_viewer_variation(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -318,7 +318,7 @@ bool app::get_viewer_version(CJS_Runtime* pRuntime,
}
bool app::set_viewer_version(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -342,7 +342,7 @@ bool app::get_platform(CJS_Runtime* pRuntime,
}
bool app::set_platform(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -366,7 +366,7 @@ bool app::get_language(CJS_Runtime* pRuntime,
}
bool app::set_language(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -376,7 +376,7 @@ bool app::set_language(CJS_Runtime* pRuntime,
// note:
// CFDF_Document * CPDFSDK_FormFillEnvironment::NewFDF();
bool app::newFDF(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
@@ -389,20 +389,20 @@ bool app::newFDF(CJS_Runtime* pRuntime,
// bUserConv);
bool app::openFDF(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool app::alert(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
- std::vector<CJS_Value> newParams = ExpandKeywordParams(
+ std::vector<v8::Local<v8::Value>> newParams = ExpandKeywordParams(
pRuntime, params, 4, L"cMsg", L"nIcon", L"nType", L"cTitle");
- if (!IsTypeKnown(newParams[0].ToV8Value())) {
+ if (!IsTypeKnown(newParams[0])) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
@@ -414,32 +414,31 @@ bool app::alert(CJS_Runtime* pRuntime,
}
WideString swMsg;
- if (newParams[0].ToV8Value()->IsArray()) {
- CJS_Array carray(pRuntime->ToArray(newParams[0].ToV8Value()));
+ if (newParams[0]->IsArray()) {
+ CJS_Array carray(pRuntime->ToArray(newParams[0]));
swMsg = L"[";
for (int i = 0; i < carray.GetLength(pRuntime); ++i) {
if (i)
swMsg += L", ";
- CJS_Value element(carray.GetElement(pRuntime, i));
- swMsg += pRuntime->ToWideString(element.ToV8Value());
+ swMsg += pRuntime->ToWideString(carray.GetElement(pRuntime, i));
}
swMsg += L"]";
} else {
- swMsg = pRuntime->ToWideString(newParams[0].ToV8Value());
+ swMsg = pRuntime->ToWideString(newParams[0]);
}
int iIcon = 0;
- if (IsTypeKnown(newParams[1].ToV8Value()))
- iIcon = pRuntime->ToInt32(newParams[1].ToV8Value());
+ if (IsTypeKnown(newParams[1]))
+ iIcon = pRuntime->ToInt32(newParams[1]);
int iType = 0;
- if (IsTypeKnown(newParams[2].ToV8Value()))
- iType = pRuntime->ToInt32(newParams[2].ToV8Value());
+ if (IsTypeKnown(newParams[2]))
+ iType = pRuntime->ToInt32(newParams[2]);
WideString swTitle;
- if (IsTypeKnown(newParams[3].ToV8Value()))
- swTitle = pRuntime->ToWideString(newParams[3].ToV8Value());
+ if (IsTypeKnown(newParams[3]))
+ swTitle = pRuntime->ToWideString(newParams[3]);
else
swTitle = JSGetStringFromID(IDS_STRING_JSALERT);
@@ -453,12 +452,11 @@ bool app::alert(CJS_Runtime* pRuntime,
}
bool app::beep(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() == 1) {
- pRuntime->GetFormFillEnv()->JS_appBeep(
- pRuntime->ToInt32(params[0].ToV8Value()));
+ pRuntime->GetFormFillEnv()->JS_appBeep(pRuntime->ToInt32(params[0]));
return true;
}
@@ -467,14 +465,14 @@ bool app::beep(CJS_Runtime* pRuntime,
}
bool app::findComponent(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool app::popUpMenuEx(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return false;
@@ -485,13 +483,13 @@ bool app::get_fs(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool app::set_fs(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
bool app::setInterval(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() > 2 || params.size() == 0) {
@@ -500,14 +498,13 @@ bool app::setInterval(CJS_Runtime* pRuntime,
}
WideString script =
- params.size() > 0 ? pRuntime->ToWideString(params[0].ToV8Value()) : L"";
+ params.size() > 0 ? pRuntime->ToWideString(params[0]) : L"";
if (script.IsEmpty()) {
sError = JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE);
return true;
}
- uint32_t dwInterval =
- params.size() > 1 ? pRuntime->ToInt32(params[1].ToV8Value()) : 1000;
+ uint32_t dwInterval = params.size() > 1 ? pRuntime->ToInt32(params[1]) : 1000;
GlobalTimer* timerRef = new GlobalTimer(this, pRuntime->GetFormFillEnv(),
pRuntime, 0, script, dwInterval, 0);
@@ -528,7 +525,7 @@ bool app::setInterval(CJS_Runtime* pRuntime,
}
bool app::setTimeOut(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() > 2 || params.size() == 0) {
@@ -536,14 +533,13 @@ bool app::setTimeOut(CJS_Runtime* pRuntime,
return false;
}
- WideString script = pRuntime->ToWideString(params[0].ToV8Value());
+ WideString script = pRuntime->ToWideString(params[0]);
if (script.IsEmpty()) {
sError = JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE);
return true;
}
- uint32_t dwTimeOut =
- params.size() > 1 ? pRuntime->ToInt32(params[1].ToV8Value()) : 1000;
+ uint32_t dwTimeOut = params.size() > 1 ? pRuntime->ToInt32(params[1]) : 1000;
GlobalTimer* timerRef =
new GlobalTimer(this, pRuntime->GetFormFillEnv(), pRuntime, 1, script,
dwTimeOut, dwTimeOut);
@@ -563,7 +559,7 @@ bool app::setTimeOut(CJS_Runtime* pRuntime,
}
bool app::clearTimeOut(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() != 1) {
@@ -576,7 +572,7 @@ bool app::clearTimeOut(CJS_Runtime* pRuntime,
}
bool app::clearInterval(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() != 1) {
@@ -588,11 +584,11 @@ bool app::clearInterval(CJS_Runtime* pRuntime,
return true;
}
-void app::ClearTimerCommon(CJS_Runtime* pRuntime, const CJS_Value& param) {
- if (!param.ToV8Value()->IsObject())
+void app::ClearTimerCommon(CJS_Runtime* pRuntime, v8::Local<v8::Value> param) {
+ if (!param->IsObject())
return;
- v8::Local<v8::Object> pObj = pRuntime->ToObject(param.ToV8Value());
+ v8::Local<v8::Object> pObj = pRuntime->ToObject(param);
if (CFXJS_Engine::GetObjDefnID(pObj) != CJS_TimerObj::g_nObjDefnID)
return;
@@ -609,7 +605,7 @@ void app::ClearTimerCommon(CJS_Runtime* pRuntime, const CJS_Value& param) {
}
bool app::execMenuItem(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return false;
@@ -636,7 +632,7 @@ void app::RunJsScript(CJS_Runtime* pRuntime, const WideString& wsScript) {
}
bool app::goBack(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Not supported.
@@ -644,7 +640,7 @@ bool app::goBack(CJS_Runtime* pRuntime,
}
bool app::goForward(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Not supported.
@@ -652,22 +648,22 @@ bool app::goForward(CJS_Runtime* pRuntime,
}
bool app::mailMsg(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
- std::vector<CJS_Value> newParams =
+ std::vector<v8::Local<v8::Value>> newParams =
ExpandKeywordParams(pRuntime, params, 6, L"bUI", L"cTo", L"cCc", L"cBcc",
L"cSubject", L"cMsg");
- if (!IsTypeKnown(newParams[0].ToV8Value())) {
+ if (!IsTypeKnown(newParams[0])) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- bool bUI = pRuntime->ToBoolean(newParams[0].ToV8Value());
+ bool bUI = pRuntime->ToBoolean(newParams[0]);
WideString cTo;
- if (IsTypeKnown(newParams[1].ToV8Value())) {
- cTo = pRuntime->ToWideString(newParams[1].ToV8Value());
+ if (IsTypeKnown(newParams[1])) {
+ cTo = pRuntime->ToWideString(newParams[1]);
} else {
if (!bUI) {
// cTo parameter required when UI not invoked.
@@ -677,20 +673,20 @@ bool app::mailMsg(CJS_Runtime* pRuntime,
}
WideString cCc;
- if (IsTypeKnown(newParams[2].ToV8Value()))
- cCc = pRuntime->ToWideString(newParams[2].ToV8Value());
+ if (IsTypeKnown(newParams[2]))
+ cCc = pRuntime->ToWideString(newParams[2]);
WideString cBcc;
- if (IsTypeKnown(newParams[3].ToV8Value()))
- cBcc = pRuntime->ToWideString(newParams[3].ToV8Value());
+ if (IsTypeKnown(newParams[3]))
+ cBcc = pRuntime->ToWideString(newParams[3]);
WideString cSubject;
- if (IsTypeKnown(newParams[4].ToV8Value()))
- cSubject = pRuntime->ToWideString(newParams[4].ToV8Value());
+ if (IsTypeKnown(newParams[4]))
+ cSubject = pRuntime->ToWideString(newParams[4]);
WideString cMsg;
- if (IsTypeKnown(newParams[5].ToV8Value()))
- cMsg = pRuntime->ToWideString(newParams[5].ToV8Value());
+ if (IsTypeKnown(newParams[5]))
+ cMsg = pRuntime->ToWideString(newParams[5]);
pRuntime->BeginBlock();
pRuntime->GetFormFillEnv()->JS_docmailForm(nullptr, 0, bUI, cTo.c_str(),
@@ -701,7 +697,7 @@ bool app::mailMsg(CJS_Runtime* pRuntime,
}
bool app::launchURL(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not supported.
@@ -716,9 +712,9 @@ bool app::get_runtime_highlight(CJS_Runtime* pRuntime,
}
bool app::set_runtime_highlight(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
- m_bRuntimeHighLight = pRuntime->ToBoolean(vp.ToV8Value());
+ m_bRuntimeHighLight = pRuntime->ToBoolean(vp);
return true;
}
@@ -729,20 +725,20 @@ bool app::get_fullscreen(CJS_Runtime* pRuntime,
}
bool app::set_fullscreen(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
bool app::popUpMenu(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return false;
}
bool app::browseForDoc(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not supported.
@@ -759,48 +755,48 @@ WideString app::SysPathToPDFPath(const WideString& sOldPath) {
}
bool app::newDoc(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return false;
}
bool app::openDoc(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return false;
}
bool app::response(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
- std::vector<CJS_Value> newParams =
+ std::vector<v8::Local<v8::Value>> newParams =
ExpandKeywordParams(pRuntime, params, 5, L"cQuestion", L"cTitle",
L"cDefault", L"bPassword", L"cLabel");
- if (!IsTypeKnown(newParams[0].ToV8Value())) {
+ if (!IsTypeKnown(newParams[0])) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- WideString swQuestion = pRuntime->ToWideString(newParams[0].ToV8Value());
+ WideString swQuestion = pRuntime->ToWideString(newParams[0]);
WideString swTitle = L"PDF";
- if (IsTypeKnown(newParams[1].ToV8Value()))
- swTitle = pRuntime->ToWideString(newParams[1].ToV8Value());
+ if (IsTypeKnown(newParams[1]))
+ swTitle = pRuntime->ToWideString(newParams[1]);
WideString swDefault;
- if (IsTypeKnown(newParams[2].ToV8Value()))
- swDefault = pRuntime->ToWideString(newParams[2].ToV8Value());
+ if (IsTypeKnown(newParams[2]))
+ swDefault = pRuntime->ToWideString(newParams[2]);
bool bPassword = false;
- if (IsTypeKnown(newParams[3].ToV8Value()))
- bPassword = pRuntime->ToBoolean(newParams[3].ToV8Value());
+ if (IsTypeKnown(newParams[3]))
+ bPassword = pRuntime->ToBoolean(newParams[3]);
WideString swLabel;
- if (IsTypeKnown(newParams[4].ToV8Value()))
- swLabel = pRuntime->ToWideString(newParams[4].ToV8Value());
+ if (IsTypeKnown(newParams[4]))
+ swLabel = pRuntime->ToWideString(newParams[4]);
const int MAX_INPUT_BYTES = 2048;
std::vector<uint8_t> pBuff(MAX_INPUT_BYTES + 2);
@@ -826,13 +822,13 @@ bool app::get_media(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool app::set_media(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
bool app::execDialog(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
diff --git a/fpdfsdk/javascript/app.h b/fpdfsdk/javascript/app.h
index 666ee12606..967e9d7526 100644
--- a/fpdfsdk/javascript/app.h
+++ b/fpdfsdk/javascript/app.h
@@ -45,154 +45,156 @@ class app : public CJS_EmbedObj {
CJS_Value* vp,
WideString* sError);
bool set_active_docs(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_calculate(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_calculate(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_forms_version(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_forms_version(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_fs(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_fs(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_fs(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_fullscreen(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_fullscreen(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_language(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_language(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_media(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_media(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_platform(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_platform(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_runtime_highlight(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_runtime_highlight(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_viewer_type(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_viewer_type(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_viewer_variation(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_viewer_variation(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_viewer_version(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_viewer_version(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool alert(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool beep(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool browseForDoc(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool clearInterval(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool clearTimeOut(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool execDialog(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool execMenuItem(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool findComponent(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool goBack(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool goForward(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool launchURL(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool mailMsg(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool newFDF(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool newDoc(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool openDoc(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool openFDF(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool popUpMenuEx(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool popUpMenu(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool response(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool setInterval(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool setTimeOut(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
@@ -205,7 +207,7 @@ class app : public CJS_EmbedObj {
// CJS_EmbedObj
void RunJsScript(CJS_Runtime* pRuntime, const WideString& wsScript);
- void ClearTimerCommon(CJS_Runtime* pRuntime, const CJS_Value& param);
+ void ClearTimerCommon(CJS_Runtime* pRuntime, v8::Local<v8::Value> param);
bool m_bCalculate;
bool m_bRuntimeHighLight;
diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp
index c1ec5feac6..1d9adc8f74 100644
--- a/fpdfsdk/javascript/cjs_runtime.cpp
+++ b/fpdfsdk/javascript/cjs_runtime.cpp
@@ -256,7 +256,7 @@ bool CJS_Runtime::SetValueByName(const ByteStringView& utf8Name,
#endif
v8::Local<v8::Value> CJS_Runtime::MaybeCoerceToNumber(
- const v8::Local<v8::Value>& value) {
+ v8::Local<v8::Value> value) {
bool bAllowNaN = false;
if (value->IsString()) {
ByteString bstr = ByteString::FromUnicode(ToWideString(value));
diff --git a/fpdfsdk/javascript/cjs_runtime.h b/fpdfsdk/javascript/cjs_runtime.h
index 90ec23ee7a..69a370501d 100644
--- a/fpdfsdk/javascript/cjs_runtime.h
+++ b/fpdfsdk/javascript/cjs_runtime.h
@@ -50,7 +50,7 @@ class CJS_Runtime : public IJS_Runtime,
// Attempt to convert the |value| into a number. If successful the number
// value will be returned, otherwise |value| is returned.
- v8::Local<v8::Value> MaybeCoerceToNumber(const v8::Local<v8::Value>& value);
+ v8::Local<v8::Value> MaybeCoerceToNumber(v8::Local<v8::Value> value);
#ifdef PDF_ENABLE_XFA
bool GetValueByName(const ByteStringView& utf8Name,
diff --git a/fpdfsdk/javascript/color.cpp b/fpdfsdk/javascript/color.cpp
index c095678732..97d10b978d 100644
--- a/fpdfsdk/javascript/color.cpp
+++ b/fpdfsdk/javascript/color.cpp
@@ -44,32 +44,24 @@ CJS_Array color::ConvertPWLColorToArray(CJS_Runtime* pRuntime,
CJS_Array array;
switch (color.nColorType) {
case CFX_Color::kTransparent:
- array.SetElement(pRuntime, 0, CJS_Value(pRuntime->NewString(L"T")));
+ array.SetElement(pRuntime, 0, pRuntime->NewString(L"T"));
break;
case CFX_Color::kGray:
- array.SetElement(pRuntime, 0, CJS_Value(pRuntime->NewString(L"G")));
- array.SetElement(pRuntime, 1,
- CJS_Value(pRuntime->NewNumber(color.fColor1)));
+ array.SetElement(pRuntime, 0, pRuntime->NewString(L"G"));
+ array.SetElement(pRuntime, 1, pRuntime->NewNumber(color.fColor1));
break;
case CFX_Color::kRGB:
- array.SetElement(pRuntime, 0, CJS_Value(pRuntime->NewString(L"RGB")));
- array.SetElement(pRuntime, 1,
- CJS_Value(pRuntime->NewNumber(color.fColor1)));
- array.SetElement(pRuntime, 2,
- CJS_Value(pRuntime->NewNumber(color.fColor2)));
- array.SetElement(pRuntime, 3,
- CJS_Value(pRuntime->NewNumber(color.fColor3)));
+ array.SetElement(pRuntime, 0, pRuntime->NewString(L"RGB"));
+ array.SetElement(pRuntime, 1, pRuntime->NewNumber(color.fColor1));
+ array.SetElement(pRuntime, 2, pRuntime->NewNumber(color.fColor2));
+ array.SetElement(pRuntime, 3, pRuntime->NewNumber(color.fColor3));
break;
case CFX_Color::kCMYK:
- array.SetElement(pRuntime, 0, CJS_Value(pRuntime->NewString(L"CMYK")));
- array.SetElement(pRuntime, 1,
- CJS_Value(pRuntime->NewNumber(color.fColor1)));
- array.SetElement(pRuntime, 2,
- CJS_Value(pRuntime->NewNumber(color.fColor2)));
- array.SetElement(pRuntime, 3,
- CJS_Value(pRuntime->NewNumber(color.fColor3)));
- array.SetElement(pRuntime, 4,
- CJS_Value(pRuntime->NewNumber(color.fColor4)));
+ array.SetElement(pRuntime, 0, pRuntime->NewString(L"CMYK"));
+ array.SetElement(pRuntime, 1, pRuntime->NewNumber(color.fColor1));
+ array.SetElement(pRuntime, 2, pRuntime->NewNumber(color.fColor2));
+ array.SetElement(pRuntime, 3, pRuntime->NewNumber(color.fColor3));
+ array.SetElement(pRuntime, 4, pRuntime->NewNumber(color.fColor4));
break;
}
return array;
@@ -82,15 +74,13 @@ CFX_Color color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime,
if (nArrayLen < 1)
return CFX_Color();
- WideString sSpace =
- pRuntime->ToWideString(array.GetElement(pRuntime, 0).ToV8Value());
+ WideString sSpace = pRuntime->ToWideString(array.GetElement(pRuntime, 0));
if (sSpace == L"T")
return CFX_Color(CFX_Color::kTransparent);
float d1 = 0;
if (nArrayLen > 1) {
- d1 = static_cast<float>(
- pRuntime->ToDouble(array.GetElement(pRuntime, 1).ToV8Value()));
+ d1 = static_cast<float>(pRuntime->ToDouble(array.GetElement(pRuntime, 1)));
}
if (sSpace == L"G")
@@ -98,24 +88,17 @@ CFX_Color color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime,
float d2 = 0;
float d3 = 0;
- if (nArrayLen > 2) {
- d2 = static_cast<float>(
- pRuntime->ToDouble(array.GetElement(pRuntime, 2).ToV8Value()));
- }
- if (nArrayLen > 3) {
- d3 = static_cast<float>(
- pRuntime->ToDouble(array.GetElement(pRuntime, 3).ToV8Value()));
- }
+ if (nArrayLen > 2)
+ d2 = static_cast<float>(pRuntime->ToDouble(array.GetElement(pRuntime, 2)));
+ if (nArrayLen > 3)
+ d3 = static_cast<float>(pRuntime->ToDouble(array.GetElement(pRuntime, 3)));
if (sSpace == L"RGB")
return CFX_Color(CFX_Color::kRGB, d1, d2, d3);
float d4 = 0;
- if (nArrayLen > 4) {
- d4 = static_cast<float>(
- pRuntime->ToDouble(array.GetElement(pRuntime, 4).ToV8Value()));
- }
-
+ if (nArrayLen > 4)
+ d4 = static_cast<float>(pRuntime->ToDouble(array.GetElement(pRuntime, 4)));
if (sSpace == L"CMYK")
return CFX_Color(CFX_Color::kCMYK, d1, d2, d3, d4);
@@ -146,7 +129,7 @@ bool color::get_transparent(CJS_Runtime* pRuntime,
}
bool color::set_transparent(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crTransparent);
}
@@ -158,7 +141,7 @@ bool color::get_black(CJS_Runtime* pRuntime,
}
bool color::set_black(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crBlack);
}
@@ -170,7 +153,7 @@ bool color::get_white(CJS_Runtime* pRuntime,
}
bool color::set_white(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crWhite);
}
@@ -180,7 +163,7 @@ bool color::get_red(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool color::set_red(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crRed);
}
@@ -192,7 +175,7 @@ bool color::get_green(CJS_Runtime* pRuntime,
}
bool color::set_green(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crGreen);
}
@@ -202,7 +185,7 @@ bool color::get_blue(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool color::set_blue(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crBlue);
}
@@ -212,7 +195,7 @@ bool color::get_cyan(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool color::set_cyan(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crCyan);
}
@@ -224,7 +207,7 @@ bool color::get_magenta(CJS_Runtime* pRuntime,
}
bool color::set_magenta(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crMagenta);
}
@@ -236,7 +219,7 @@ bool color::get_yellow(CJS_Runtime* pRuntime,
}
bool color::set_yellow(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crYellow);
}
@@ -248,7 +231,7 @@ bool color::get_dark_gray(CJS_Runtime* pRuntime,
}
bool color::set_dark_gray(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crDKGray);
}
@@ -258,7 +241,7 @@ bool color::get_gray(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool color::set_gray(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crGray);
}
@@ -270,7 +253,7 @@ bool color::get_light_gray(CJS_Runtime* pRuntime,
}
bool color::set_light_gray(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crLTGray);
}
@@ -287,27 +270,26 @@ bool color::GetPropertyHelper(CJS_Runtime* pRuntime,
}
bool color::SetPropertyHelper(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
CFX_Color* var) {
- if (vp.ToV8Value().IsEmpty() || !vp.ToV8Value()->IsArray())
+ if (vp.IsEmpty() || !vp->IsArray())
return false;
- *var = ConvertArrayToPWLColor(pRuntime,
- CJS_Array(pRuntime->ToArray(vp.ToV8Value())));
+ *var = ConvertArrayToPWLColor(pRuntime, CJS_Array(pRuntime->ToArray(vp)));
return true;
}
bool color::convert(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
int iSize = params.size();
if (iSize < 2)
return false;
- if (params[0].ToV8Value().IsEmpty() || !params[0].ToV8Value()->IsArray())
+ if (params[0].IsEmpty() || !params[0]->IsArray())
return false;
- WideString sDestSpace = pRuntime->ToWideString(params[1].ToV8Value());
+ WideString sDestSpace = pRuntime->ToWideString(params[1]);
int nColorType = CFX_Color::kTransparent;
if (sDestSpace == L"T")
nColorType = CFX_Color::kTransparent;
@@ -318,8 +300,8 @@ bool color::convert(CJS_Runtime* pRuntime,
else if (sDestSpace == L"CMYK")
nColorType = CFX_Color::kCMYK;
- CFX_Color color = ConvertArrayToPWLColor(
- pRuntime, CJS_Array(pRuntime->ToArray(params[0].ToV8Value())));
+ CFX_Color color =
+ ConvertArrayToPWLColor(pRuntime, CJS_Array(pRuntime->ToArray(params[0])));
CJS_Array array =
ConvertPWLColorToArray(pRuntime, color.ConvertColorType(nColorType));
@@ -332,20 +314,20 @@ bool color::convert(CJS_Runtime* pRuntime,
}
bool color::equal(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() < 2)
return false;
- if (params[0].ToV8Value().IsEmpty() || !params[0].ToV8Value()->IsArray() ||
- params[1].ToV8Value().IsEmpty() || !params[1].ToV8Value()->IsArray()) {
+ if (params[0].IsEmpty() || !params[0]->IsArray() || params[1].IsEmpty() ||
+ !params[1]->IsArray()) {
return false;
}
- CFX_Color color1 = ConvertArrayToPWLColor(
- pRuntime, CJS_Array(pRuntime->ToArray(params[0].ToV8Value())));
- CFX_Color color2 = ConvertArrayToPWLColor(
- pRuntime, CJS_Array(pRuntime->ToArray(params[1].ToV8Value())));
+ CFX_Color color1 =
+ ConvertArrayToPWLColor(pRuntime, CJS_Array(pRuntime->ToArray(params[0])));
+ CFX_Color color2 =
+ ConvertArrayToPWLColor(pRuntime, CJS_Array(pRuntime->ToArray(params[1])));
color1 = color1.ConvertColorType(color2.nColorType);
vRet = CJS_Value(pRuntime->NewBoolean(color1 == color2));
diff --git a/fpdfsdk/javascript/color.h b/fpdfsdk/javascript/color.h
index 851f05b124..de784e57b2 100644
--- a/fpdfsdk/javascript/color.h
+++ b/fpdfsdk/javascript/color.h
@@ -24,71 +24,79 @@ class color : public CJS_EmbedObj {
bool get_black(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_black(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_blue(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_blue(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_blue(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_cyan(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_cyan(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_cyan(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_dark_gray(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_dark_gray(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_gray(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_gray(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_gray(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_green(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_green(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_light_gray(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_light_gray(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_magenta(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_magenta(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_red(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_red(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_red(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_transparent(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_transparent(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_white(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_white(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_yellow(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_yellow(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool convert(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool equal(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
private:
bool GetPropertyHelper(CJS_Runtime* pRuntime, CJS_Value* vp, CFX_Color* val);
bool SetPropertyHelper(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
CFX_Color* val);
CFX_Color m_crTransparent;
diff --git a/fpdfsdk/javascript/console.cpp b/fpdfsdk/javascript/console.cpp
index 5e854bda47..ba46fea7da 100644
--- a/fpdfsdk/javascript/console.cpp
+++ b/fpdfsdk/javascript/console.cpp
@@ -31,21 +31,21 @@ console::console(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {}
console::~console() {}
bool console::clear(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool console::hide(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
}
bool console::println(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() < 1) {
@@ -55,7 +55,7 @@ bool console::println(CJS_Runtime* pRuntime,
}
bool console::show(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
return true;
diff --git a/fpdfsdk/javascript/console.h b/fpdfsdk/javascript/console.h
index 4680220a81..d7d1793dde 100644
--- a/fpdfsdk/javascript/console.h
+++ b/fpdfsdk/javascript/console.h
@@ -18,19 +18,19 @@ class console : public CJS_EmbedObj {
public:
bool clear(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool hide(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool println(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool show(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
};
diff --git a/fpdfsdk/javascript/event.cpp b/fpdfsdk/javascript/event.cpp
index da81aac45a..eb9d6441bc 100644
--- a/fpdfsdk/javascript/event.cpp
+++ b/fpdfsdk/javascript/event.cpp
@@ -56,14 +56,14 @@ bool event::get_change(CJS_Runtime* pRuntime,
}
bool event::set_change(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- if (vp.ToV8Value()->IsString()) {
+ if (vp->IsString()) {
WideString& wChange = pEvent->Change();
- wChange = pRuntime->ToWideString(vp.ToV8Value());
+ wChange = pRuntime->ToWideString(vp);
}
return true;
}
@@ -79,7 +79,7 @@ bool event::get_change_ex(CJS_Runtime* pRuntime,
}
bool event::set_change_ex(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -95,7 +95,7 @@ bool event::get_commit_key(CJS_Runtime* pRuntime,
}
bool event::set_commit_key(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -114,7 +114,7 @@ bool event::get_field_full(CJS_Runtime* pRuntime,
}
bool event::set_field_full(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -129,7 +129,7 @@ bool event::get_key_down(CJS_Runtime* pRuntime,
}
bool event::set_key_down(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -144,7 +144,7 @@ bool event::get_modifier(CJS_Runtime* pRuntime,
}
bool event::set_modifier(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -157,7 +157,7 @@ bool event::get_name(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool event::set_name(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -170,11 +170,11 @@ bool event::get_rc(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool event::set_rc(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- pEvent->Rc() = pRuntime->ToBoolean(vp.ToV8Value());
+ pEvent->Rc() = pRuntime->ToBoolean(vp);
return true;
}
@@ -185,7 +185,7 @@ bool event::get_rich_change(CJS_Runtime* pRuntime,
}
bool event::set_rich_change(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
@@ -197,7 +197,7 @@ bool event::get_rich_change_ex(CJS_Runtime* pRuntime,
}
bool event::set_rich_change_ex(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
@@ -209,7 +209,7 @@ bool event::get_rich_value(CJS_Runtime* pRuntime,
}
bool event::set_rich_value(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return true;
}
@@ -228,7 +228,7 @@ bool event::get_sel_end(CJS_Runtime* pRuntime,
}
bool event::set_sel_end(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -236,7 +236,7 @@ bool event::set_sel_end(CJS_Runtime* pRuntime,
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
return true;
- pEvent->SelEnd() = pRuntime->ToInt32(vp.ToV8Value());
+ pEvent->SelEnd() = pRuntime->ToInt32(vp);
return true;
}
@@ -254,7 +254,7 @@ bool event::get_sel_start(CJS_Runtime* pRuntime,
}
bool event::set_sel_start(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -262,7 +262,7 @@ bool event::set_sel_start(CJS_Runtime* pRuntime,
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
return true;
- pEvent->SelStart() = pRuntime->ToInt32(vp.ToV8Value());
+ pEvent->SelStart() = pRuntime->ToInt32(vp);
return true;
}
@@ -276,7 +276,7 @@ bool event::get_shift(CJS_Runtime* pRuntime,
}
bool event::set_shift(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -291,7 +291,7 @@ bool event::get_source(CJS_Runtime* pRuntime,
}
bool event::set_source(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -306,7 +306,7 @@ bool event::get_target(CJS_Runtime* pRuntime,
}
bool event::set_target(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -321,7 +321,7 @@ bool event::get_target_name(CJS_Runtime* pRuntime,
}
bool event::set_target_name(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -334,7 +334,7 @@ bool event::get_type(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
}
bool event::set_type(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
@@ -356,7 +356,7 @@ bool event::get_value(CJS_Runtime* pRuntime,
}
bool event::set_value(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -367,7 +367,7 @@ bool event::set_value(CJS_Runtime* pRuntime,
if (!pEvent->m_pValue)
return false;
- pEvent->Value() = pRuntime->ToWideString(vp.ToV8Value());
+ pEvent->Value() = pRuntime->ToWideString(vp);
return true;
}
@@ -381,7 +381,7 @@ bool event::get_will_commit(CJS_Runtime* pRuntime,
}
bool event::set_will_commit(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError) {
return false;
}
diff --git a/fpdfsdk/javascript/event.h b/fpdfsdk/javascript/event.h
index f622443f3a..90b9126c89 100644
--- a/fpdfsdk/javascript/event.h
+++ b/fpdfsdk/javascript/event.h
@@ -17,104 +17,110 @@ class event : public CJS_EmbedObj {
public:
bool get_change(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_change(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_change_ex(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_change_ex(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_commit_key(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_commit_key(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_field_full(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_field_full(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_key_down(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_key_down(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_modifier(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_modifier(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_name(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_name(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_name(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_rc(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_rc(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_rc(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_rich_change(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_rich_change(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_rich_change_ex(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_rich_change_ex(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_rich_value(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_rich_value(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_sel_end(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_sel_end(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_sel_start(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_sel_start(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_shift(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_shift(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_source(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_source(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_target(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_target(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_target_name(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_target_name(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_type(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
- bool set_type(CJS_Runtime* pRuntime, const CJS_Value& vp, WideString* sError);
+ bool set_type(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp,
+ WideString* sError);
bool get_value(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError);
bool set_value(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
bool get_will_commit(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError);
bool set_will_commit(CJS_Runtime* pRuntime,
- const CJS_Value& vp,
+ v8::Local<v8::Value> vp,
WideString* sError);
};
diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp
index aae7c93160..040c6e6067 100644
--- a/fpdfsdk/javascript/global.cpp
+++ b/fpdfsdk/javascript/global.cpp
@@ -131,10 +131,8 @@ void JSSpecialPropPut(const char* class_name,
v8::String::Utf8Value utf8_value(property);
WideString propname =
WideString::FromUTF8(ByteStringView(*utf8_value, utf8_value.length()));
- CJS_Value prop_value(value);
- if (!pObj->SetProperty(pRuntime, propname.c_str(), prop_value)) {
+ if (!pObj->SetProperty(pRuntime, propname.c_str(), value))
pRuntime->Error(JSFormatErrorString(class_name, "PutProperty", L""));
- }
}
template <class Alt>
@@ -181,7 +179,7 @@ class JSGlobalAlternate : public CJS_EmbedObj {
~JSGlobalAlternate() override;
bool setPersistent(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool QueryProperty(const wchar_t* propname);
@@ -190,7 +188,7 @@ class JSGlobalAlternate : public CJS_EmbedObj {
CJS_Value* vp);
bool SetProperty(CJS_Runtime* pRuntime,
const wchar_t* propname,
- const CJS_Value& vp);
+ v8::Local<v8::Value> vp);
bool DelProperty(CJS_Runtime* pRuntime, const wchar_t* propname);
void Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv);
@@ -323,54 +321,55 @@ bool JSGlobalAlternate::GetProperty(CJS_Runtime* pRuntime,
bool JSGlobalAlternate::SetProperty(CJS_Runtime* pRuntime,
const wchar_t* propname,
- const CJS_Value& vp) {
+ v8::Local<v8::Value> vp) {
ByteString sPropName = ByteString::FromUnicode(propname);
- if (vp.ToV8Value()->IsNumber()) {
+ if (vp->IsNumber()) {
return SetGlobalVariables(sPropName, JS_GlobalDataType::NUMBER,
- pRuntime->ToDouble(vp.ToV8Value()), false, "",
+ pRuntime->ToDouble(vp), false, "",
v8::Local<v8::Object>(), false);
}
- if (vp.ToV8Value()->IsBoolean()) {
+ if (vp->IsBoolean()) {
return SetGlobalVariables(sPropName, JS_GlobalDataType::BOOLEAN, 0,
- pRuntime->ToBoolean(vp.ToV8Value()), "",
+ pRuntime->ToBoolean(vp), "",
v8::Local<v8::Object>(), false);
}
- if (vp.ToV8Value()->IsString()) {
+ if (vp->IsString()) {
return SetGlobalVariables(
sPropName, JS_GlobalDataType::STRING, 0, false,
- ByteString::FromUnicode(pRuntime->ToWideString(vp.ToV8Value())),
+ ByteString::FromUnicode(pRuntime->ToWideString(vp)),
v8::Local<v8::Object>(), false);
}
- if (vp.ToV8Value()->IsObject()) {
+ if (vp->IsObject()) {
return SetGlobalVariables(sPropName, JS_GlobalDataType::OBJECT, 0, false,
- "", pRuntime->ToObject(vp.ToV8Value()), false);
+ "", pRuntime->ToObject(vp), false);
}
- if (vp.ToV8Value()->IsNull()) {
+ if (vp->IsNull()) {
return SetGlobalVariables(sPropName, JS_GlobalDataType::NULLOBJ, 0, false,
"", v8::Local<v8::Object>(), false);
}
- if (vp.ToV8Value()->IsUndefined()) {
+ if (vp->IsUndefined()) {
DelProperty(pRuntime, propname);
return true;
}
return false;
}
-bool JSGlobalAlternate::setPersistent(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- WideString& sError) {
+bool JSGlobalAlternate::setPersistent(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params,
+ CJS_Value& vRet,
+ WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
auto it = m_MapGlobal.find(
- ByteString::FromUnicode(pRuntime->ToWideString(params[0].ToV8Value())));
+ ByteString::FromUnicode(pRuntime->ToWideString(params[0])));
if (it == m_MapGlobal.end() || it->second->bDeleted) {
sError = JSGetStringFromID(IDS_STRING_JSNOGLOBAL);
return false;
}
- it->second->bPersistent = pRuntime->ToBoolean(params[1].ToV8Value());
+ it->second->bPersistent = pRuntime->ToBoolean(params[1]);
return true;
}
diff --git a/fpdfsdk/javascript/report.cpp b/fpdfsdk/javascript/report.cpp
index 8f5d9ac4fe..adbe7d8f7b 100644
--- a/fpdfsdk/javascript/report.cpp
+++ b/fpdfsdk/javascript/report.cpp
@@ -27,7 +27,7 @@ Report::Report(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {}
Report::~Report() {}
bool Report::writeText(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not supported.
@@ -35,7 +35,7 @@ bool Report::writeText(CJS_Runtime* pRuntime,
}
bool Report::save(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
// Unsafe, not supported.
diff --git a/fpdfsdk/javascript/report.h b/fpdfsdk/javascript/report.h
index 0f040c6c4e..b5f8ef3cc1 100644
--- a/fpdfsdk/javascript/report.h
+++ b/fpdfsdk/javascript/report.h
@@ -18,11 +18,11 @@ class Report : public CJS_EmbedObj {
public:
bool save(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool writeText(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
};
diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp
index 4a7e148697..ecec8d173d 100644
--- a/fpdfsdk/javascript/util.cpp
+++ b/fpdfsdk/javascript/util.cpp
@@ -74,15 +74,14 @@ util::util(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {}
util::~util() {}
bool util::printf(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
const size_t iSize = params.size();
if (iSize < 1)
return false;
- std::wstring unsafe_fmt_string(
- pRuntime->ToWideString(params[0].ToV8Value()).c_str());
+ std::wstring unsafe_fmt_string(pRuntime->ToWideString(params[0]).c_str());
std::vector<std::wstring> unsafe_conversion_specifiers;
int iOffset = 0;
int iOffend = 0;
@@ -116,16 +115,15 @@ bool util::printf(CJS_Runtime* pRuntime,
switch (ParseDataType(&c_strFormat)) {
case UTIL_INT:
strSegment.Format(c_strFormat.c_str(),
- pRuntime->ToInt32(params[iIndex].ToV8Value()));
+ pRuntime->ToInt32(params[iIndex]));
break;
case UTIL_DOUBLE:
strSegment.Format(c_strFormat.c_str(),
- pRuntime->ToDouble(params[iIndex].ToV8Value()));
+ pRuntime->ToDouble(params[iIndex]));
break;
case UTIL_STRING:
- strSegment.Format(
- c_strFormat.c_str(),
- pRuntime->ToWideString(params[iIndex].ToV8Value()).c_str());
+ strSegment.Format(c_strFormat.c_str(),
+ pRuntime->ToWideString(params[iIndex]).c_str());
break;
default:
strSegment.Format(L"%ls", c_strFormat.c_str());
@@ -140,31 +138,27 @@ bool util::printf(CJS_Runtime* pRuntime,
}
bool util::printd(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
const size_t iSize = params.size();
if (iSize < 2)
return false;
- const CJS_Value& p1 = params[0];
- const CJS_Value& p2 = params[1];
- if (p2.ToV8Value().IsEmpty() || !p2.ToV8Value()->IsDate()) {
+ if (params[1].IsEmpty() || !params[1]->IsDate()) {
sError = JSGetStringFromID(IDS_STRING_JSPRINT1);
return false;
}
- ASSERT(!p2.ToV8Value().IsEmpty() && p2.ToV8Value()->IsDate());
- v8::Local<v8::Value> mutable_value = p2.ToV8Value();
- CJS_Date jsDate(mutable_value.As<v8::Date>());
+ CJS_Date jsDate(params[1].As<v8::Date>());
if (!jsDate.IsValidDate(pRuntime)) {
sError = JSGetStringFromID(IDS_STRING_JSPRINT2);
return false;
}
- if (p1.ToV8Value()->IsNumber()) {
+ if (params[0]->IsNumber()) {
WideString swResult;
- switch (pRuntime->ToInt32(p1.ToV8Value())) {
+ switch (pRuntime->ToInt32(params[0])) {
case 0:
swResult.Format(L"D:%04d%02d%02d%02d%02d%02d", jsDate.GetYear(pRuntime),
jsDate.GetMonth(pRuntime) + 1, jsDate.GetDay(pRuntime),
@@ -194,8 +188,8 @@ bool util::printd(CJS_Runtime* pRuntime,
return true;
}
- if (p1.ToV8Value()->IsString()) {
- if (iSize > 2 && pRuntime->ToBoolean(params[2].ToV8Value())) {
+ if (params[0]->IsString()) {
+ if (iSize > 2 && pRuntime->ToBoolean(params[2])) {
sError = JSGetStringFromID(IDS_STRING_JSNOTSUPPORT);
return false; // currently, it doesn't support XFAPicture.
}
@@ -203,7 +197,7 @@ bool util::printd(CJS_Runtime* pRuntime,
// Convert PDF-style format specifiers to wcsftime specifiers. Remove any
// pre-existing %-directives before inserting our own.
std::basic_string<wchar_t> cFormat =
- pRuntime->ToWideString(p1.ToV8Value()).c_str();
+ pRuntime->ToWideString(params[0]).c_str();
cFormat.erase(std::remove(cFormat.begin(), cFormat.end(), '%'),
cFormat.end());
@@ -274,7 +268,7 @@ bool util::printd(CJS_Runtime* pRuntime,
}
bool util::printx(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() < 2) {
@@ -282,10 +276,9 @@ bool util::printx(CJS_Runtime* pRuntime,
return false;
}
- vRet = CJS_Value(
- pRuntime->NewString(printx(pRuntime->ToWideString(params[0].ToV8Value()),
- pRuntime->ToWideString(params[1].ToV8Value()))
- .c_str()));
+ vRet = CJS_Value(pRuntime->NewString(printx(pRuntime->ToWideString(params[0]),
+ pRuntime->ToWideString(params[1]))
+ .c_str()));
return true;
}
@@ -389,14 +382,14 @@ WideString util::printx(const WideString& wsFormat,
}
bool util::scand(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() < 2)
return false;
- WideString sFormat = pRuntime->ToWideString(params[0].ToV8Value());
- WideString sDate = pRuntime->ToWideString(params[1].ToV8Value());
+ WideString sFormat = pRuntime->ToWideString(params[0]);
+ WideString sDate = pRuntime->ToWideString(params[1]);
double dDate = JS_GetDateTime();
if (sDate.GetLength() > 0) {
dDate = CJS_PublicMethods::MakeRegularDate(sDate, sFormat, nullptr);
@@ -412,7 +405,7 @@ bool util::scand(CJS_Runtime* pRuntime,
}
bool util::byteToChar(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
if (params.size() < 1) {
@@ -420,7 +413,7 @@ bool util::byteToChar(CJS_Runtime* pRuntime,
return false;
}
- int arg = pRuntime->ToInt32(params[0].ToV8Value());
+ int arg = pRuntime->ToInt32(params[0]);
if (arg < 0 || arg > 255) {
sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR);
return false;
diff --git a/fpdfsdk/javascript/util.h b/fpdfsdk/javascript/util.h
index ba46e4f6c7..d40db96527 100644
--- a/fpdfsdk/javascript/util.h
+++ b/fpdfsdk/javascript/util.h
@@ -23,23 +23,23 @@ class util : public CJS_EmbedObj {
~util() override;
bool printd(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool printf(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool printx(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool scand(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);
bool byteToChar(CJS_Runtime* pRuntime,
- const std::vector<CJS_Value>& params,
+ const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError);