From 1d8d9ac983fa9c7b6dfc3df736cfd3eae6908a60 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 24 Oct 2017 11:23:25 -0400 Subject: Remove CJS_Value constructors This CL removes most of the CJS_Value constructors and leaves the v8::Local constructor as the only non-default construtor. Change-Id: Ie98260d10eff645d0ca688b353e7d40ba1aac157 Reviewed-on: https://pdfium-review.googlesource.com/16611 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- fpdfsdk/javascript/app.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'fpdfsdk/javascript/app.cpp') 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(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(pBuff.data()), - nLengthBytes / sizeof(uint16_t)) - .c_str()); + vRet = CJS_Value(pRuntime->NewString( + WideString::FromUTF16LE(reinterpret_cast(pBuff.data()), + nLengthBytes / sizeof(uint16_t)) + .c_str())); return true; } -- cgit v1.2.3