summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/app.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-24 11:23:25 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-24 17:17:44 +0000
commit1d8d9ac983fa9c7b6dfc3df736cfd3eae6908a60 (patch)
tree4508fee34d447c5753bdcc0568ad888873e838c2 /fpdfsdk/javascript/app.cpp
parente49749265c4e503c37a316e4ca6eeff430d13b87 (diff)
downloadpdfium-1d8d9ac983fa9c7b6dfc3df736cfd3eae6908a60.tar.xz
Remove CJS_Value constructors
This CL removes most of the CJS_Value constructors and leaves the v8::Local<v8::Value> constructor as the only non-default construtor. Change-Id: Ie98260d10eff645d0ca688b353e7d40ba1aac157 Reviewed-on: https://pdfium-review.googlesource.com/16611 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/app.cpp')
-rw-r--r--fpdfsdk/javascript/app.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp
index 1c822df1d7..7203c3bfa6 100644
--- a/fpdfsdk/javascript/app.cpp
+++ b/fpdfsdk/javascript/app.cpp
@@ -217,7 +217,9 @@ bool app::get_active_docs(CJS_Runtime* pRuntime,
pJSDocument = static_cast<CJS_Document*>(pRuntime->GetObjectPrivate(pObj));
CJS_Array aDocs;
- aDocs.SetElement(pRuntime, 0, CJS_Value(pJSDocument));
+ aDocs.SetElement(
+ pRuntime, 0,
+ pJSDocument ? CJS_Value(pJSDocument->ToV8Object()) : CJS_Value());
if (aDocs.GetLength(pRuntime) > 0)
vp->Set(aDocs.ToV8Array(pRuntime));
else
@@ -392,7 +394,7 @@ bool app::alert(CJS_Runtime* pRuntime,
CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv();
if (!pFormFillEnv) {
- vRet = CJS_Value(pRuntime, 0);
+ vRet = CJS_Value(pRuntime->NewNumber(0));
return true;
}
@@ -433,8 +435,8 @@ bool app::alert(CJS_Runtime* pRuntime,
pRuntime->BeginBlock();
pFormFillEnv->KillFocusAnnot(0);
- vRet = CJS_Value(pRuntime, pFormFillEnv->JS_appAlert(
- swMsg.c_str(), swTitle.c_str(), iType, iIcon));
+ vRet = CJS_Value(pRuntime->NewNumber(
+ pFormFillEnv->JS_appAlert(swMsg.c_str(), swTitle.c_str(), iType, iIcon)));
pRuntime->EndBlock();
return true;
}
@@ -796,10 +798,10 @@ bool app::response(CJS_Runtime* pRuntime,
return false;
}
- vRet = CJS_Value(pRuntime, WideString::FromUTF16LE(
- reinterpret_cast<uint16_t*>(pBuff.data()),
- nLengthBytes / sizeof(uint16_t))
- .c_str());
+ vRet = CJS_Value(pRuntime->NewString(
+ WideString::FromUTF16LE(reinterpret_cast<uint16_t*>(pBuff.data()),
+ nLengthBytes / sizeof(uint16_t))
+ .c_str()));
return true;
}