summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/app.cpp
diff options
context:
space:
mode:
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;
}