summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/javascript')
-rw-r--r--fpdfsdk/javascript/Document.cpp8
-rw-r--r--fpdfsdk/javascript/PublicMethods.cpp2
-rw-r--r--fpdfsdk/javascript/app.cpp2
-rw-r--r--fpdfsdk/javascript/global.cpp11
-rw-r--r--fpdfsdk/javascript/util.cpp2
5 files changed, 11 insertions, 14 deletions
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index 9404ded0c8..2217f448f2 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -213,7 +213,7 @@ bool Document::set_dirty(CJS_Runtime* pRuntime,
bool Document::get_ADBE(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError) {
- vp->Set(pRuntime->NewNull());
+ vp->Set(pRuntime->NewUndefined());
return true;
}
@@ -312,7 +312,7 @@ bool Document::getField(CJS_Runtime* pRuntime,
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
if (pPDFForm->CountFields(wideName) <= 0) {
- vRet.Set(pRuntime->NewNull());
+ vRet.Set(pRuntime->NewUndefined());
return true;
}
@@ -1321,7 +1321,7 @@ bool Document::getAnnot3D(CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params,
CJS_Value& vRet,
WideString& sError) {
- vRet.Set(pRuntime->NewNull());
+ vRet.Set(pRuntime->NewUndefined());
return true;
}
@@ -1387,7 +1387,7 @@ bool Document::get_icons(CJS_Runtime* pRuntime,
CJS_Value* vp,
WideString* sError) {
if (m_IconNames.empty()) {
- vp->Set(pRuntime->NewNull());
+ vp->Set(pRuntime->NewUndefined());
return true;
}
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index c0441a82a3..667127fe88 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -1840,7 +1840,7 @@ bool CJS_PublicMethods::AFExtractNums(
else
vRet = CJS_Value(nums.ToV8Value());
} else {
- vRet.Set(pRuntime->NewNull());
+ vRet.Set(pRuntime->NewUndefined());
}
return true;
diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp
index ca440f64b3..cbc3145b0f 100644
--- a/fpdfsdk/javascript/app.cpp
+++ b/fpdfsdk/javascript/app.cpp
@@ -237,7 +237,7 @@ bool app::get_active_docs(CJS_Runtime* pRuntime,
else
vp->Set(aDocs.ToV8Value());
} else {
- vp->Set(pRuntime->NewNull());
+ vp->Set(pRuntime->NewUndefined());
}
return true;
diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp
index 040c6e6067..5dc6ac9d78 100644
--- a/fpdfsdk/javascript/global.cpp
+++ b/fpdfsdk/javascript/global.cpp
@@ -109,7 +109,8 @@ void JSSpecialPropGet(const char* class_name,
pRuntime->Error(JSFormatErrorString(class_name, "GetProperty", L""));
return;
}
- info.GetReturnValue().Set(value.ToV8Value());
+ if (!value.ToV8Value().IsEmpty())
+ info.GetReturnValue().Set(value.ToV8Value());
}
template <class Alt>
@@ -284,16 +285,12 @@ bool JSGlobalAlternate::GetProperty(CJS_Runtime* pRuntime,
const wchar_t* propname,
CJS_Value* vp) {
auto it = m_MapGlobal.find(ByteString::FromUnicode(propname));
- if (it == m_MapGlobal.end()) {
- vp->Set(pRuntime->NewNull());
+ if (it == m_MapGlobal.end())
return true;
- }
JSGlobalData* pData = it->second.get();
- if (pData->bDeleted) {
- vp->Set(pRuntime->NewNull());
+ if (pData->bDeleted)
return true;
- }
switch (pData->nType) {
case JS_GlobalDataType::NUMBER:
diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp
index ecec8d173d..202a1ead7f 100644
--- a/fpdfsdk/javascript/util.cpp
+++ b/fpdfsdk/javascript/util.cpp
@@ -398,7 +398,7 @@ bool util::scand(CJS_Runtime* pRuntime,
if (!std::isnan(dDate)) {
vRet = CJS_Value(CJS_Date(pRuntime, dDate).ToV8Value());
} else {
- vRet.Set(pRuntime->NewNull());
+ vRet.Set(pRuntime->NewUndefined());
}
return true;