Ensure CJS_Return() with error always includes a message.

Change the signature of the constructors to make it impossible to
do this otherwise.

Change-Id: I14e88d98a1128f2d599459ce9337cd6d079469fe
Reviewed-on: https://pdfium-review.googlesource.com/34531
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp
index 21aed70..78b152b 100644
--- a/fxjs/cfxjse_engine.cpp
+++ b/fxjs/cfxjse_engine.cpp
@@ -438,7 +438,7 @@
     const WideString& functionName) {
   CXFA_Object* pObject = ToObject(info);
   if (!pObject)
-    return CJS_Return(false);
+    return CJS_Return(L"no Holder() present.");
 
   CFXJSE_Engine* lpScriptContext = pObject->GetDocument()->GetScriptContext();
   pObject = lpScriptContext->GetVariablesThis(pObject);
diff --git a/fxjs/cjs_annot.cpp b/fxjs/cjs_annot.cpp
index b226621..e47d189 100644
--- a/fxjs/cjs_annot.cpp
+++ b/fxjs/cjs_annot.cpp
@@ -47,7 +47,7 @@
 
 CJS_Return CJS_Annot::get_hidden(CJS_Runtime* pRuntime) {
   if (!m_pAnnot)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_Annot* pPDFAnnot = ToBAAnnot(m_pAnnot.Get())->GetPDFAnnot();
   return CJS_Return(pRuntime->NewBoolean(
@@ -59,7 +59,7 @@
   // May invalidate m_pAnnot.
   bool bHidden = pRuntime->ToBoolean(vp);
   if (!m_pAnnot)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   uint32_t flags = ToBAAnnot(m_pAnnot.Get())->GetFlags();
   if (bHidden) {
@@ -75,12 +75,12 @@
   }
   ToBAAnnot(m_pAnnot.Get())->SetFlags(flags);
 
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Annot::get_name(CJS_Runtime* pRuntime) {
   if (!m_pAnnot)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
   return CJS_Return(
       pRuntime->NewString(ToBAAnnot(m_pAnnot.Get())->GetAnnotName().c_str()));
 }
@@ -89,15 +89,15 @@
   // May invalidate m_pAnnot.
   WideString annotName = pRuntime->ToWideString(vp);
   if (!m_pAnnot)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   ToBAAnnot(m_pAnnot.Get())->SetAnnotName(annotName);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Annot::get_type(CJS_Runtime* pRuntime) {
   if (!m_pAnnot)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
   return CJS_Return(pRuntime->NewString(
       WideString::FromLocal(CPDF_Annot::AnnotSubtypeToString(
                                 ToBAAnnot(m_pAnnot.Get())->GetAnnotSubtype())
@@ -106,5 +106,5 @@
 }
 
 CJS_Return CJS_Annot::set_type(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
-  return CJS_Return(JSGetStringFromID(JSMessage::kReadOnlyError));
+  return CJS_Return(JSMessage::kReadOnlyError);
 }
diff --git a/fxjs/cjs_app.cpp b/fxjs/cjs_app.cpp
index 1997e9a..e953f6b 100644
--- a/fxjs/cjs_app.cpp
+++ b/fxjs/cjs_app.cpp
@@ -115,7 +115,7 @@
 
 CJS_Return CJS_App::set_active_docs(CJS_Runtime* pRuntime,
                                     v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::get_calculate(CJS_Runtime* pRuntime) {
@@ -126,7 +126,7 @@
                                   v8::Local<v8::Value> vp) {
   m_bCalculate = pRuntime->ToBoolean(vp);
   pRuntime->GetFormFillEnv()->GetInterForm()->EnableCalculate(m_bCalculate);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_App::get_forms_version(CJS_Runtime* pRuntime) {
@@ -135,7 +135,7 @@
 
 CJS_Return CJS_App::set_forms_version(CJS_Runtime* pRuntime,
                                       v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::get_viewer_type(CJS_Runtime* pRuntime) {
@@ -144,7 +144,7 @@
 
 CJS_Return CJS_App::set_viewer_type(CJS_Runtime* pRuntime,
                                     v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::get_viewer_variation(CJS_Runtime* pRuntime) {
@@ -153,7 +153,7 @@
 
 CJS_Return CJS_App::set_viewer_variation(CJS_Runtime* pRuntime,
                                          v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::get_viewer_version(CJS_Runtime* pRuntime) {
@@ -167,14 +167,14 @@
 
 CJS_Return CJS_App::set_viewer_version(CJS_Runtime* pRuntime,
                                        v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::get_platform(CJS_Runtime* pRuntime) {
 #ifdef PDF_ENABLE_XFA
   CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv();
   if (!pFormFillEnv)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   WideString platfrom = pFormFillEnv->GetPlatform();
   if (!platfrom.IsEmpty())
@@ -185,14 +185,14 @@
 
 CJS_Return CJS_App::set_platform(CJS_Runtime* pRuntime,
                                  v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::get_language(CJS_Runtime* pRuntime) {
 #ifdef PDF_ENABLE_XFA
   CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv();
   if (!pFormFillEnv)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   WideString language = pFormFillEnv->GetLanguage();
   if (!language.IsEmpty())
@@ -203,7 +203,7 @@
 
 CJS_Return CJS_App::set_language(CJS_Runtime* pRuntime,
                                  v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 // creates a new fdf object that contains no data
@@ -212,7 +212,7 @@
 // CFDF_Document * CPDFSDK_FormFillEnvironment::NewFDF();
 CJS_Return CJS_App::newFDF(CJS_Runtime* pRuntime,
                            const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 // opens a specified pdf document and returns its document object
@@ -224,7 +224,7 @@
 
 CJS_Return CJS_App::openFDF(CJS_Runtime* pRuntime,
                             const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_App::alert(CJS_Runtime* pRuntime,
@@ -233,7 +233,7 @@
       pRuntime, params, 4, L"cMsg", L"nIcon", L"nType", L"cTitle");
 
   if (!IsTypeKnown(newParams[0]))
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv();
   if (!pFormFillEnv)
@@ -280,41 +280,41 @@
 CJS_Return CJS_App::beep(CJS_Runtime* pRuntime,
                          const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   pRuntime->GetFormFillEnv()->JS_appBeep(pRuntime->ToInt32(params[0]));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_App::findComponent(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_App::popUpMenuEx(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::get_fs(CJS_Runtime* pRuntime) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::set_fs(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::setInterval(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() == 0 || params.size() > 2)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   WideString script = pRuntime->ToWideString(params[0]);
   if (script.IsEmpty())
-    return CJS_Return(JSGetStringFromID(JSMessage::kInvalidInputError));
+    return CJS_Return(JSMessage::kInvalidInputError);
 
   uint32_t dwInterval = params.size() > 1 ? pRuntime->ToInt32(params[1]) : 1000;
   auto timerRef = pdfium::MakeUnique<GlobalTimer>(
@@ -325,7 +325,7 @@
   v8::Local<v8::Object> pRetObj =
       pRuntime->NewFXJSBoundObject(CJS_TimerObj::GetObjDefnID());
   if (pRetObj.IsEmpty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   auto* pJS_TimerObj =
       static_cast<CJS_TimerObj*>(CFXJS_Engine::GetObjectPrivate(pRetObj));
@@ -338,11 +338,11 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() == 0 || params.size() > 2)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   WideString script = pRuntime->ToWideString(params[0]);
   if (script.IsEmpty())
-    return CJS_Return(JSGetStringFromID(JSMessage::kInvalidInputError));
+    return CJS_Return(JSMessage::kInvalidInputError);
 
   uint32_t dwTimeOut = params.size() > 1 ? pRuntime->ToInt32(params[1]) : 1000;
   auto timerRef = pdfium::MakeUnique<GlobalTimer>(
@@ -354,7 +354,7 @@
   v8::Local<v8::Object> pRetObj =
       pRuntime->NewFXJSBoundObject(CJS_TimerObj::GetObjDefnID());
   if (pRetObj.IsEmpty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   auto* pJS_TimerObj =
       static_cast<CJS_TimerObj*>(CFXJS_Engine::GetObjectPrivate(pRetObj));
@@ -367,20 +367,20 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   CJS_App::ClearTimerCommon(pRuntime, params[0]);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_App::clearInterval(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   CJS_App::ClearTimerCommon(pRuntime, params[0]);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJS_App::ClearTimerCommon(CJS_Runtime* pRuntime,
@@ -402,7 +402,7 @@
 CJS_Return CJS_App::execMenuItem(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 void CJS_App::TimerProc(GlobalTimer* pTimer) {
@@ -427,13 +427,13 @@
 CJS_Return CJS_App::goBack(CJS_Runtime* pRuntime,
                            const std::vector<v8::Local<v8::Value>>& params) {
   // Not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_App::goForward(CJS_Runtime* pRuntime,
                               const std::vector<v8::Local<v8::Value>>& params) {
   // Not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_App::mailMsg(CJS_Runtime* pRuntime,
@@ -443,7 +443,7 @@
                           L"cSubject", L"cMsg");
 
   if (!IsTypeKnown(newParams[0]))
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   bool bUI = pRuntime->ToBoolean(newParams[0]);
   WideString cTo;
@@ -452,7 +452,7 @@
   } else {
     // cTo parameter required when UI not invoked.
     if (!bUI)
-      return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+      return CJS_Return(JSMessage::kParamError);
   }
 
   WideString cCc;
@@ -475,13 +475,13 @@
   pRuntime->GetFormFillEnv()->JS_docmailForm(nullptr, 0, bUI, cTo, cSubject,
                                              cCc, cBcc, cMsg);
   pRuntime->EndBlock();
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_App::launchURL(CJS_Runtime* pRuntime,
                               const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_App::get_runtime_highlight(CJS_Runtime* pRuntime) {
@@ -491,28 +491,28 @@
 CJS_Return CJS_App::set_runtime_highlight(CJS_Runtime* pRuntime,
                                           v8::Local<v8::Value> vp) {
   m_bRuntimeHighLight = pRuntime->ToBoolean(vp);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_App::get_fullscreen(CJS_Runtime* pRuntime) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::set_fullscreen(CJS_Runtime* pRuntime,
                                    v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::popUpMenu(CJS_Runtime* pRuntime,
                               const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::browseForDoc(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 WideString CJS_App::SysPathToPDFPath(const WideString& sOldPath) {
@@ -526,12 +526,12 @@
 
 CJS_Return CJS_App::newDoc(CJS_Runtime* pRuntime,
                            const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::openDoc(CJS_Runtime* pRuntime,
                             const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::response(CJS_Runtime* pRuntime,
@@ -541,7 +541,7 @@
                           L"cDefault", L"bPassword", L"cLabel");
 
   if (!IsTypeKnown(newParams[0]))
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   WideString swQuestion = pRuntime->ToWideString(newParams[0]);
   WideString swTitle = L"PDF";
@@ -567,7 +567,7 @@
       MAX_INPUT_BYTES);
 
   if (nLengthBytes < 0 || nLengthBytes > MAX_INPUT_BYTES)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamTooLongError));
+    return CJS_Return(JSMessage::kParamTooLongError);
 
   return CJS_Return(pRuntime->NewString(
       WideString::FromUTF16LE(reinterpret_cast<uint16_t*>(pBuff.data()),
@@ -576,15 +576,15 @@
 }
 
 CJS_Return CJS_App::get_media(CJS_Runtime* pRuntime) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::set_media(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_App::execDialog(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
diff --git a/fxjs/cjs_color.cpp b/fxjs/cjs_color.cpp
index e46ddce..282c58f 100644
--- a/fxjs/cjs_color.cpp
+++ b/fxjs/cjs_color.cpp
@@ -253,19 +253,17 @@
                                         v8::Local<v8::Value> vp,
                                         CFX_Color* var) {
   if (vp.IsEmpty() || !vp->IsArray())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kParamError);
 
   *var = ConvertArrayToPWLColor(pRuntime, pRuntime->ToArray(vp));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Color::convert(CJS_Runtime* pRuntime,
                               const std::vector<v8::Local<v8::Value>>& params) {
   int iSize = params.size();
-  if (iSize < 2)
-    return CJS_Return(false);
-  if (params[0].IsEmpty() || !params[0]->IsArray())
-    return CJS_Return(false);
+  if (iSize < 2 || params[0].IsEmpty() || !params[0]->IsArray())
+    return CJS_Return(JSMessage::kParamError);
 
   WideString sDestSpace = pRuntime->ToWideString(params[1]);
   int nColorType = CFX_Color::kTransparent;
@@ -290,11 +288,9 @@
 
 CJS_Return CJS_Color::equal(CJS_Runtime* pRuntime,
                             const std::vector<v8::Local<v8::Value>>& params) {
-  if (params.size() < 2)
-    return CJS_Return(false);
-  if (params[0].IsEmpty() || !params[0]->IsArray() || params[1].IsEmpty() ||
-      !params[1]->IsArray()) {
-    return CJS_Return(false);
+  if (params.size() < 2 || params[0].IsEmpty() || !params[0]->IsArray() ||
+      params[1].IsEmpty() || !params[1]->IsArray()) {
+    return CJS_Return(JSMessage::kParamError);
   }
 
   CFX_Color color1 =
diff --git a/fxjs/cjs_console.cpp b/fxjs/cjs_console.cpp
index 867913c..02babea 100644
--- a/fxjs/cjs_console.cpp
+++ b/fxjs/cjs_console.cpp
@@ -35,21 +35,21 @@
 
 CJS_Return CJS_Console::clear(CJS_Runtime* pRuntime,
                               const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Console::hide(CJS_Runtime* pRuntime,
                              const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Console::println(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(params.size() > 0);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Console::show(CJS_Runtime* pRuntime,
                              const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index d6dc4d6..a259767 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -135,7 +135,7 @@
 // The total number of fields in document.
 CJS_Return CJS_Document::get_num_fields(CJS_Runtime* pRuntime) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
   CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
@@ -145,23 +145,23 @@
 
 CJS_Return CJS_Document::set_num_fields(CJS_Runtime* pRuntime,
                                         v8::Local<v8::Value> vp) {
-  return CJS_Return(JSGetStringFromID(JSMessage::kReadOnlyError));
+  return CJS_Return(JSMessage::kReadOnlyError);
 }
 
 CJS_Return CJS_Document::get_dirty(CJS_Runtime* pRuntime) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
   return CJS_Return(pRuntime->NewBoolean(!!m_pFormFillEnv->GetChangeMark()));
 }
 
 CJS_Return CJS_Document::set_dirty(CJS_Runtime* pRuntime,
                                    v8::Local<v8::Value> vp) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   pRuntime->ToBoolean(vp) ? m_pFormFillEnv->SetChangeMark()
                           : m_pFormFillEnv->ClearChangeMark();
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::get_ADBE(CJS_Runtime* pRuntime) {
@@ -170,12 +170,12 @@
 
 CJS_Return CJS_Document::set_ADBE(CJS_Runtime* pRuntime,
                                   v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::get_page_num(CJS_Runtime* pRuntime) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetCurrentView();
   if (!pPageView)
@@ -186,7 +186,7 @@
 CJS_Return CJS_Document::set_page_num(CJS_Runtime* pRuntime,
                                       v8::Local<v8::Value> vp) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   int iPageCount = m_pFormFillEnv->GetPageCount();
   int iPageNum = pRuntime->ToInt32(vp);
@@ -197,51 +197,51 @@
   else if (iPageNum < 0)
     m_pFormFillEnv->JS_docgotoPage(0);
 
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::addAnnot(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::addField(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::exportAsText(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::exportAsFDF(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::exportAsXFDF(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::getField(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.empty())
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   WideString wideName = pRuntime->ToWideString(params[0]);
   CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
@@ -252,12 +252,12 @@
   v8::Local<v8::Object> pFieldObj =
       pRuntime->NewFXJSBoundObject(CJS_Field::GetObjDefnID());
   if (pFieldObj.IsEmpty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   auto* pJSField =
       static_cast<CJS_Field*>(CFXJS_Engine::GetObjectPrivate(pFieldObj));
   if (!pJSField)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   pJSField->AttachField(this, wideName);
   return CJS_Return(pJSField->ToV8Object());
@@ -268,19 +268,19 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   int nIndex = pRuntime->ToInt32(params[0]);
   if (nIndex < 0)
-    return CJS_Return(JSGetStringFromID(JSMessage::kValueError));
+    return CJS_Return(JSMessage::kValueError);
 
   CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
   CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
   CPDF_FormField* pField = pPDFForm->GetField(nIndex, WideString());
   if (!pField)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
   return CJS_Return(pRuntime->NewString(pField->GetFullName().c_str()));
 }
 
@@ -288,21 +288,21 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::importAnXFDF(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::importTextData(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 // exports the form data and mails the resulting fdf file as an attachment to
@@ -312,14 +312,14 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
   if (!m_pFormFillEnv->GetPermissions(FPDFPERM_EXTRACT_ACCESS))
-    return CJS_Return(JSGetStringFromID(JSMessage::kPermissionError));
+    return CJS_Return(JSMessage::kPermissionError);
 
   CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
   ByteString sTextBuf = pInterForm->ExportFormToFDFTextBuf();
   if (sTextBuf.GetLength() == 0)
-    return CJS_Return(false);
+    return CJS_Return(L"Bad FDF format.");
 
   size_t nLength = params.size();
   bool bUI = nLength > 0 ? pRuntime->ToBoolean(params[0]) : true;
@@ -338,14 +338,14 @@
   pFormFillEnv->JS_docmailForm(pMutableBuf.get(), nBufSize, bUI, cTo, cSubject,
                                cCc, cBcc, cMsg);
   pRuntime->EndBlock();
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::print(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   bool bUI = true;
   int nStart = 0;
@@ -397,11 +397,11 @@
   }
 
   if (!m_pFormFillEnv)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   m_pFormFillEnv->JS_docprint(bUI, nStart, nEnd, bSilent, bShrinkToFit,
                               bPrintAsImage, bReverse, bAnnotations);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 // removes the specified field from the document.
@@ -412,20 +412,20 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   if (!(m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY) ||
         m_pFormFillEnv->GetPermissions(FPDFPERM_ANNOT_FORM)))
-    return CJS_Return(JSGetStringFromID(JSMessage::kPermissionError));
+    return CJS_Return(JSMessage::kPermissionError);
 
   WideString sFieldName = pRuntime->ToWideString(params[0]);
   CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
   std::vector<CPDFSDK_Annot::ObservedPtr> widgets;
   pInterForm->GetWidgets(sFieldName, &widgets);
   if (widgets.empty())
-    return CJS_Return(true);
+    return CJS_Return();
 
   for (const auto& pAnnot : widgets) {
     CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot.Get());
@@ -455,7 +455,7 @@
   }
   m_pFormFillEnv->SetChangeMark();
 
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 // reset filed values within a document.
@@ -466,11 +466,11 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
   if (!(m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY) ||
         m_pFormFillEnv->GetPermissions(FPDFPERM_ANNOT_FORM) ||
         m_pFormFillEnv->GetPermissions(FPDFPERM_FILL_FORM))) {
-    return CJS_Return(JSGetStringFromID(JSMessage::kPermissionError));
+    return CJS_Return(JSMessage::kPermissionError);
   }
 
   CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
@@ -478,7 +478,7 @@
   if (params.empty()) {
     pPDFForm->ResetForm(true);
     m_pFormFillEnv->SetChangeMark();
-    return CJS_Return(true);
+    return CJS_Return();
   }
 
   v8::Local<v8::Array> array;
@@ -502,20 +502,20 @@
     m_pFormFillEnv->SetChangeMark();
   }
 
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::saveAs(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::syncAnnotScan(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::submitForm(
@@ -523,9 +523,9 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   size_t nSize = params.size();
   if (nSize < 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   v8::Local<v8::Array> aFields;
   WideString strURL;
@@ -559,7 +559,7 @@
       pInterForm->SubmitForm(strURL, false);
       pRuntime->EndBlock();
     }
-    return CJS_Return(true);
+    return CJS_Return();
   }
 
   std::vector<CPDF_FormField*> fieldObjects;
@@ -581,7 +581,7 @@
     pInterForm->SubmitFields(strURL, fieldObjects, true, !bFDF);
     pRuntime->EndBlock();
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJS_Document::SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv) {
@@ -589,12 +589,12 @@
 }
 
 CJS_Return CJS_Document::get_bookmark_root(CJS_Runtime* pRuntime) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::set_bookmark_root(CJS_Runtime* pRuntime,
                                            v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::mailDoc(
@@ -637,7 +637,7 @@
   CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv();
   pFormFillEnv->JS_docmailForm(nullptr, 0, bUI, cTo, cSubject, cCc, cBcc, cMsg);
   pRuntime->EndBlock();
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::get_author(CJS_Runtime* pRuntime) {
@@ -651,11 +651,11 @@
 
 CJS_Return CJS_Document::get_info(CJS_Runtime* pRuntime) {
   if (!m_pFormFillEnv)
-    CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   const auto* pDictionary = m_pFormFillEnv->GetPDFDocument()->GetInfo();
   if (!pDictionary)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   WideString cwAuthor = pDictionary->GetUnicodeTextFor("Author");
   WideString cwTitle = pDictionary->GetUnicodeTextFor("Title");
@@ -710,17 +710,17 @@
 
 CJS_Return CJS_Document::set_info(CJS_Runtime* pRuntime,
                                   v8::Local<v8::Value> vp) {
-  return CJS_Return(JSGetStringFromID(JSMessage::kReadOnlyError));
+  return CJS_Return(JSMessage::kReadOnlyError);
 }
 
 CJS_Return CJS_Document::getPropertyInternal(CJS_Runtime* pRuntime,
                                              const ByteString& propName) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_Dictionary* pDictionary = m_pFormFillEnv->GetPDFDocument()->GetInfo();
   if (!pDictionary)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
   return CJS_Return(
       pRuntime->NewString(pDictionary->GetUnicodeTextFor(propName).c_str()));
 }
@@ -729,20 +729,20 @@
                                              v8::Local<v8::Value> vp,
                                              const ByteString& propName) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_Dictionary* pDictionary = m_pFormFillEnv->GetPDFDocument()->GetInfo();
   if (!pDictionary)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   if (!m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY))
-    return CJS_Return(JSGetStringFromID(JSMessage::kPermissionError));
+    return CJS_Return(JSMessage::kPermissionError);
 
   WideString csProperty = pRuntime->ToWideString(vp);
   pDictionary->SetNewFor<CPDF_String>(propName, PDF_EncodeText(csProperty),
                                       false);
   m_pFormFillEnv->SetChangeMark();
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::get_creation_date(CJS_Runtime* pRuntime) {
@@ -765,21 +765,21 @@
 
 CJS_Return CJS_Document::get_delay(CJS_Runtime* pRuntime) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
   return CJS_Return(pRuntime->NewBoolean(m_bDelay));
 }
 
 CJS_Return CJS_Document::set_delay(CJS_Runtime* pRuntime,
                                    v8::Local<v8::Value> vp) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
   if (!m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY))
-    return CJS_Return(JSGetStringFromID(JSMessage::kPermissionError));
+    return CJS_Return(JSMessage::kPermissionError);
 
   m_bDelay = pRuntime->ToBoolean(vp);
   if (m_bDelay) {
     m_DelayData.clear();
-    return CJS_Return(true);
+    return CJS_Return();
   }
 
   std::list<std::unique_ptr<CJS_DelayData>> DelayDataToProcess;
@@ -787,7 +787,7 @@
   for (const auto& pData : DelayDataToProcess)
     CJS_Field::DoDelay(m_pFormFillEnv.Get(), pData.get());
 
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::get_keywords(CJS_Runtime* pRuntime) {
@@ -828,26 +828,26 @@
 
 CJS_Return CJS_Document::get_title(CJS_Runtime* pRuntime) {
   if (!m_pFormFillEnv || !m_pFormFillEnv->GetPDFDocument())
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
   return getPropertyInternal(pRuntime, "Title");
 }
 
 CJS_Return CJS_Document::set_title(CJS_Runtime* pRuntime,
                                    v8::Local<v8::Value> vp) {
   if (!m_pFormFillEnv || !m_pFormFillEnv->GetPDFDocument())
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
   return setPropertyInternal(pRuntime, vp, "Title");
 }
 
 CJS_Return CJS_Document::get_num_pages(CJS_Runtime* pRuntime) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
   return CJS_Return(pRuntime->NewNumber(m_pFormFillEnv->GetPageCount()));
 }
 
 CJS_Return CJS_Document::set_num_pages(CJS_Runtime* pRuntime,
                                        v8::Local<v8::Value> vp) {
-  return CJS_Return(JSGetStringFromID(JSMessage::kReadOnlyError));
+  return CJS_Return(JSMessage::kReadOnlyError);
 }
 
 CJS_Return CJS_Document::get_external(CJS_Runtime* pRuntime) {
@@ -857,7 +857,7 @@
 
 CJS_Return CJS_Document::set_external(CJS_Runtime* pRuntime,
                                       v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::get_filesize(CJS_Runtime* pRuntime) {
@@ -866,37 +866,37 @@
 
 CJS_Return CJS_Document::set_filesize(CJS_Runtime* pRuntime,
                                       v8::Local<v8::Value> vp) {
-  return CJS_Return(JSGetStringFromID(JSMessage::kReadOnlyError));
+  return CJS_Return(JSMessage::kReadOnlyError);
 }
 
 CJS_Return CJS_Document::get_mouse_x(CJS_Runtime* pRuntime) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::set_mouse_x(CJS_Runtime* pRuntime,
                                      v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::get_mouse_y(CJS_Runtime* pRuntime) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::set_mouse_y(CJS_Runtime* pRuntime,
                                      v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::get_URL(CJS_Runtime* pRuntime) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
   return CJS_Return(
       pRuntime->NewString(m_pFormFillEnv->JS_docGetFilePath().c_str()));
 }
 
 CJS_Return CJS_Document::set_URL(CJS_Runtime* pRuntime,
                                  v8::Local<v8::Value> vp) {
-  return CJS_Return(JSGetStringFromID(JSMessage::kReadOnlyError));
+  return CJS_Return(JSMessage::kReadOnlyError);
 }
 
 CJS_Return CJS_Document::get_base_URL(CJS_Runtime* pRuntime) {
@@ -906,12 +906,12 @@
 CJS_Return CJS_Document::set_base_URL(CJS_Runtime* pRuntime,
                                       v8::Local<v8::Value> vp) {
   m_cwBaseURL = pRuntime->ToWideString(vp);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::get_calculate(CJS_Runtime* pRuntime) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
   return CJS_Return(pRuntime->NewBoolean(!!pInterForm->IsCalculateEnabled()));
@@ -920,16 +920,16 @@
 CJS_Return CJS_Document::set_calculate(CJS_Runtime* pRuntime,
                                        v8::Local<v8::Value> vp) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
   pInterForm->EnableCalculate(pRuntime->ToBoolean(vp));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::get_document_file_name(CJS_Runtime* pRuntime) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   WideString wsFilePath = m_pFormFillEnv->JS_docGetFilePath();
   size_t i = wsFilePath.GetLength();
@@ -945,70 +945,70 @@
 
 CJS_Return CJS_Document::set_document_file_name(CJS_Runtime* pRuntime,
                                                 v8::Local<v8::Value> vp) {
-  return CJS_Return(JSGetStringFromID(JSMessage::kReadOnlyError));
+  return CJS_Return(JSMessage::kReadOnlyError);
 }
 
 CJS_Return CJS_Document::get_path(CJS_Runtime* pRuntime) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
   return CJS_Return(pRuntime->NewString(
       CJS_App::SysPathToPDFPath(m_pFormFillEnv->JS_docGetFilePath()).c_str()));
 }
 
 CJS_Return CJS_Document::set_path(CJS_Runtime* pRuntime,
                                   v8::Local<v8::Value> vp) {
-  return CJS_Return(JSGetStringFromID(JSMessage::kReadOnlyError));
+  return CJS_Return(JSMessage::kReadOnlyError);
 }
 
 CJS_Return CJS_Document::get_page_window_rect(CJS_Runtime* pRuntime) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::set_page_window_rect(CJS_Runtime* pRuntime,
                                               v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::get_layout(CJS_Runtime* pRuntime) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::set_layout(CJS_Runtime* pRuntime,
                                     v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::addLink(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::closeDoc(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::getPageBox(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::getAnnot(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 2)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   int nPageNo = pRuntime->ToInt32(params[0]);
   WideString swAnnotName = pRuntime->ToWideString(params[1]);
   CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetPageView(nPageNo);
   if (!pPageView)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDFSDK_AnnotIteration annotIteration(pPageView, false);
   CPDFSDK_BAAnnot* pSDKBAAnnot = nullptr;
@@ -1020,17 +1020,17 @@
     }
   }
   if (!pSDKBAAnnot)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   v8::Local<v8::Object> pObj =
       pRuntime->NewFXJSBoundObject(CJS_Annot::GetObjDefnID());
   if (pObj.IsEmpty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   auto* pJS_Annot =
       static_cast<CJS_Annot*>(CFXJS_Engine::GetObjectPrivate(pObj));
   if (!pJS_Annot)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   pJS_Annot->SetSDKAnnot(pSDKBAAnnot);
   return CJS_Return(pJS_Annot->ToV8Object());
@@ -1040,7 +1040,7 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   // TODO(tonikitoo): Add support supported parameters as per
   // the PDF spec.
@@ -1050,17 +1050,17 @@
   for (int i = 0; i < nPageNo; ++i) {
     CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetPageView(i);
     if (!pPageView)
-      return CJS_Return(false);
+      return CJS_Return(JSMessage::kBadObjectError);
 
     CPDFSDK_AnnotIteration annotIteration(pPageView, false);
     for (const auto& pSDKAnnotCur : annotIteration) {
       if (!pSDKAnnotCur)
-        return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+        return CJS_Return(JSMessage::kBadObjectError);
 
       v8::Local<v8::Object> pObj =
           pRuntime->NewFXJSBoundObject(CJS_Annot::GetObjDefnID());
       if (pObj.IsEmpty())
-        return CJS_Return(false);
+        return CJS_Return(JSMessage::kBadObjectError);
 
       auto* pJS_Annot =
           static_cast<CJS_Annot*>(CFXJS_Engine::GetObjectPrivate(pObj));
@@ -1083,19 +1083,19 @@
 CJS_Return CJS_Document::getAnnots3D(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::getOCGs(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::getLinks(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 bool CJS_Document::IsEnclosedInRect(CFX_FloatRect rect,
@@ -1108,23 +1108,23 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 2)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   if (!params[1]->IsObject())
-    return CJS_Return(JSGetStringFromID(JSMessage::kTypeError));
+    return CJS_Return(JSMessage::kTypeError);
 
   v8::Local<v8::Object> pJSIcon = pRuntime->ToObject(params[1]);
   if (CFXJS_Engine::GetObjDefnID(pJSIcon) != CJS_Icon::GetObjDefnID())
-    return CJS_Return(JSGetStringFromID(JSMessage::kTypeError));
+    return CJS_Return(JSMessage::kTypeError);
 
   v8::Local<v8::Object> pObj = pRuntime->ToObject(params[1]);
   CJS_Object* obj = CFXJS_Engine::GetObjectPrivate(pObj);
   if (!obj)
-    return CJS_Return(JSGetStringFromID(JSMessage::kTypeError));
+    return CJS_Return(JSMessage::kTypeError);
 
   WideString swIconName = pRuntime->ToWideString(params[0]);
   m_IconNames.push_back(swIconName);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::get_icons(CJS_Runtime* pRuntime) {
@@ -1137,7 +1137,7 @@
     v8::Local<v8::Object> pObj =
         pRuntime->NewFXJSBoundObject(CJS_Icon::GetObjDefnID());
     if (pObj.IsEmpty())
-      return CJS_Return(false);
+      return CJS_Return(JSMessage::kBadObjectError);
 
     auto* pJS_Icon =
         static_cast<CJS_Icon*>(CFXJS_Engine::GetObjectPrivate(pObj));
@@ -1152,28 +1152,28 @@
 
 CJS_Return CJS_Document::set_icons(CJS_Runtime* pRuntime,
                                    v8::Local<v8::Value> vp) {
-  return CJS_Return(JSGetStringFromID(JSMessage::kReadOnlyError));
+  return CJS_Return(JSMessage::kReadOnlyError);
 }
 
 CJS_Return CJS_Document::getIcon(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   WideString swIconName = pRuntime->ToWideString(params[0]);
   auto it = std::find(m_IconNames.begin(), m_IconNames.end(), swIconName);
   if (it == m_IconNames.end())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   v8::Local<v8::Object> pObj =
       pRuntime->NewFXJSBoundObject(CJS_Icon::GetObjDefnID());
   if (pObj.IsEmpty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   auto* pJSIcon = static_cast<CJS_Icon*>(CFXJS_Engine::GetObjectPrivate(pObj));
   if (!pJSIcon)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   pJSIcon->SetIconName(*it);
   return CJS_Return(pJSIcon->ToV8Object());
@@ -1183,57 +1183,57 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, no supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::createDataObject(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not implemented.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::get_media(CJS_Runtime* pRuntime) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::set_media(CJS_Runtime* pRuntime,
                                    v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::calculateNow(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   if (!(m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY) ||
         m_pFormFillEnv->GetPermissions(FPDFPERM_ANNOT_FORM) ||
         m_pFormFillEnv->GetPermissions(FPDFPERM_FILL_FORM))) {
-    return CJS_Return(JSGetStringFromID(JSMessage::kPermissionError));
+    return CJS_Return(JSMessage::kPermissionError);
   }
 
   m_pFormFillEnv->GetInterForm()->OnCalculate();
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::get_collab(CJS_Runtime* pRuntime) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::set_collab(CJS_Runtime* pRuntime,
                                     v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::getPageNthWord(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
   if (!m_pFormFillEnv->GetPermissions(FPDFPERM_EXTRACT_ACCESS))
-    return CJS_Return(JSGetStringFromID(JSMessage::kPermissionError));
+    return CJS_Return(JSMessage::kPermissionError);
 
   // TODO(tsepez): check maximum allowable params.
 
@@ -1243,14 +1243,14 @@
 
   CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument();
   if (!pDocument)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   if (nPageNo < 0 || nPageNo >= pDocument->GetPageCount())
-    return CJS_Return(JSGetStringFromID(JSMessage::kValueError));
+    return CJS_Return(JSMessage::kValueError);
 
   CPDF_Dictionary* pPageDict = pDocument->GetPageDictionary(nPageNo);
   if (!pPageDict)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   auto page = pdfium::MakeRetain<CPDF_Page>(pDocument, pPageDict, true);
   page->ParseContent();
@@ -1278,28 +1278,28 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
   if (!m_pFormFillEnv->GetPermissions(FPDFPERM_EXTRACT_ACCESS))
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
-  return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Document::getPageNumWords(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
   if (!m_pFormFillEnv->GetPermissions(FPDFPERM_EXTRACT_ACCESS))
-    return CJS_Return(JSGetStringFromID(JSMessage::kPermissionError));
+    return CJS_Return(JSMessage::kPermissionError);
 
   int nPageNo = params.size() > 0 ? pRuntime->ToInt32(params[0]) : 0;
   CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument();
   if (nPageNo < 0 || nPageNo >= pDocument->GetPageCount())
-    return CJS_Return(JSGetStringFromID(JSMessage::kValueError));
+    return CJS_Return(JSMessage::kValueError);
 
   CPDF_Dictionary* pPageDict = pDocument->GetPageDictionary(nPageNo);
   if (!pPageDict)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   auto page = pdfium::MakeRetain<CPDF_Page>(pDocument, pPageDict, true);
   page->ParseContent();
@@ -1319,11 +1319,8 @@
   v8::Local<v8::Object> pRetObj =
       pRuntime->NewFXJSBoundObject(CJS_PrintParamsObj::GetObjDefnID());
   if (pRetObj.IsEmpty())
-    return CJS_Return(false);
-
-  // Not implemented yet.
-
-  return CJS_Return(pRetObj);
+    return CJS_Return(JSMessage::kBadObjectError);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 #define ISLATINWORD(u) (u != 0x20 && u <= 0x28FF)
@@ -1332,14 +1329,12 @@
   if (!pTextObj)
     return 0;
 
-  int nWords = 0;
-
   CPDF_Font* pFont = pTextObj->GetFont();
   if (!pFont)
     return 0;
 
   bool bIsLatin = false;
-
+  int nWords = 0;
   for (size_t i = 0, sz = pTextObj->CountChars(); i < sz; ++i) {
     uint32_t charcode = CPDF_Font::kInvalidCharCode;
     float kerning;
@@ -1399,75 +1394,76 @@
 }
 
 CJS_Return CJS_Document::get_zoom(CJS_Runtime* pRuntime) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::set_zoom(CJS_Runtime* pRuntime,
                                   v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::get_zoom_type(CJS_Runtime* pRuntime) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::set_zoom_type(CJS_Runtime* pRuntime,
                                        v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::deletePages(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::extractPages(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::insertPages(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::replacePages(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::getURL(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Document::gotoNamedDest(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
+
   if (!m_pFormFillEnv)
-    return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument();
   if (!pDocument)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_NameTree nameTree(pDocument, "Dests");
   CPDF_Array* destArray =
       nameTree.LookupNamedDest(pDocument, pRuntime->ToWideString(params[0]));
   if (!destArray)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_Dest dest(destArray);
   const CPDF_Array* arrayObject = ToArray(dest.GetObject());
@@ -1481,7 +1477,7 @@
                                dest.GetZoomMode(), scrollPositionArray.data(),
                                scrollPositionArray.size());
   pRuntime->EndBlock();
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJS_Document::AddDelayData(std::unique_ptr<CJS_DelayData> pData) {
diff --git a/fxjs/cjs_event.cpp b/fxjs/cjs_event.cpp
index de22ab8..841d900 100644
--- a/fxjs/cjs_event.cpp
+++ b/fxjs/cjs_event.cpp
@@ -68,7 +68,7 @@
     WideString& wChange = pEvent->Change();
     wChange = pRuntime->ToWideString(vp);
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Event::get_change_ex(CJS_Runtime* pRuntime) {
@@ -82,7 +82,7 @@
 
 CJS_Return CJS_Event::set_change_ex(CJS_Runtime* pRuntime,
                                     v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Event::get_commit_key(CJS_Runtime* pRuntime) {
@@ -96,7 +96,7 @@
 
 CJS_Return CJS_Event::set_commit_key(CJS_Runtime* pRuntime,
                                      v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Event::get_field_full(CJS_Runtime* pRuntime) {
@@ -106,14 +106,14 @@
       pRuntime->GetCurrentEventContext()->GetEventHandler();
 
   if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
-    return CJS_Return(false);
+    return CJS_Return(L"unrecognized event");
 
   return CJS_Return(pRuntime->NewBoolean(pEvent->FieldFull()));
 }
 
 CJS_Return CJS_Event::set_field_full(CJS_Runtime* pRuntime,
                                      v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Event::get_key_down(CJS_Runtime* pRuntime) {
@@ -124,7 +124,7 @@
 
 CJS_Return CJS_Event::set_key_down(CJS_Runtime* pRuntime,
                                    v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Event::get_modifier(CJS_Runtime* pRuntime) {
@@ -135,7 +135,7 @@
 
 CJS_Return CJS_Event::set_modifier(CJS_Runtime* pRuntime,
                                    v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Event::get_name(CJS_Runtime* pRuntime) {
@@ -145,7 +145,7 @@
 }
 
 CJS_Return CJS_Event::set_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Event::get_rc(CJS_Runtime* pRuntime) {
@@ -158,34 +158,34 @@
   CJS_EventHandler* pEvent =
       pRuntime->GetCurrentEventContext()->GetEventHandler();
   pEvent->Rc() = pRuntime->ToBoolean(vp);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Event::get_rich_change(CJS_Runtime* pRuntime) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Event::set_rich_change(CJS_Runtime* pRuntime,
                                       v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Event::get_rich_change_ex(CJS_Runtime* pRuntime) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Event::set_rich_change_ex(CJS_Runtime* pRuntime,
                                          v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Event::get_rich_value(CJS_Runtime* pRuntime) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Event::set_rich_value(CJS_Runtime* pRuntime,
                                      v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Event::get_sel_end(CJS_Runtime* pRuntime) {
@@ -193,7 +193,7 @@
       pRuntime->GetCurrentEventContext()->GetEventHandler();
 
   if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
-    return CJS_Return(true);
+    return CJS_Return();
 
   return CJS_Return(pRuntime->NewNumber(pEvent->SelEnd()));
 }
@@ -204,10 +204,10 @@
       pRuntime->GetCurrentEventContext()->GetEventHandler();
 
   if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
-    return CJS_Return(true);
+    return CJS_Return();
 
   pEvent->SetSelEnd(pRuntime->ToInt32(vp));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Event::get_sel_start(CJS_Runtime* pRuntime) {
@@ -215,7 +215,7 @@
       pRuntime->GetCurrentEventContext()->GetEventHandler();
 
   if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
-    return CJS_Return(true);
+    return CJS_Return();
 
   return CJS_Return(pRuntime->NewNumber(pEvent->SelStart()));
 }
@@ -226,10 +226,10 @@
       pRuntime->GetCurrentEventContext()->GetEventHandler();
 
   if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
-    return CJS_Return(true);
+    return CJS_Return();
 
   pEvent->SetSelStart(pRuntime->ToInt32(vp));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Event::get_shift(CJS_Runtime* pRuntime) {
@@ -240,7 +240,7 @@
 
 CJS_Return CJS_Event::set_shift(CJS_Runtime* pRuntime,
                                 v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Event::get_source(CJS_Runtime* pRuntime) {
@@ -251,7 +251,7 @@
 
 CJS_Return CJS_Event::set_source(CJS_Runtime* pRuntime,
                                  v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Event::get_target(CJS_Runtime* pRuntime) {
@@ -264,7 +264,7 @@
 
 CJS_Return CJS_Event::set_target(CJS_Runtime* pRuntime,
                                  v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Event::get_target_name(CJS_Runtime* pRuntime) {
@@ -277,7 +277,7 @@
 
 CJS_Return CJS_Event::set_target_name(CJS_Runtime* pRuntime,
                                       v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Event::get_type(CJS_Runtime* pRuntime) {
@@ -289,7 +289,7 @@
 }
 
 CJS_Return CJS_Event::set_type(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Event::get_value(CJS_Runtime* pRuntime) {
@@ -299,10 +299,10 @@
       pRuntime->GetCurrentEventContext()->GetEventHandler();
 
   if (wcscmp((const wchar_t*)pEvent->Type(), L"Field") != 0)
-    return CJS_Return(false);
+    return CJS_Return(L"Bad event type.");
 
   if (!pEvent->m_pValue)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   return CJS_Return(pRuntime->NewString(pEvent->Value().c_str()));
 }
@@ -315,13 +315,13 @@
       pRuntime->GetCurrentEventContext()->GetEventHandler();
 
   if (wcscmp((const wchar_t*)pEvent->Type(), L"Field") != 0)
-    return CJS_Return(false);
+    return CJS_Return(L"Bad event type.");
 
   if (!pEvent->m_pValue)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   pEvent->Value() = pRuntime->ToWideString(vp);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Event::get_will_commit(CJS_Runtime* pRuntime) {
@@ -334,5 +334,5 @@
 
 CJS_Return CJS_Event::set_will_commit(CJS_Runtime* pRuntime,
                                       v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index cdbe0df..b3a9f53 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -379,15 +379,15 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kTextField)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   switch (pFormControl->GetControlAlignment()) {
     case 0:
@@ -403,7 +403,9 @@
 CJS_Return CJS_Field::set_alignment(CJS_Runtime* pRuntime,
                                     v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_border_style(CJS_Runtime* pRuntime) {
@@ -411,16 +413,16 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (!pFormField)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDFSDK_Widget* pWidget =
       GetWidget(m_pFormFillEnv.Get(), GetSmartFieldControl(pFormField));
   if (!pWidget)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   switch (pWidget->GetBorderStyle()) {
     case BorderStyle::SOLID:
@@ -440,9 +442,8 @@
 CJS_Return CJS_Field::set_border_style(CJS_Runtime* pRuntime,
                                        v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-
   if (!m_bCanSet)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kReadOnlyError);
 
   ByteString byte_str = ByteString::FromUnicode(pRuntime->ToWideString(vp));
   if (m_bDelay) {
@@ -451,7 +452,7 @@
     CJS_Field::SetBorderStyle(m_pFormFillEnv.Get(), m_FieldName,
                               m_nFormControlIndex, byte_str);
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJS_Field::SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -511,29 +512,30 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kPushButton)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_IconFit IconFit = pFormControl->GetIconFit();
 
   float fLeft;
   float fBottom;
   IconFit.GetIconPosition(fLeft, fBottom);
-
   return CJS_Return(pRuntime->NewNumber(static_cast<int32_t>(fLeft)));
 }
 
 CJS_Return CJS_Field::set_button_align_x(CJS_Runtime* pRuntime,
                                          v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_button_align_y(CJS_Runtime* pRuntime) {
@@ -541,15 +543,15 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kPushButton)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_IconFit IconFit = pFormControl->GetIconFit();
 
@@ -563,7 +565,9 @@
 CJS_Return CJS_Field::set_button_align_y(CJS_Runtime* pRuntime,
                                          v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_button_fit_bounds(CJS_Runtime* pRuntime) {
@@ -571,15 +575,15 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kPushButton)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   return CJS_Return(
       pRuntime->NewBoolean(pFormControl->GetIconFit().GetFittingBounds()));
@@ -588,7 +592,9 @@
 CJS_Return CJS_Field::set_button_fit_bounds(CJS_Runtime* pRuntime,
                                             v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_button_position(CJS_Runtime* pRuntime) {
@@ -596,15 +602,15 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kPushButton)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   return CJS_Return(pRuntime->NewNumber(pFormControl->GetTextPosition()));
 }
@@ -612,7 +618,9 @@
 CJS_Return CJS_Field::set_button_position(CJS_Runtime* pRuntime,
                                           v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kBadObjectError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_button_scale_how(CJS_Runtime* pRuntime) {
@@ -620,15 +628,15 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kPushButton)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   return CJS_Return(pRuntime->NewBoolean(
       pFormControl->GetIconFit().IsProportionalScale() ? 0 : 1));
@@ -637,7 +645,9 @@
 CJS_Return CJS_Field::set_button_scale_how(CJS_Runtime* pRuntime,
                                            v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_button_scale_when(CJS_Runtime* pRuntime) {
@@ -645,15 +655,15 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kPushButton)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_IconFit IconFit = pFormControl->GetIconFit();
   int ScaleM = IconFit.GetScaleMethod();
@@ -671,13 +681,15 @@
       return CJS_Return(
           pRuntime->NewNumber(static_cast<int32_t>(CPDF_IconFit::Smaller)));
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::set_button_scale_when(CJS_Runtime* pRuntime,
                                             v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_calc_order_index(CJS_Runtime* pRuntime) {
@@ -685,12 +697,12 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kComboBox &&
       pFormField->GetFieldType() != FormFieldType::kTextField) {
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
   }
 
   CPDFSDK_InterForm* pRDInterForm = m_pFormFillEnv->GetInterForm();
@@ -702,7 +714,9 @@
 CJS_Return CJS_Field::set_calc_order_index(CJS_Runtime* pRuntime,
                                            v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_char_limit(CJS_Runtime* pRuntime) {
@@ -710,11 +724,11 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kTextField)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
   return CJS_Return(
       pRuntime->NewNumber(static_cast<int32_t>(pFormField->GetMaxLen())));
 }
@@ -722,7 +736,9 @@
 CJS_Return CJS_Field::set_char_limit(CJS_Runtime* pRuntime,
                                      v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_comb(CJS_Runtime* pRuntime) {
@@ -730,11 +746,11 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kTextField)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   return CJS_Return(
       pRuntime->NewBoolean(!!(pFormField->GetFieldFlags() & FIELDFLAG_COMB)));
@@ -742,7 +758,9 @@
 
 CJS_Return CJS_Field::set_comb(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_commit_on_sel_change(CJS_Runtime* pRuntime) {
@@ -750,12 +768,12 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kComboBox &&
       pFormField->GetFieldType() != FormFieldType::kListBox) {
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
   }
 
   return CJS_Return(pRuntime->NewBoolean(
@@ -765,18 +783,20 @@
 CJS_Return CJS_Field::set_commit_on_sel_change(CJS_Runtime* pRuntime,
                                                v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_current_value_indices(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kComboBox &&
       pFormField->GetFieldType() != FormFieldType::kListBox) {
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
   }
 
   int count = pFormField->CountSelectedItems();
@@ -798,7 +818,7 @@
 CJS_Return CJS_Field::set_current_value_indices(CJS_Runtime* pRuntime,
                                                 v8::Local<v8::Value> vp) {
   if (!m_bCanSet)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kReadOnlyError);
 
   std::vector<uint32_t> array;
   if (vp->IsNumber()) {
@@ -817,7 +837,7 @@
     CJS_Field::SetCurrentValueIndices(m_pFormFillEnv.Get(), m_FieldName,
                                       m_nFormControlIndex, array);
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJS_Field::SetCurrentValueIndices(
@@ -849,12 +869,12 @@
 }
 
 CJS_Return CJS_Field::get_default_style(CJS_Runtime* pRuntime) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::set_default_style(CJS_Runtime* pRuntime,
                                         v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::get_default_value(CJS_Runtime* pRuntime) {
@@ -862,12 +882,12 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() == FormFieldType::kPushButton ||
       pFormField->GetFieldType() == FormFieldType::kSignature) {
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
   }
 
   return CJS_Return(pRuntime->NewString(pFormField->GetDefaultValue().c_str()));
@@ -876,7 +896,9 @@
 CJS_Return CJS_Field::set_default_value(CJS_Runtime* pRuntime,
                                         v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_do_not_scroll(CJS_Runtime* pRuntime) {
@@ -884,11 +906,11 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kTextField)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   return CJS_Return(pRuntime->NewBoolean(
       !!(pFormField->GetFieldFlags() & FIELDFLAG_DONOTSCROLL)));
@@ -897,7 +919,9 @@
 CJS_Return CJS_Field::set_do_not_scroll(CJS_Runtime* pRuntime,
                                         v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_do_not_spell_check(CJS_Runtime* pRuntime) {
@@ -905,12 +929,12 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kTextField &&
       pFormField->GetFieldType() != FormFieldType::kComboBox) {
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
   }
 
   return CJS_Return(pRuntime->NewBoolean(
@@ -920,7 +944,9 @@
 CJS_Return CJS_Field::set_do_not_spell_check(CJS_Runtime* pRuntime,
                                              v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 void CJS_Field::SetDelay(bool bDelay) {
@@ -939,16 +965,16 @@
 CJS_Return CJS_Field::set_delay(CJS_Runtime* pRuntime,
                                 v8::Local<v8::Value> vp) {
   if (!m_bCanSet)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kReadOnlyError);
 
   SetDelay(pRuntime->ToBoolean(vp));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_display(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   ASSERT(pFormField);
@@ -957,7 +983,7 @@
   CPDFSDK_Widget* pWidget =
       pInterForm->GetWidget(GetSmartFieldControl(pFormField));
   if (!pWidget)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   uint32_t dwFlag = pWidget->GetFlags();
   if (ANNOTFLAG_INVISIBLE & dwFlag || ANNOTFLAG_HIDDEN & dwFlag)
@@ -974,7 +1000,7 @@
 CJS_Return CJS_Field::set_display(CJS_Runtime* pRuntime,
                                   v8::Local<v8::Value> vp) {
   if (!m_bCanSet)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kReadOnlyError);
 
   if (m_bDelay) {
     AddDelay_Int(FP_DISPLAY, pRuntime->ToInt32(vp));
@@ -982,7 +1008,7 @@
     CJS_Field::SetDisplay(m_pFormFillEnv.Get(), m_FieldName,
                           m_nFormControlIndex, pRuntime->ToInt32(vp));
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJS_Field::SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1026,17 +1052,17 @@
 }
 
 CJS_Return CJS_Field::set_doc(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::get_editable(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kComboBox)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   return CJS_Return(
       pRuntime->NewBoolean(!!(pFormField->GetFieldFlags() & FIELDFLAG_EDIT)));
@@ -1044,18 +1070,20 @@
 
 CJS_Return CJS_Field::set_editable(CJS_Runtime* pRuntime,
                                    v8::Local<v8::Value> vp) {
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_export_values(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kCheckBox &&
       pFormField->GetFieldType() != FormFieldType::kRadioButton) {
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
   }
 
   v8::Local<v8::Array> ExportValuesArray = pRuntime->NewArray();
@@ -1068,12 +1096,12 @@
     }
   } else {
     if (m_nFormControlIndex >= pFormField->CountControls())
-      return CJS_Return(false);
+      return CJS_Return(JSMessage::kValueError);
 
     CPDF_FormControl* pFormControl =
         pFormField->GetControl(m_nFormControlIndex);
     if (!pFormControl)
-      return CJS_Return(false);
+      return CJS_Return(JSMessage::kBadObjectError);
 
     pRuntime->PutArrayElement(
         ExportValuesArray, 0,
@@ -1086,25 +1114,31 @@
                                         v8::Local<v8::Value> vp) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kCheckBox &&
       pFormField->GetFieldType() != FormFieldType::kRadioButton) {
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
   }
 
-  return CJS_Return(m_bCanSet && !vp.IsEmpty() && vp->IsArray());
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+
+  if (vp.IsEmpty() || !vp->IsArray())
+    return CJS_Return(JSMessage::kBadObjectError);
+
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_file_select(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kTextField)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   return CJS_Return(pRuntime->NewBoolean(
       !!(pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT)));
@@ -1114,24 +1148,28 @@
                                       v8::Local<v8::Value> vp) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kTextField)
-    return CJS_Return(false);
-  return CJS_Return(m_bCanSet);
+    return CJS_Return(JSMessage::kObjectTypeError);
+
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_fill_color(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   ASSERT(pFormField);
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   int iColorType;
   pFormControl->GetBackgroundColor(iColorType);
@@ -1154,7 +1192,7 @@
                   pFormControl->GetOriginalBackgroundColor(2),
                   pFormControl->GetOriginalBackgroundColor(3));
   } else {
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kValueError);
   }
 
   v8::Local<v8::Value> array =
@@ -1168,18 +1206,18 @@
                                      v8::Local<v8::Value> vp) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
   if (!m_bCanSet)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kReadOnlyError);
   if (vp.IsEmpty() || !vp->IsArray())
-    return CJS_Return(false);
-  return CJS_Return(true);
+    return CJS_Return(JSMessage::kBadObjectError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_hidden(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   ASSERT(pFormField);
@@ -1188,7 +1226,7 @@
   CPDFSDK_Widget* pWidget =
       pInterForm->GetWidget(GetSmartFieldControl(pFormField));
   if (!pWidget)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   uint32_t dwFlags = pWidget->GetFlags();
   return CJS_Return(pRuntime->NewBoolean(ANNOTFLAG_INVISIBLE & dwFlags ||
@@ -1198,7 +1236,7 @@
 CJS_Return CJS_Field::set_hidden(CJS_Runtime* pRuntime,
                                  v8::Local<v8::Value> vp) {
   if (!m_bCanSet)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kReadOnlyError);
 
   if (m_bDelay) {
     AddDelay_Bool(FP_HIDDEN, pRuntime->ToBoolean(vp));
@@ -1206,7 +1244,7 @@
     CJS_Field::SetHidden(m_pFormFillEnv.Get(), m_FieldName, m_nFormControlIndex,
                          pRuntime->ToBoolean(vp));
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJS_Field::SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1222,15 +1260,15 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kPushButton)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   int eHM = pFormControl->GetHighlightingMode();
   switch (eHM) {
@@ -1245,34 +1283,36 @@
     case CPDF_FormControl::Toggle:
       return CJS_Return(pRuntime->NewString(L"toggle"));
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::set_highlight(CJS_Runtime* pRuntime,
                                     v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_line_width(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   ASSERT(pFormField);
 
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
   if (!pFormField->CountControls())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormField->GetControl(0));
   if (!pWidget)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   return CJS_Return(pRuntime->NewNumber(pWidget->GetBorderWidth()));
 }
@@ -1280,7 +1320,7 @@
 CJS_Return CJS_Field::set_line_width(CJS_Runtime* pRuntime,
                                      v8::Local<v8::Value> vp) {
   if (!m_bCanSet)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kReadOnlyError);
 
   if (m_bDelay) {
     AddDelay_Int(FP_LINEWIDTH, pRuntime->ToInt32(vp));
@@ -1288,7 +1328,7 @@
     CJS_Field::SetLineWidth(m_pFormFillEnv.Get(), m_FieldName,
                             m_nFormControlIndex, pRuntime->ToInt32(vp));
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJS_Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1335,11 +1375,11 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kTextField)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   return CJS_Return(pRuntime->NewBoolean(
       !!(pFormField->GetFieldFlags() & FIELDFLAG_MULTILINE)));
@@ -1348,18 +1388,20 @@
 CJS_Return CJS_Field::set_multiline(CJS_Runtime* pRuntime,
                                     v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_multiple_selection(CJS_Runtime* pRuntime) {
   ASSERT(m_pFormFillEnv);
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kListBox)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   return CJS_Return(pRuntime->NewBoolean(
       !!(pFormField->GetFieldFlags() & FIELDFLAG_MULTISELECT)));
@@ -1368,30 +1410,32 @@
 CJS_Return CJS_Field::set_multiple_selection(CJS_Runtime* pRuntime,
                                              v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_name(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   return CJS_Return(pRuntime->NewString(m_FieldName.c_str()));
 }
 
 CJS_Return CJS_Field::set_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::get_num_items(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kComboBox &&
       pFormField->GetFieldType() != FormFieldType::kListBox) {
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
   }
 
   return CJS_Return(pRuntime->NewNumber(pFormField->CountOptions()));
@@ -1399,17 +1443,17 @@
 
 CJS_Return CJS_Field::set_num_items(CJS_Runtime* pRuntime,
                                     v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::get_page(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (!pFormField)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   std::vector<CPDFSDK_Annot::ObservedPtr> widgets;
   m_pFormFillEnv->GetInterForm()->GetWidgets(pFormField, &widgets);
@@ -1420,12 +1464,12 @@
   int i = 0;
   for (const auto& pObserved : widgets) {
     if (!pObserved)
-      return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
+      return CJS_Return(JSMessage::kBadObjectError);
 
     auto* pWidget = static_cast<CPDFSDK_Widget*>(pObserved.Get());
     CPDFSDK_PageView* pPageView = pWidget->GetPageView();
     if (!pPageView)
-      return CJS_Return(false);
+      return CJS_Return(JSMessage::kBadObjectError);
 
     pRuntime->PutArrayElement(
         PageArray, i,
@@ -1436,7 +1480,7 @@
 }
 
 CJS_Return CJS_Field::set_page(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
-  return CJS_Return(JSGetStringFromID(JSMessage::kReadOnlyError));
+  return CJS_Return(JSMessage::kReadOnlyError);
 }
 
 CJS_Return CJS_Field::get_password(CJS_Runtime* pRuntime) {
@@ -1444,11 +1488,11 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kTextField)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   return CJS_Return(pRuntime->NewBoolean(
       !!(pFormField->GetFieldFlags() & FIELDFLAG_PASSWORD)));
@@ -1457,20 +1501,22 @@
 CJS_Return CJS_Field::set_password(CJS_Runtime* pRuntime,
                                    v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_print(CJS_Runtime* pRuntime) {
   CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   CPDFSDK_Widget* pWidget =
       pInterForm->GetWidget(GetSmartFieldControl(pFormField));
   if (!pWidget)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   return CJS_Return(
       pRuntime->NewBoolean(!!(pWidget->GetFlags() & ANNOTFLAG_PRINT)));
@@ -1481,10 +1527,10 @@
   CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   if (!m_bCanSet)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kReadOnlyError);
 
   for (CPDF_FormField* pFormField : FieldArray) {
     if (m_nFormControlIndex < 0) {
@@ -1512,7 +1558,7 @@
     }
 
     if (m_nFormControlIndex >= pFormField->CountControls())
-      return CJS_Return(false);
+      return CJS_Return(JSMessage::kValueError);
 
     if (CPDF_FormControl* pFormControl =
             pFormField->GetControl(m_nFormControlIndex)) {
@@ -1532,17 +1578,17 @@
       }
     }
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_radios_in_unison(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kRadioButton)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   return CJS_Return(pRuntime->NewBoolean(
       !!(pFormField->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON)));
@@ -1552,14 +1598,16 @@
                                            v8::Local<v8::Value> vp) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
-  return CJS_Return(m_bCanSet);
+    return CJS_Return(JSMessage::kBadObjectError);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_readonly(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   return CJS_Return(pRuntime->NewBoolean(
       !!(FieldArray[0]->GetFieldFlags() & FIELDFLAG_READONLY)));
@@ -1569,21 +1617,23 @@
                                    v8::Local<v8::Value> vp) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
-  return CJS_Return(m_bCanSet);
+    return CJS_Return(JSMessage::kBadObjectError);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_rect(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
   CPDFSDK_Widget* pWidget =
       pInterForm->GetWidget(GetSmartFieldControl(pFormField));
   if (!pWidget)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CFX_FloatRect crRect = pWidget->GetRect();
   v8::Local<v8::Array> rcArray = pRuntime->NewArray();
@@ -1601,13 +1651,13 @@
 
 CJS_Return CJS_Field::set_rect(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
   if (!m_bCanSet)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kReadOnlyError);
   if (vp.IsEmpty() || !vp->IsArray())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   v8::Local<v8::Array> rcArray = pRuntime->ToArray(vp);
   if (pRuntime->GetArrayLength(rcArray) < 4)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kValueError);
 
   float pArray[4];
   pArray[0] = static_cast<float>(
@@ -1626,7 +1676,7 @@
     CJS_Field::SetRect(m_pFormFillEnv.Get(), m_FieldName, m_nFormControlIndex,
                        crRect);
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJS_Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1690,11 +1740,11 @@
 CJS_Return CJS_Field::get_required(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() == FormFieldType::kPushButton)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   return CJS_Return(pRuntime->NewBoolean(
       !!(pFormField->GetFieldFlags() & FIELDFLAG_REQUIRED)));
@@ -1704,8 +1754,10 @@
                                    v8::Local<v8::Value> vp) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
-  return CJS_Return(m_bCanSet);
+    return CJS_Return(JSMessage::kBadObjectError);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_rich_text(CJS_Runtime* pRuntime) {
@@ -1713,11 +1765,11 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kTextField)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   return CJS_Return(pRuntime->NewBoolean(
       !!(pFormField->GetFieldFlags() & FIELDFLAG_RICHTEXT)));
@@ -1726,16 +1778,18 @@
 CJS_Return CJS_Field::set_rich_text(CJS_Runtime* pRuntime,
                                     v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_rich_value(CJS_Runtime* pRuntime) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::set_rich_value(CJS_Runtime* pRuntime,
                                      v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_rotation(CJS_Runtime* pRuntime) {
@@ -1743,12 +1797,12 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   return CJS_Return(pRuntime->NewNumber(pFormControl->GetRotation()));
 }
@@ -1756,18 +1810,20 @@
 CJS_Return CJS_Field::set_rotation(CJS_Runtime* pRuntime,
                                    v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_stroke_color(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   int iColorType;
   pFormControl->GetBorderColor(iColorType);
@@ -1788,7 +1844,7 @@
                       pFormControl->GetOriginalBorderColor(2),
                       pFormControl->GetOriginalBorderColor(3));
   } else {
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
   }
 
   v8::Local<v8::Value> array =
@@ -1801,10 +1857,10 @@
 CJS_Return CJS_Field::set_stroke_color(CJS_Runtime* pRuntime,
                                        v8::Local<v8::Value> vp) {
   if (!m_bCanSet)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kReadOnlyError);
   if (vp.IsEmpty() || !vp->IsArray())
-    return CJS_Return(false);
-  return CJS_Return(true);
+    return CJS_Return(JSMessage::kBadObjectError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_style(CJS_Runtime* pRuntime) {
@@ -1812,17 +1868,17 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kRadioButton &&
       pFormField->GetFieldType() != FormFieldType::kCheckBox) {
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
   }
 
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   WideString csWCaption = pFormControl->GetNormalCaption();
   ByteString csBCaption;
@@ -1854,27 +1910,29 @@
 CJS_Return CJS_Field::set_style(CJS_Runtime* pRuntime,
                                 v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_submit_name(CJS_Runtime* pRuntime) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::set_submit_name(CJS_Runtime* pRuntime,
                                       v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_text_color(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   Optional<CFX_Color::Type> iColorType;
   FX_ARGB color;
@@ -1903,10 +1961,10 @@
 CJS_Return CJS_Field::set_text_color(CJS_Runtime* pRuntime,
                                      v8::Local<v8::Value> vp) {
   if (!m_bCanSet)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kReadOnlyError);
   if (vp.IsEmpty() || !vp->IsArray())
-    return CJS_Return(false);
-  return CJS_Return(true);
+    return CJS_Return(JSMessage::kBadObjectError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_text_font(CJS_Runtime* pRuntime) {
@@ -1914,25 +1972,25 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   ASSERT(pFormField);
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   FormFieldType fieldType = pFormField->GetFieldType();
   if (fieldType != FormFieldType::kPushButton &&
       fieldType != FormFieldType::kComboBox &&
       fieldType != FormFieldType::kListBox &&
       fieldType != FormFieldType::kTextField) {
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
   }
 
   CPDF_Font* pFont = pFormControl->GetDefaultControlFont();
   if (!pFont)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   return CJS_Return(pRuntime->NewString(
       WideString::FromLocal(pFont->GetBaseFont().c_str()).c_str()));
@@ -1943,9 +2001,10 @@
   ASSERT(m_pFormFillEnv);
 
   if (!m_bCanSet)
-    return CJS_Return(false);
-  return CJS_Return(
-      !ByteString::FromUnicode(pRuntime->ToWideString(vp)).IsEmpty());
+    return CJS_Return(JSMessage::kReadOnlyError);
+  if (ByteString::FromUnicode(pRuntime->ToWideString(vp)).IsEmpty())
+    return CJS_Return(JSMessage::kValueError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_text_size(CJS_Runtime* pRuntime) {
@@ -1953,13 +2012,13 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   ASSERT(pFormField);
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   float fFontSize;
   CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaultAppearance();
@@ -1970,13 +2029,15 @@
 CJS_Return CJS_Field::set_text_size(CJS_Runtime* pRuntime,
                                     v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_type(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   switch (pFormField->GetFieldType()) {
@@ -2002,7 +2063,7 @@
 }
 
 CJS_Return CJS_Field::set_type(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::get_user_name(CJS_Runtime* pRuntime) {
@@ -2010,7 +2071,7 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   return CJS_Return(
       pRuntime->NewString(FieldArray[0]->GetAlternateName().c_str()));
@@ -2019,20 +2080,22 @@
 CJS_Return CJS_Field::set_user_name(CJS_Runtime* pRuntime,
                                     v8::Local<v8::Value> vp) {
   ASSERT(m_pFormFillEnv);
-  return CJS_Return(m_bCanSet);
+  if (!m_bCanSet)
+    return CJS_Return(JSMessage::kReadOnlyError);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::get_value(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   v8::Local<v8::Value> ret;
 
   CPDF_FormField* pFormField = FieldArray[0];
   switch (pFormField->GetFieldType()) {
     case FormFieldType::kPushButton:
-      return CJS_Return(false);
+      return CJS_Return(JSMessage::kObjectTypeError);
     case FormFieldType::kComboBox:
     case FormFieldType::kTextField:
       ret = pRuntime->NewString(pFormField->GetValue().c_str());
@@ -2084,7 +2147,7 @@
 CJS_Return CJS_Field::set_value(CJS_Runtime* pRuntime,
                                 v8::Local<v8::Value> vp) {
   if (!m_bCanSet)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kReadOnlyError);
 
   std::vector<WideString> strArray;
   if (!vp.IsEmpty() && vp->IsArray()) {
@@ -2103,7 +2166,7 @@
     CJS_Field::SetValue(m_pFormFillEnv.Get(), m_FieldName, m_nFormControlIndex,
                         strArray);
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJS_Field::SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -2164,15 +2227,15 @@
 CJS_Return CJS_Field::get_value_as_string(CJS_Runtime* pRuntime) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() == FormFieldType::kPushButton)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   if (pFormField->GetFieldType() == FormFieldType::kCheckBox) {
     if (!pFormField->CountControls())
-      return CJS_Return(false);
+      return CJS_Return(JSMessage::kBadObjectError);
     return CJS_Return(pRuntime->NewString(
         pFormField->GetControl(0)->IsChecked() ? L"Yes" : L"Off"));
   }
@@ -2197,7 +2260,7 @@
 
 CJS_Return CJS_Field::set_value_as_string(CJS_Runtime* pRuntime,
                                           v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::browseForFileToSubmit(
@@ -2205,7 +2268,7 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) &&
@@ -2215,9 +2278,9 @@
       pFormField->SetValue(wsFileName);
       UpdateFormField(m_pFormFillEnv.Get(), pFormField, true, true, true);
     }
-    return CJS_Return(true);
+    return CJS_Return();
   }
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kObjectTypeError);
 }
 
 CJS_Return CJS_Field::buttonGetCaption(
@@ -2230,15 +2293,15 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kPushButton)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   if (nface == 0) {
     return CJS_Return(
@@ -2250,7 +2313,7 @@
     return CJS_Return(
         pRuntime->NewString(pFormControl->GetRolloverCaption().c_str()));
   }
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kValueError);
 }
 
 CJS_Return CJS_Field::buttonGetIcon(
@@ -2259,46 +2322,47 @@
   if (params.size() >= 1) {
     int nFace = pRuntime->ToInt32(params[0]);
     if (nFace < 0 || nFace > 2)
-      return CJS_Return(false);
+      return CJS_Return(JSMessage::kValueError);
   }
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kPushButton)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
 
   CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
   if (!pFormControl)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   v8::Local<v8::Object> pObj =
       pRuntime->NewFXJSBoundObject(CJS_Icon::GetObjDefnID());
   if (pObj.IsEmpty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   auto* pJS_Icon = static_cast<CJS_Icon*>(CFXJS_Engine::GetObjectPrivate(pObj));
-  return pJS_Icon ? CJS_Return(pJS_Icon->ToV8Object()) : CJS_Return(false);
+  return pJS_Icon ? CJS_Return(pJS_Icon->ToV8Object())
+                  : CJS_Return(JSMessage::kBadObjectError);
 }
 
 CJS_Return CJS_Field::buttonImportIcon(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::buttonSetCaption(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::buttonSetIcon(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::checkThisBox(
@@ -2306,10 +2370,10 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   int iSize = params.size();
   if (iSize < 1)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kParamError);
 
   if (!m_bCanSet)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kReadOnlyError);
 
   int nWidget = pRuntime->ToInt32(params[0]);
   bool bCheckit = true;
@@ -2318,48 +2382,48 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (pFormField->GetFieldType() != FormFieldType::kCheckBox &&
       pFormField->GetFieldType() != FormFieldType::kRadioButton) {
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kObjectTypeError);
   }
   if (nWidget < 0 || nWidget >= pFormField->CountControls())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kValueError);
 
   // TODO(weili): Check whether anything special needed for radio button.
   // (When pFormField->GetFieldType() == FormFieldType::kRadioButton.)
   pFormField->CheckControl(nWidget, bCheckit, true);
 
   UpdateFormField(m_pFormFillEnv.Get(), pFormField, true, true, true);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::clearItems(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::defaultIsChecked(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!m_bCanSet)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kReadOnlyError);
 
   int iSize = params.size();
   if (iSize < 1)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kParamError);
 
   int nWidget = pRuntime->ToInt32(params[0]);
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (nWidget < 0 || nWidget >= pFormField->CountControls())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kValueError);
 
   return CJS_Return(pRuntime->NewBoolean(
       pFormField->GetFieldType() == FormFieldType::kCheckBox ||
@@ -2369,7 +2433,7 @@
 CJS_Return CJS_Field::deleteItemAt(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::getArray(
@@ -2377,7 +2441,7 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   std::vector<std::unique_ptr<WideString>> swSort;
   for (CPDF_FormField* pFormField : FieldArray) {
@@ -2395,7 +2459,7 @@
     v8::Local<v8::Object> pObj =
         pRuntime->NewFXJSBoundObject(CJS_Field::GetObjDefnID());
     if (pObj.IsEmpty())
-      return CJS_Return(false);
+      return CJS_Return(JSMessage::kBadObjectError);
 
     auto* pJSField =
         static_cast<CJS_Field*>(CFXJS_Engine::GetObjectPrivate(pObj));
@@ -2422,7 +2486,7 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if ((pFormField->GetFieldType() == FormFieldType::kListBox) ||
@@ -2440,18 +2504,18 @@
     return CJS_Return(
         pRuntime->NewString(pFormField->GetOptionLabel(nIdx).c_str()));
   }
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kObjectTypeError);
 }
 
 CJS_Return CJS_Field::getLock(CJS_Runtime* pRuntime,
                               const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::insertItemAt(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::isBoxChecked(
@@ -2463,11 +2527,11 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (nIndex < 0 || nIndex >= pFormField->CountControls())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kValueError);
 
   return CJS_Return(pRuntime->NewBoolean(
       ((pFormField->GetFieldType() == FormFieldType::kCheckBox ||
@@ -2484,11 +2548,11 @@
 
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   if (nIndex < 0 || nIndex >= pFormField->CountControls())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kValueError);
 
   return CJS_Return(pRuntime->NewBoolean(
       ((pFormField->GetFieldType() == FormFieldType::kCheckBox ||
@@ -2499,7 +2563,7 @@
 CJS_Return CJS_Field::setAction(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::setFocus(
@@ -2507,12 +2571,12 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
   if (FieldArray.empty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDF_FormField* pFormField = FieldArray[0];
   int32_t nCount = pFormField->CountControls();
   if (nCount < 1)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
   CPDFSDK_Widget* pWidget = nullptr;
@@ -2522,7 +2586,7 @@
     UnderlyingPageType* pPage =
         UnderlyingFromFPDFPage(m_pFormFillEnv->GetCurrentPage());
     if (!pPage)
-      return CJS_Return(false);
+      return CJS_Return(JSMessage::kBadObjectError);
     if (CPDFSDK_PageView* pCurPageView =
             m_pFormFillEnv->GetPageView(pPage, true)) {
       for (int32_t i = 0; i < nCount; i++) {
@@ -2542,63 +2606,63 @@
     m_pFormFillEnv->SetFocusAnnot(&pObserved);
   }
 
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::setItems(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::setLock(CJS_Runtime* pRuntime,
                               const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::signatureGetModifications(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::signatureGetSeedValue(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::signatureInfo(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::signatureSetSeedValue(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::signatureSign(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::signatureValidate(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
 
 CJS_Return CJS_Field::get_source(CJS_Runtime* pRuntime) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Field::set_source(CJS_Runtime* pRuntime,
                                  v8::Local<v8::Value> vp) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJS_Field::AddDelay_Int(FIELD_PROP prop, int32_t n) {
diff --git a/fxjs/cjs_global.cpp b/fxjs/cjs_global.cpp
index 1e01f96..5d5bc3c 100644
--- a/fxjs/cjs_global.cpp
+++ b/fxjs/cjs_global.cpp
@@ -218,28 +218,30 @@
 }
 
 CJS_Return CJS_Global::QueryProperty(const wchar_t* propname) {
-  return CJS_Return(WideString(propname) != L"setPersistent");
+  if (WideString(propname) != L"setPersistent")
+    return CJS_Return(JSMessage::kUnknownProperty);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Global::DelProperty(CJS_Runtime* pRuntime,
                                    const wchar_t* propname) {
   auto it = m_MapGlobal.find(ByteString::FromUnicode(propname));
   if (it == m_MapGlobal.end())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kUnknownProperty);
 
   it->second->bDeleted = true;
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Global::GetProperty(CJS_Runtime* pRuntime,
                                    const wchar_t* propname) {
   auto it = m_MapGlobal.find(ByteString::FromUnicode(propname));
   if (it == m_MapGlobal.end())
-    return CJS_Return(true);
+    return CJS_Return();
 
   JSGlobalData* pData = it->second.get();
   if (pData->bDeleted)
-    return CJS_Return(true);
+    return CJS_Return();
 
   switch (pData->nType) {
     case JS_GlobalDataType::NUMBER:
@@ -257,7 +259,7 @@
     default:
       break;
   }
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kObjectTypeError);
 }
 
 CJS_Return CJS_Global::SetProperty(CJS_Runtime* pRuntime,
@@ -290,24 +292,24 @@
   }
   if (vp->IsUndefined()) {
     DelProperty(pRuntime, propname);
-    return CJS_Return(true);
+    return CJS_Return();
   }
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kObjectTypeError);
 }
 
 CJS_Return CJS_Global::setPersistent(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 2)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   auto it = m_MapGlobal.find(
       ByteString::FromUnicode(pRuntime->ToWideString(params[0])));
   if (it == m_MapGlobal.end() || it->second->bDeleted)
-    return CJS_Return(JSGetStringFromID(JSMessage::kGlobalNotFoundError));
+    return CJS_Return(JSMessage::kGlobalNotFoundError);
 
   it->second->bPersistent = pRuntime->ToBoolean(params[1]);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJS_Global::UpdateGlobalPersistentVariables() {
@@ -498,7 +500,7 @@
                                           v8::Local<v8::Object> pData,
                                           bool bDefaultPersistent) {
   if (propname.IsEmpty())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kUnknownProperty);
 
   auto it = m_MapGlobal.find(propname);
   if (it != m_MapGlobal.end()) {
@@ -526,9 +528,9 @@
       case JS_GlobalDataType::NULLOBJ:
         break;
       default:
-        return CJS_Return(false);
+        return CJS_Return(JSMessage::kObjectTypeError);
     }
-    return CJS_Return(true);
+    return CJS_Return();
   }
 
   auto pNewData = pdfium::MakeUnique<JSGlobalData>();
@@ -558,8 +560,8 @@
       pNewData->bPersistent = bDefaultPersistent;
       break;
     default:
-      return CJS_Return(false);
+      return CJS_Return(JSMessage::kObjectTypeError);
   }
   m_MapGlobal[propname] = std::move(pNewData);
-  return CJS_Return(true);
+  return CJS_Return();
 }
diff --git a/fxjs/cjs_icon.cpp b/fxjs/cjs_icon.cpp
index 786d19c..89b42f1 100644
--- a/fxjs/cjs_icon.cpp
+++ b/fxjs/cjs_icon.cpp
@@ -34,5 +34,5 @@
 }
 
 CJS_Return CJS_Icon::set_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
-  return CJS_Return(false);
+  return CJS_Return(JSMessage::kNotSupportedError);
 }
diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp
index 678aca5..908611b 100644
--- a/fxjs/cjs_publicmethods.cpp
+++ b/fxjs/cjs_publicmethods.cpp
@@ -872,17 +872,17 @@
     const std::vector<v8::Local<v8::Value>>& params) {
 #if _FX_OS_ != _FX_OS_ANDROID_
   if (params.size() != 6)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   CJS_EventHandler* pEvent =
       pRuntime->GetCurrentEventContext()->GetEventHandler();
   if (!pEvent->m_pValue)
-    return CJS_Return(false);
+    return CJS_Return(L"No event handler");
 
   WideString& Value = pEvent->Value();
   ByteString strValue = StrTrim(ByteString::FromUnicode(Value));
   if (strValue.IsEmpty())
-    return CJS_Return(true);
+    return CJS_Return();
 
   int iDec = abs(pRuntime->ToInt32(params[0]));
   int iSepStyle = ValidStyleOrZero(pRuntime->ToInt32(params[1]));
@@ -970,7 +970,7 @@
     }
   }
 #endif
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 // function AFNumber_Keystroke(nDec, sepStyle, negStyle, currStyle, strCurrency,
@@ -979,12 +979,12 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() < 2)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kParamError);
 
   CJS_EventContext* pContext = pRuntime->GetCurrentEventContext();
   CJS_EventHandler* pEvent = pContext->GetEventHandler();
   if (!pEvent->m_pValue)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   WideString& val = pEvent->Value();
   WideString& wstrChange = pEvent->Change();
@@ -993,7 +993,7 @@
   if (pEvent->WillCommit()) {
     WideString swTemp = StrTrim(wstrValue);
     if (swTemp.IsEmpty())
-      return CJS_Return(true);
+      return CJS_Return();
 
     NormalizeDecimalMarkW(&swTemp);
     if (!IsNumber(swTemp.c_str())) {
@@ -1003,7 +1003,7 @@
       return CJS_Return(sError);
     }
     // It happens after the last keystroke and before validating,
-    return CJS_Return(true);
+    return CJS_Return();
   }
 
   WideString wstrSelected;
@@ -1017,7 +1017,7 @@
     // can't insert "change" in front of sign position.
     if (!wstrSelected.IsEmpty() && pEvent->SelStart() == 0) {
       pEvent->Rc() = false;
-      return CJS_Return(true);
+      return CJS_Return();
     }
   }
 
@@ -1029,7 +1029,7 @@
     if (wstrChange[i] == cSep) {
       if (bHasSep) {
         pEvent->Rc() = false;
-        return CJS_Return(true);
+        return CJS_Return();
       }
       bHasSep = true;
       continue;
@@ -1037,16 +1037,16 @@
     if (wstrChange[i] == L'-') {
       if (bHasSign) {
         pEvent->Rc() = false;
-        return CJS_Return(true);
+        return CJS_Return();
       }
       // sign's position is not correct
       if (i != 0) {
         pEvent->Rc() = false;
-        return CJS_Return(true);
+        return CJS_Return();
       }
       if (pEvent->SelStart() != 0) {
         pEvent->Rc() = false;
-        return CJS_Return(true);
+        return CJS_Return();
       }
       bHasSign = true;
       continue;
@@ -1054,12 +1054,12 @@
 
     if (!std::iswdigit(wstrChange[i])) {
       pEvent->Rc() = false;
-      return CJS_Return(true);
+      return CJS_Return();
     }
   }
 
   val = CalcMergedString(pEvent, wstrValue, wstrChange);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 // function AFPercent_Format(nDec, sepStyle)
@@ -1068,17 +1068,17 @@
     const std::vector<v8::Local<v8::Value>>& params) {
 #if _FX_OS_ != _FX_OS_ANDROID_
   if (params.size() != 2)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   CJS_EventHandler* pEvent =
       pRuntime->GetCurrentEventContext()->GetEventHandler();
   if (!pEvent->m_pValue)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   WideString& Value = pEvent->Value();
   ByteString strValue = StrTrim(ByteString::FromUnicode(Value));
   if (strValue.IsEmpty())
-    return CJS_Return(true);
+    return CJS_Return();
 
   int iDec = abs(pRuntime->ToInt32(params[0]));
   int iSepStyle = ValidStyleOrZero(pRuntime->ToInt32(params[1]));
@@ -1139,7 +1139,7 @@
   strValue += '%';
   Value = WideString::FromLocal(strValue.AsStringView());
 #endif
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 // AFPercent_Keystroke(nDec, sepStyle)
@@ -1154,17 +1154,17 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   CJS_EventContext* pContext = pRuntime->GetCurrentEventContext();
   CJS_EventHandler* pEvent = pContext->GetEventHandler();
   if (!pEvent->m_pValue)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   WideString& val = pEvent->Value();
   WideString strValue = val;
   if (strValue.IsEmpty())
-    return CJS_Return(true);
+    return CJS_Return();
 
   WideString sFormat = pRuntime->ToWideString(params[0]);
   double dDate;
@@ -1180,11 +1180,11 @@
     WideString swMsg = WideString::Format(
         JSGetStringFromID(JSMessage::kParseDateError).c_str(), sFormat.c_str());
     AlertIfPossible(pContext, swMsg.c_str());
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kParseDateError);
   }
 
   val = MakeFormatDate(dDate, sFormat);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 double CJS_PublicMethods::MakeInterDate(const WideString& strValue) {
@@ -1237,11 +1237,11 @@
   CJS_EventHandler* pEvent = pContext->GetEventHandler();
   if (pEvent->WillCommit()) {
     if (!pEvent->m_pValue)
-      return CJS_Return(false);
+      return CJS_Return(JSMessage::kBadObjectError);
 
     const WideString& strValue = pEvent->Value();
     if (strValue.IsEmpty())
-      return CJS_Return(true);
+      return CJS_Return();
 
     WideString sFormat = pRuntime->ToWideString(params[0]);
     bool bWrongFormat = false;
@@ -1252,17 +1252,17 @@
           sFormat.c_str());
       AlertIfPossible(pContext, swMsg.c_str());
       pEvent->Rc() = false;
-      return CJS_Return(true);
+      return CJS_Return();
     }
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_PublicMethods::AFDate_Format(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   static constexpr const wchar_t* cFormats[] = {L"m/d",
                                                 L"m/d/yy",
@@ -1291,7 +1291,7 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   static constexpr const wchar_t* cFormats[] = {L"m/d",
                                                 L"m/d/yy",
@@ -1320,7 +1320,7 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   static constexpr const wchar_t* cFormats[] = {L"HH:MM", L"h:MM tt",
                                                 L"HH:MM:ss", L"h:MM:ss tt"};
@@ -1336,7 +1336,7 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   static constexpr const wchar_t* cFormats[] = {L"HH:MM", L"h:MM tt",
                                                 L"HH:MM:ss", L"h:MM:ss tt"};
@@ -1365,12 +1365,12 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   CJS_EventHandler* pEvent =
       pRuntime->GetCurrentEventContext()->GetEventHandler();
   if (!pEvent->m_pValue)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   const WideString& wsSource = pEvent->Value();
   WideString wsFormat;
@@ -1393,7 +1393,7 @@
   }
 
   pEvent->Value() = CJS_Util::printx(wsFormat, wsSource);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 // function AFSpecial_KeystrokeEx(mask)
@@ -1401,21 +1401,21 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() < 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   CJS_EventContext* pContext = pRuntime->GetCurrentEventContext();
   CJS_EventHandler* pEvent = pContext->GetEventHandler();
   if (!pEvent->m_pValue)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   const WideString& valEvent = pEvent->Value();
   WideString wstrMask = pRuntime->ToWideString(params[0]);
   if (wstrMask.IsEmpty())
-    return CJS_Return(true);
+    return CJS_Return();
 
   if (pEvent->WillCommit()) {
     if (valEvent.IsEmpty())
-      return CJS_Return(true);
+      return CJS_Return();
 
     size_t iIndexMask = 0;
     for (; iIndexMask < valEvent.GetLength(); ++iIndexMask) {
@@ -1429,12 +1429,12 @@
                       JSGetStringFromID(JSMessage::kInvalidInputError).c_str());
       pEvent->Rc() = false;
     }
-    return CJS_Return(true);
+    return CJS_Return();
   }
 
   WideString& wideChange = pEvent->Change();
   if (wideChange.IsEmpty())
-    return CJS_Return(true);
+    return CJS_Return();
 
   WideString wChange = wideChange;
   size_t iIndexMask = pEvent->SelStart();
@@ -1444,14 +1444,14 @@
     AlertIfPossible(pContext,
                     JSGetStringFromID(JSMessage::kParamTooLongError).c_str());
     pEvent->Rc() = false;
-    return CJS_Return(true);
+    return CJS_Return();
   }
 
   if (iIndexMask >= wstrMask.GetLength() && !wChange.IsEmpty()) {
     AlertIfPossible(pContext,
                     JSGetStringFromID(JSMessage::kParamTooLongError).c_str());
     pEvent->Rc() = false;
-    return CJS_Return(true);
+    return CJS_Return();
   }
 
   for (size_t i = 0; i < wChange.GetLength(); ++i) {
@@ -1459,7 +1459,7 @@
       AlertIfPossible(pContext,
                       JSGetStringFromID(JSMessage::kParamTooLongError).c_str());
       pEvent->Rc() = false;
-      return CJS_Return(true);
+      return CJS_Return();
     }
     wchar_t wMask = wstrMask[iIndexMask];
     if (!IsReservedMaskChar(wMask))
@@ -1467,12 +1467,12 @@
 
     if (!MaskSatisfied(wChange[i], wMask)) {
       pEvent->Rc() = false;
-      return CJS_Return(true);
+      return CJS_Return();
     }
     iIndexMask++;
   }
   wideChange = wChange;
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 // function AFSpecial_Keystroke(psf)
@@ -1480,12 +1480,12 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   CJS_EventHandler* pEvent =
       pRuntime->GetCurrentEventContext()->GetEventHandler();
   if (!pEvent->m_pValue)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   const char* cFormat = "";
   switch (pRuntime->ToInt32(params[0])) {
@@ -1515,7 +1515,7 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   CJS_EventHandler* pEventHandler =
       pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -1536,7 +1536,7 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 2)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   WideString sValue = pRuntime->ToWideString(params[0]);
   WideString sFormat = pRuntime->ToWideString(params[1]);
@@ -1545,7 +1545,7 @@
     WideString swMsg = WideString::Format(
         JSGetStringFromID(JSMessage::kParseDateError).c_str(), sFormat.c_str());
     AlertIfPossible(pRuntime->GetCurrentEventContext(), swMsg.c_str());
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kParseDateError);
   }
   return CJS_Return(pRuntime->NewNumber(dDate));
 }
@@ -1554,7 +1554,7 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 3)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   return CJS_Return(pRuntime->NewNumber(static_cast<double>(AF_Simple(
       pRuntime->ToWideString(params[0]).c_str(), pRuntime->ToDouble(params[1]),
@@ -1565,7 +1565,7 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   WideString ws = pRuntime->ToWideString(params[0]);
   NormalizeDecimalMarkW(&ws);
@@ -1581,10 +1581,10 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 2)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   if ((params[1].IsEmpty() || !params[1]->IsArray()) && !params[1]->IsString())
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   CPDFSDK_InterForm* pReaderInterForm =
       pRuntime->GetFormFillEnv()->GetInterForm();
@@ -1665,7 +1665,7 @@
         pRuntime->ToWideString(pRuntime->NewNumber(dValue));
   }
 
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 /* This function validates the current event to ensure that its value is
@@ -1674,15 +1674,15 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 4)
-    CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   CJS_EventContext* pContext = pRuntime->GetCurrentEventContext();
   CJS_EventHandler* pEvent = pContext->GetEventHandler();
   if (!pEvent->m_pValue)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kBadObjectError);
 
   if (pEvent->Value().IsEmpty())
-    return CJS_Return(true);
+    return CJS_Return();
 
   double dEentValue = atof(ByteString::FromUnicode(pEvent->Value()).c_str());
   bool bGreaterThan = pRuntime->ToBoolean(params[0]);
@@ -1713,14 +1713,14 @@
     AlertIfPossible(pContext, swMsg.c_str());
     pEvent->Rc() = false;
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_PublicMethods::AFExtractNums(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() != 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   WideString str = pRuntime->ToWideString(params[0]);
   if (str.GetLength() > 0 && IsDigitSeparatorOrDecimalMark(str[0]))
diff --git a/fxjs/cjs_report.cpp b/fxjs/cjs_report.cpp
index 3a91276..eccba07 100644
--- a/fxjs/cjs_report.cpp
+++ b/fxjs/cjs_report.cpp
@@ -34,11 +34,11 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJS_Report::save(CJS_Runtime* pRuntime,
                             const std::vector<v8::Local<v8::Value>>& params) {
   // Unsafe, not supported.
-  return CJS_Return(true);
+  return CJS_Return();
 }
diff --git a/fxjs/cjs_return.cpp b/fxjs/cjs_return.cpp
index adfd1c5..53ac5c0 100644
--- a/fxjs/cjs_return.cpp
+++ b/fxjs/cjs_return.cpp
@@ -6,13 +6,15 @@
 
 #include "fxjs/cjs_return.h"
 
-CJS_Return::CJS_Return(bool result) : is_error_(!result) {}
-
-CJS_Return::CJS_Return(const WideString& err) : is_error_(true), error_(err) {}
+CJS_Return::CJS_Return() : is_error_(false) {}
 
 CJS_Return::CJS_Return(v8::Local<v8::Value> ret)
     : is_error_(false), return_(ret) {}
 
+CJS_Return::CJS_Return(const WideString& err) : is_error_(true), error_(err) {}
+
+CJS_Return::CJS_Return(JSMessage id) : CJS_Return(JSGetStringFromID(id)) {}
+
 CJS_Return::CJS_Return(const CJS_Return&) = default;
 
 CJS_Return::~CJS_Return() = default;
diff --git a/fxjs/cjs_return.h b/fxjs/cjs_return.h
index 37c91ca..df3c851 100644
--- a/fxjs/cjs_return.h
+++ b/fxjs/cjs_return.h
@@ -8,12 +8,14 @@
 #define FXJS_CJS_RETURN_H_
 
 #include "fxjs/cfxjs_engine.h"
+#include "fxjs/js_resources.h"
 
 class CJS_Return {
  public:
-  explicit CJS_Return(bool);
-  explicit CJS_Return(const WideString&);
-  explicit CJS_Return(v8::Local<v8::Value>);
+  CJS_Return();                               // Successful but empty return.
+  explicit CJS_Return(v8::Local<v8::Value>);  // Successful return with value.
+  explicit CJS_Return(const WideString&);     // Error with custom message.
+  explicit CJS_Return(JSMessage id);          // Error with stock message.
   CJS_Return(const CJS_Return&);
   ~CJS_Return();
 
@@ -24,8 +26,6 @@
   v8::Local<v8::Value> Return() const { return return_; }
 
  private:
-  CJS_Return() = delete;
-
   bool is_error_ = false;
   WideString error_;
   v8::Local<v8::Value> return_;
diff --git a/fxjs/cjs_util.cpp b/fxjs/cjs_util.cpp
index 8da9a07..0ff4083 100644
--- a/fxjs/cjs_util.cpp
+++ b/fxjs/cjs_util.cpp
@@ -83,7 +83,7 @@
                             const std::vector<v8::Local<v8::Value>>& params) {
   const size_t iSize = params.size();
   if (iSize < 1)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kParamError);
 
   std::wstring unsafe_fmt_string(pRuntime->ToWideString(params[0]).c_str());
   std::vector<std::wstring> unsafe_conversion_specifiers;
@@ -145,10 +145,10 @@
                             const std::vector<v8::Local<v8::Value>>& params) {
   const size_t iSize = params.size();
   if (iSize < 2)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kParamError);
 
   if (params[1].IsEmpty() || !params[1]->IsDate())
-    return CJS_Return(JSGetStringFromID(JSMessage::kSecondParamNotDateError));
+    return CJS_Return(JSMessage::kSecondParamNotDateError);
 
   v8::Local<v8::Date> v8_date = params[1].As<v8::Date>();
   if (v8_date.IsEmpty() || std::isnan(pRuntime->ToDouble(v8_date))) {
@@ -180,7 +180,7 @@
                                       month, day, hour, min, sec);
         break;
       default:
-        return CJS_Return(JSGetStringFromID(JSMessage::kValueError));
+        return CJS_Return(JSMessage::kValueError);
     }
 
     return CJS_Return(pRuntime->NewString(swResult.c_str()));
@@ -189,7 +189,7 @@
   if (params[0]->IsString()) {
     // We don't support XFAPicture at the moment.
     if (iSize > 2 && pRuntime->ToBoolean(params[2]))
-      return CJS_Return(JSGetStringFromID(JSMessage::kNotSupportedError));
+      return CJS_Return(JSMessage::kNotSupportedError);
 
     // Convert PDF-style format specifiers to wcsftime specifiers. Remove any
     // pre-existing %-directives before inserting our own.
@@ -210,7 +210,7 @@
     }
 
     if (year < 0)
-      return CJS_Return(JSGetStringFromID(JSMessage::kValueError));
+      return CJS_Return(JSMessage::kValueError);
 
     const TbConvertAdditional cTableAd[] = {
         {L"m", month}, {L"d", day},
@@ -248,13 +248,13 @@
     return CJS_Return(pRuntime->NewString(cFormat.c_str()));
   }
 
-  return CJS_Return(JSGetStringFromID(JSMessage::kTypeError));
+  return CJS_Return(JSMessage::kTypeError);
 }
 
 CJS_Return CJS_Util::printx(CJS_Runtime* pRuntime,
                             const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() < 2)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   return CJS_Return(
       pRuntime->NewString(printx(pRuntime->ToWideString(params[0]),
@@ -363,7 +363,7 @@
 CJS_Return CJS_Util::scand(CJS_Runtime* pRuntime,
                            const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() < 2)
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kParamError);
 
   WideString sFormat = pRuntime->ToWideString(params[0]);
   WideString sDate = pRuntime->ToWideString(params[1]);
@@ -380,11 +380,11 @@
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (params.size() < 1)
-    return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
+    return CJS_Return(JSMessage::kParamError);
 
   int arg = pRuntime->ToInt32(params[0]);
   if (arg < 0 || arg > 255)
-    return CJS_Return(JSGetStringFromID(JSMessage::kValueError));
+    return CJS_Return(JSMessage::kValueError);
 
   WideString wStr(static_cast<wchar_t>(arg));
   return CJS_Return(pRuntime->NewString(wStr.c_str()));
diff --git a/fxjs/js_resources.cpp b/fxjs/js_resources.cpp
index bfffbc3..ec20b1e 100644
--- a/fxjs/js_resources.cpp
+++ b/fxjs/js_resources.cpp
@@ -49,8 +49,14 @@
       return L"Permission denied.";
     case JSMessage::kBadObjectError:
       return L"Object no longer exists.";
+    case JSMessage::kObjectTypeError:
+      return L"Object is of the wrong type.";
     case JSMessage::kTooManyOccurances:
-      return L"Too many occurances";
+      return L"Too many occurances.";
+    case JSMessage::kUnknownProperty:
+      return L"Unknown property.";
+    case JSMessage::kUnknownMethod:
+      return L"Unknown method.";
   }
   NOTREACHED();
   return L"";
diff --git a/fxjs/js_resources.h b/fxjs/js_resources.h
index 0b664c9..10bbcb8 100644
--- a/fxjs/js_resources.h
+++ b/fxjs/js_resources.h
@@ -30,7 +30,10 @@
   kValueError,
   kPermissionError,
   kBadObjectError,
-  kTooManyOccurances
+  kObjectTypeError,
+  kTooManyOccurances,
+  kUnknownProperty,
+  kUnknownMethod,
 };
 
 WideString JSGetStringFromID(JSMessage msg);
diff --git a/fxjs/xfa/cjx_container.cpp b/fxjs/xfa/cjx_container.cpp
index e5dbfe8..0e58a7e 100644
--- a/fxjs/xfa/cjx_container.cpp
+++ b/fxjs/xfa/cjx_container.cpp
@@ -27,7 +27,7 @@
 CJS_Return CJX_Container::getDelta(
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Container::getDeltas(
diff --git a/fxjs/xfa/cjx_datawindow.cpp b/fxjs/xfa/cjx_datawindow.cpp
index cdb6aab..1f5b6ec 100644
--- a/fxjs/xfa/cjx_datawindow.cpp
+++ b/fxjs/xfa/cjx_datawindow.cpp
@@ -27,25 +27,25 @@
 CJS_Return CJX_DataWindow::moveCurrentRecord(
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_DataWindow::record(
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_DataWindow::gotoRecord(
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_DataWindow::isRecordGroup(
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJX_DataWindow::recordsBefore(CFXJSE_Value* pValue,
diff --git a/fxjs/xfa/cjx_delta.cpp b/fxjs/xfa/cjx_delta.cpp
index 1da5953..9732f4e 100644
--- a/fxjs/xfa/cjx_delta.cpp
+++ b/fxjs/xfa/cjx_delta.cpp
@@ -24,7 +24,7 @@
                               const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJX_Delta::currentValue(CFXJSE_Value* pValue,
diff --git a/fxjs/xfa/cjx_eventpseudomodel.cpp b/fxjs/xfa/cjx_eventpseudomodel.cpp
index d2364c8..a6c5560 100644
--- a/fxjs/xfa/cjx_eventpseudomodel.cpp
+++ b/fxjs/xfa/cjx_eventpseudomodel.cpp
@@ -174,22 +174,22 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
   if (!pScriptContext)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_EventParam* pEventParam = pScriptContext->GetEventParam();
   if (!pEventParam)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_FFWidgetHandler* pWidgetHandler = pNotify->GetWidgetHandler();
   if (!pWidgetHandler)
-    return CJS_Return(true);
+    return CJS_Return();
 
   pWidgetHandler->ProcessEvent(pEventParam->m_pTarget, pEventParam);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_EventPseudoModel::reset(
@@ -197,14 +197,14 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
   if (!pScriptContext)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_EventParam* pEventParam = pScriptContext->GetEventParam();
   if (!pEventParam)
-    return CJS_Return(true);
+    return CJS_Return();
 
   pEventParam->Reset();
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJX_EventPseudoModel::Property(CFXJSE_Value* pValue,
diff --git a/fxjs/xfa/cjx_exclgroup.cpp b/fxjs/xfa/cjx_exclgroup.cpp
index 2b66484..6e44e56 100644
--- a/fxjs/xfa/cjx_exclgroup.cpp
+++ b/fxjs/xfa/cjx_exclgroup.cpp
@@ -38,7 +38,7 @@
 
   execSingleEventByName(runtime->ToWideString(params[0]).AsStringView(),
                         XFA_Element::ExclGroup);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_ExclGroup::execInitialize(
@@ -51,7 +51,7 @@
   if (pNotify)
     pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize, false,
                                   true);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_ExclGroup::execCalculate(
@@ -64,7 +64,7 @@
   if (pNotify)
     pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false,
                                   true);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_ExclGroup::execValidate(
diff --git a/fxjs/xfa/cjx_field.cpp b/fxjs/xfa/cjx_field.cpp
index d3f0280..3beb868 100644
--- a/fxjs/xfa/cjx_field.cpp
+++ b/fxjs/xfa/cjx_field.cpp
@@ -44,7 +44,7 @@
   CXFA_Node* node = GetXFANode();
   if (node->IsWidgetReady())
     node->DeleteItem(-1, true, false);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Field::execEvent(
@@ -57,7 +57,7 @@
   int32_t iRet =
       execSingleEventByName(eventString.AsStringView(), XFA_Element::Field);
   if (eventString != L"validate")
-    return CJS_Return(true);
+    return CJS_Return();
 
   return CJS_Return(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error));
 }
@@ -73,7 +73,7 @@
     pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize, false,
                                   false);
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Field::deleteItem(
@@ -84,7 +84,7 @@
 
   CXFA_Node* node = GetXFANode();
   if (!node->IsWidgetReady())
-    return CJS_Return(true);
+    return CJS_Return();
 
   bool bValue = node->DeleteItem(runtime->ToInt32(params[0]), true, true);
   return CJS_Return(runtime->NewBoolean(bValue));
@@ -119,7 +119,7 @@
 
   CXFA_Node* node = GetXFANode();
   if (!node->IsWidgetReady())
-    return CJS_Return(true);
+    return CJS_Return();
 
   WideString value = runtime->ToWideString(params[0]);
   WideString boundValue = node->GetItemValue(value.AsStringView());
@@ -134,7 +134,7 @@
 
   CXFA_Node* node = GetXFANode();
   if (!node->IsWidgetReady())
-    return CJS_Return(true);
+    return CJS_Return();
 
   int32_t state = node->GetItemState(runtime->ToInt32(params[0]));
   return CJS_Return(runtime->NewBoolean(state != 0));
@@ -151,7 +151,7 @@
     pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false,
                                   false);
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Field::getDisplayItem(
@@ -183,17 +183,17 @@
 
   CXFA_Node* node = GetXFANode();
   if (!node->IsWidgetReady())
-    return CJS_Return(true);
+    return CJS_Return();
 
   int32_t iIndex = runtime->ToInt32(params[0]);
   if (runtime->ToInt32(params[1]) != 0) {
     node->SetItemState(iIndex, true, true, true, true);
-    return CJS_Return(true);
+    return CJS_Return();
   }
   if (node->GetItemState(iIndex))
     node->SetItemState(iIndex, false, true, true, true);
 
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Field::addItem(CFX_V8* runtime,
@@ -203,7 +203,7 @@
 
   CXFA_Node* node = GetXFANode();
   if (!node->IsWidgetReady())
-    return CJS_Return(true);
+    return CJS_Return();
 
   WideString label;
   if (params.size() >= 1)
@@ -214,7 +214,7 @@
     value = runtime->ToWideString(params[1]);
 
   node->InsertItem(label, value, true);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Field::execValidate(
diff --git a/fxjs/xfa/cjx_form.cpp b/fxjs/xfa/cjx_form.cpp
index fa244b3..d1d50ad 100644
--- a/fxjs/xfa/cjx_form.cpp
+++ b/fxjs/xfa/cjx_form.cpp
@@ -59,7 +59,7 @@
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
 
   GetDocument()->DoDataRemerge(true);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Form::execInitialize(
@@ -72,7 +72,7 @@
   if (pNotify)
     pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize, false,
                                   true);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Form::recalculate(
@@ -82,19 +82,19 @@
       GetDocument()->GetScriptContext()->GetEventParam();
   if (pEventParam->m_eType == XFA_EVENT_Calculate ||
       pEventParam->m_eType == XFA_EVENT_InitCalculate) {
-    return CJS_Return(true);
+    return CJS_Return();
   }
   if (params.size() != 1)
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
 
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify || runtime->ToInt32(params[0]) != 0)
-    return CJS_Return(true);
+    return CJS_Return();
 
   pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false, true);
   pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Validate, false, true);
   pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Ready, true, true);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Form::execCalculate(
@@ -107,7 +107,7 @@
   if (pNotify)
     pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false,
                                   true);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Form::execValidate(
diff --git a/fxjs/xfa/cjx_hostpseudomodel.cpp b/fxjs/xfa/cjx_hostpseudomodel.cpp
index fe26d31..2d9b1bf 100644
--- a/fxjs/xfa/cjx_hostpseudomodel.cpp
+++ b/fxjs/xfa/cjx_hostpseudomodel.cpp
@@ -243,33 +243,33 @@
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!GetDocument()->GetScriptContext()->IsRunAtClient())
-    return CJS_Return(true);
+    return CJS_Return();
 
   if (params.size() != 1)
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
 
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_FFDoc* hDoc = pNotify->GetHDOC();
   WideString URL = runtime->ToWideString(params[0]);
   hDoc->GetDocEnvironment()->GotoURL(hDoc, URL);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_HostPseudoModel::openList(
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!GetDocument()->GetScriptContext()->IsRunAtClient())
-    return CJS_Return(true);
+    return CJS_Return();
 
   if (params.size() != 1)
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
 
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_Node* pNode = nullptr;
   if (params[0]->IsObject()) {
@@ -278,11 +278,11 @@
   } else if (params[0]->IsString()) {
     CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
     if (!pScriptContext)
-      return CJS_Return(true);
+      return CJS_Return();
 
     CXFA_Object* pObject = pScriptContext->GetThisObject();
     if (!pObject)
-      return CJS_Return(true);
+      return CJS_Return();
 
     uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
                       XFA_RESOLVENODE_Siblings;
@@ -291,24 +291,24 @@
         pObject, runtime->ToWideString(params[0]).AsStringView(),
         &resolveNodeRS, dwFlag, nullptr);
     if (!iRet || !resolveNodeRS.objects.front()->IsNode())
-      return CJS_Return(true);
+      return CJS_Return();
 
     pNode = resolveNodeRS.objects.front()->AsNode();
   }
 
   CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor();
   if (!pDocLayout)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_FFWidget* hWidget =
       XFA_GetWidgetFromLayoutItem(pDocLayout->GetLayoutItem(pNode));
   if (!hWidget)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_FFDoc* hDoc = pNotify->GetHDOC();
   hDoc->GetDocEnvironment()->SetFocusWidget(hDoc, hWidget);
   pNotify->OpenDropDownList(hWidget);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_HostPseudoModel::response(
@@ -319,7 +319,7 @@
 
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify)
-    return CJS_Return(true);
+    return CJS_Return();
 
   WideString question;
   if (params.size() >= 1)
@@ -356,7 +356,7 @@
 
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify)
-    return CJS_Return(true);
+    return CJS_Return();
 
   WideString expression;
   if (params.size() >= 1)
@@ -364,7 +364,7 @@
 
   if (expression.IsEmpty()) {
     pNotify->ResetData(nullptr);
-    return CJS_Return(true);
+    return CJS_Return();
   }
 
   int32_t iStart = 0;
@@ -375,11 +375,11 @@
     iStart = FilterName(expression.AsStringView(), iStart, wsName);
     CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
     if (!pScriptContext)
-      return CJS_Return(true);
+      return CJS_Return();
 
     CXFA_Object* pObject = pScriptContext->GetThisObject();
     if (!pObject)
-      return CJS_Return(true);
+      return CJS_Return();
 
     uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
                       XFA_RESOLVENODE_Siblings;
@@ -395,42 +395,42 @@
   if (!pNode)
     pNotify->ResetData(nullptr);
 
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_HostPseudoModel::beep(
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!GetDocument()->GetScriptContext()->IsRunAtClient())
-    return CJS_Return(true);
+    return CJS_Return();
 
   if (params.size() > 1)
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
 
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify)
-    return CJS_Return(true);
+    return CJS_Return();
 
   uint32_t dwType = 4;
   if (params.size() >= 1)
     dwType = runtime->ToInt32(params[0]);
 
   pNotify->GetAppProvider()->Beep(dwType);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_HostPseudoModel::setFocus(
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!GetDocument()->GetScriptContext()->IsRunAtClient())
-    return CJS_Return(true);
+    return CJS_Return();
 
   if (params.size() != 1)
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
 
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_Node* pNode = nullptr;
   if (params.size() >= 1) {
@@ -440,11 +440,11 @@
     } else if (params[0]->IsString()) {
       CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
       if (!pScriptContext)
-        return CJS_Return(true);
+        return CJS_Return();
 
       CXFA_Object* pObject = pScriptContext->GetThisObject();
       if (!pObject)
-        return CJS_Return(true);
+        return CJS_Return();
 
       uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
                         XFA_RESOLVENODE_Siblings;
@@ -453,13 +453,13 @@
           pObject, runtime->ToWideString(params[0]).AsStringView(),
           &resolveNodeRS, dwFlag, nullptr);
       if (!iRet || !resolveNodeRS.objects.front()->IsNode())
-        return CJS_Return(true);
+        return CJS_Return();
 
       pNode = resolveNodeRS.objects.front()->AsNode();
     }
   }
   pNotify->SetFocusWidgetNode(pNode);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_HostPseudoModel::getFocus(
@@ -467,11 +467,11 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_Node* pNode = pNotify->GetFocusWidgetNode();
   if (!pNode)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CFXJSE_Value* value =
       GetDocument()->GetScriptContext()->GetJSValueFromMap(pNode);
@@ -485,14 +485,14 @@
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!GetDocument()->GetScriptContext()->IsRunAtClient())
-    return CJS_Return(true);
+    return CJS_Return();
 
   if (params.empty() || params.size() > 4)
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
 
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify)
-    return CJS_Return(true);
+    return CJS_Return();
 
   WideString message;
   if (params.size() >= 1)
@@ -531,14 +531,14 @@
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!GetDocument()->GetScriptContext()->IsRunAtClient())
-    return CJS_Return(true);
+    return CJS_Return();
 
   if (params.size() != 8)
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
 
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify)
-    return CJS_Return(true);
+    return CJS_Return();
 
   uint32_t dwOptions = 0;
   if (runtime->ToBoolean(params[0]))
@@ -559,7 +559,7 @@
 
   CXFA_FFDoc* hDoc = pNotify->GetHDOC();
   hDoc->GetDocEnvironment()->Print(hDoc, nStartPage, nEndPage, dwOptions);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_HostPseudoModel::importData(
@@ -568,7 +568,7 @@
   if (params.empty() || params.size() > 1)
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
 
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_HostPseudoModel::exportData(
@@ -579,7 +579,7 @@
 
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify)
-    return CJS_Return(true);
+    return CJS_Return();
 
   WideString filePath;
   if (params.size() >= 1)
@@ -591,7 +591,7 @@
 
   CXFA_FFDoc* hDoc = pNotify->GetHDOC();
   hDoc->GetDocEnvironment()->ExportData(hDoc, filePath, XDP);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_HostPseudoModel::pageUp(
@@ -599,17 +599,17 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_FFDoc* hDoc = pNotify->GetHDOC();
   int32_t nCurPage = hDoc->GetDocEnvironment()->GetCurrentPage(hDoc);
   int32_t nNewPage = 0;
   if (nCurPage <= 1)
-    return CJS_Return(true);
+    return CJS_Return();
 
   nNewPage = nCurPage - 1;
   hDoc->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_HostPseudoModel::pageDown(
@@ -617,13 +617,13 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_FFDoc* hDoc = pNotify->GetHDOC();
   int32_t nCurPage = hDoc->GetDocEnvironment()->GetCurrentPage(hDoc);
   int32_t nPageCount = hDoc->GetDocEnvironment()->CountPages(hDoc);
   if (!nPageCount || nCurPage == nPageCount)
-    return CJS_Return(true);
+    return CJS_Return();
 
   int32_t nNewPage = 0;
   if (nCurPage >= nPageCount)
@@ -632,5 +632,5 @@
     nNewPage = nCurPage + 1;
 
   hDoc->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage);
-  return CJS_Return(true);
+  return CJS_Return();
 }
diff --git a/fxjs/xfa/cjx_instancemanager.cpp b/fxjs/xfa/cjx_instancemanager.cpp
index 081b685..f8df62c 100644
--- a/fxjs/xfa/cjx_instancemanager.cpp
+++ b/fxjs/xfa/cjx_instancemanager.cpp
@@ -144,7 +144,7 @@
 
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_Node* pToInstance = GetXFANode()->GetItemIfExists(iTo);
   if (pToInstance && pToInstance->GetElementType() == XFA_Element::Subform)
@@ -156,7 +156,7 @@
     pNotify->RunSubformIndexChange(pFromInstance);
   }
 
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_InstanceManager::removeInstance(
@@ -196,7 +196,7 @@
     pLayoutPro->AddChangedContainer(
         ToNode(GetDocument()->GetXFAObject(XFA_HASHCODE_Form)));
   }
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_InstanceManager::setInstances(
@@ -206,7 +206,7 @@
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
 
   SetInstances(runtime->ToInt32(params[0]));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_InstanceManager::addInstance(
diff --git a/fxjs/xfa/cjx_layoutpseudomodel.cpp b/fxjs/xfa/cjx_layoutpseudomodel.cpp
index 6a01d29..0ae4871 100644
--- a/fxjs/xfa/cjx_layoutpseudomodel.cpp
+++ b/fxjs/xfa/cjx_layoutpseudomodel.cpp
@@ -78,7 +78,7 @@
   CXFA_Node* pNode =
       ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[0]));
   if (!pNode)
-    return CJS_Return(true);
+    return CJS_Return();
 
   WideString unit(L"pt");
   if (params.size() >= 2) {
@@ -90,11 +90,11 @@
 
   CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor();
   if (!pDocLayout)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode);
   if (!pLayoutItem)
-    return CJS_Return(true);
+    return CJS_Return();
 
   while (iIndex > 0 && pLayoutItem) {
     pLayoutItem = pLayoutItem->GetNext();
@@ -154,7 +154,7 @@
                                                     bool bNumbered) {
   CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor();
   if (!pDocLayout)
-    return CJS_Return(true);
+    return CJS_Return();
 
   int32_t iPageCount = 0;
   int32_t iPageNum = pDocLayout->CountPages();
@@ -189,11 +189,11 @@
   CXFA_Node* pNode =
       ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[0]));
   if (!pNode)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor();
   if (!pDocLayout)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode);
   if (!pLayoutItem)
@@ -365,11 +365,11 @@
 
   CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
   if (!pNotify)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor();
   if (!pDocLayout)
-    return CJS_Return(true);
+    return CJS_Return();
 
   auto pArrayNodeList = pdfium::MakeUnique<CXFA_ArrayNodeList>(GetDocument());
   pArrayNodeList->SetArrayNodeList(
@@ -411,7 +411,7 @@
     pLayoutProcessor->AddChangedContainer(pContentRootNode);
 
   pLayoutProcessor->SetForceReLayout(true);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_LayoutPseudoModel::absPageSpan(
@@ -445,7 +445,7 @@
 CJS_Return CJX_LayoutPseudoModel::relayoutPageArea(
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_LayoutPseudoModel::sheetCount(
@@ -474,7 +474,7 @@
 
   CXFA_LayoutProcessor* pDocLayout = GetDocument()->GetLayoutProcessor();
   if (!pDocLayout)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode);
   if (!pLayoutItem)
diff --git a/fxjs/xfa/cjx_list.cpp b/fxjs/xfa/cjx_list.cpp
index 4340e3b..b6ac47e 100644
--- a/fxjs/xfa/cjx_list.cpp
+++ b/fxjs/xfa/cjx_list.cpp
@@ -42,7 +42,7 @@
     return CJS_Return(JSGetStringFromID(JSMessage::kValueError));
 
   GetXFAList()->Append(pNode);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_List::insert(CFX_V8* runtime,
@@ -58,7 +58,7 @@
   auto* pBeforeNode =
       ToNode(static_cast<CFXJSE_Engine*>(runtime)->ToXFAObject(params[1]));
   GetXFAList()->Insert(pNewNode, pBeforeNode);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_List::remove(CFX_V8* runtime,
@@ -72,7 +72,7 @@
     return CJS_Return(JSGetStringFromID(JSMessage::kValueError));
 
   GetXFAList()->Remove(pNode);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_List::item(CFX_V8* runtime,
diff --git a/fxjs/xfa/cjx_logpseudomodel.cpp b/fxjs/xfa/cjx_logpseudomodel.cpp
index 18093f5..93772ed 100644
--- a/fxjs/xfa/cjx_logpseudomodel.cpp
+++ b/fxjs/xfa/cjx_logpseudomodel.cpp
@@ -35,29 +35,29 @@
   //   fprintf(stderr, "  %ls\n", WideString::FromUTF8(*str).c_str());
   // }
 
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_LogPseudoModel::traceEnabled(
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_LogPseudoModel::traceActivate(
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_LogPseudoModel::traceDeactivate(
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_LogPseudoModel::trace(
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
diff --git a/fxjs/xfa/cjx_model.cpp b/fxjs/xfa/cjx_model.cpp
index 857d6a4..688b303 100644
--- a/fxjs/xfa/cjx_model.cpp
+++ b/fxjs/xfa/cjx_model.cpp
@@ -28,7 +28,7 @@
 CJS_Return CJX_Model::clearErrorList(
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Model::createNode(
diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp
index a07aa4c..7c472db 100644
--- a/fxjs/xfa/cjx_node.cpp
+++ b/fxjs/xfa/cjx_node.cpp
@@ -117,7 +117,7 @@
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
 
   // TODO(weili): check whether we need to implement this, pdfium:501.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Node::assignNode(
@@ -127,7 +127,7 @@
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
 
   // TODO(weili): check whether we need to implement this, pdfium:501.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Node::clone(CFX_V8* runtime,
@@ -206,7 +206,7 @@
 
   ByteString expression = runtime->ToByteString(params[0]);
   if (expression.IsEmpty())
-    return CJS_Return(true);
+    return CJS_Return();
 
   bool bIgnoreRoot = true;
   if (params.size() >= 2)
@@ -218,11 +218,11 @@
 
   auto pParser = pdfium::MakeUnique<CXFA_DocumentParser>(GetDocument());
   if (!pParser)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CFX_XMLNode* pXMLNode = pParser->ParseXMLData(expression);
   if (!pXMLNode)
-    return CJS_Return(true);
+    return CJS_Return();
 
   if (bIgnoreRoot &&
       (pXMLNode->GetType() != FX_XMLNODE_Element ||
@@ -278,7 +278,7 @@
   pParser->ConstructXFANode(pFakeRoot, pFakeXMLRoot);
   pFakeRoot = pParser->GetRootNode();
   if (!pFakeRoot)
-    return CJS_Return(true);
+    return CJS_Return();
 
   if (bOverwrite) {
     CXFA_Node* pChild = GetXFANode()->GetFirstChild();
@@ -326,14 +326,14 @@
   }
   pFakeRoot->SetFlag(XFA_NodeFlag_HasRemovedChildren);
 
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Node::saveFilteredXML(
     CFX_V8* runtime,
     const std::vector<v8::Local<v8::Value>>& params) {
   // TODO(weili): Check whether we need to implement this, pdfium:501.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Node::saveXML(CFX_V8* runtime,
@@ -383,7 +383,7 @@
   WideString attributeValue = runtime->ToWideString(params[0]);
   WideString attribute = runtime->ToWideString(params[1]);
   SetAttribute(attribute.AsStringView(), attributeValue.AsStringView(), true);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Node::setElement(
@@ -393,7 +393,7 @@
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
 
   // TODO(weili): check whether we need to implement this, pdfium:501.
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJX_Node::id(CFXJSE_Value* pValue,
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index ba91422..d357c56 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -172,7 +172,8 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   auto it = method_specs_.find(func.UTF8Encode());
   if (it == method_specs_.end())
-    return CJS_Return(false);
+    return CJS_Return(JSMessage::kUnknownMethod);
+
   return it->second(this, GetXFAObject()->GetDocument()->GetScriptContext(),
                     params);
 }
diff --git a/fxjs/xfa/cjx_signaturepseudomodel.cpp b/fxjs/xfa/cjx_signaturepseudomodel.cpp
index 3041778..0e4d560 100644
--- a/fxjs/xfa/cjx_signaturepseudomodel.cpp
+++ b/fxjs/xfa/cjx_signaturepseudomodel.cpp
@@ -47,7 +47,7 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_SignaturePseudoModel::clear(
diff --git a/fxjs/xfa/cjx_source.cpp b/fxjs/xfa/cjx_source.cpp
index 7576e77..98772b5 100644
--- a/fxjs/xfa/cjx_source.cpp
+++ b/fxjs/xfa/cjx_source.cpp
@@ -41,7 +41,7 @@
                             const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::cancelBatch(
@@ -49,14 +49,14 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::first(CFX_V8* runtime,
                              const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::updateBatch(
@@ -64,7 +64,7 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::previous(
@@ -72,42 +72,42 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::isBOF(CFX_V8* runtime,
                              const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::isEOF(CFX_V8* runtime,
                              const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::cancel(CFX_V8* runtime,
                               const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::update(CFX_V8* runtime,
                               const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::open(CFX_V8* runtime,
                             const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::deleteItem(
@@ -115,14 +115,14 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::addNew(CFX_V8* runtime,
                               const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::requery(
@@ -130,28 +130,28 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::resync(CFX_V8* runtime,
                               const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::close(CFX_V8* runtime,
                              const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::last(CFX_V8* runtime,
                             const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Source::hasDataChanged(
@@ -159,7 +159,7 @@
     const std::vector<v8::Local<v8::Value>>& params) {
   if (!params.empty())
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 void CJX_Source::db(CFXJSE_Value* pValue,
diff --git a/fxjs/xfa/cjx_subform.cpp b/fxjs/xfa/cjx_subform.cpp
index 52f0865..042bd85 100644
--- a/fxjs/xfa/cjx_subform.cpp
+++ b/fxjs/xfa/cjx_subform.cpp
@@ -36,7 +36,7 @@
 
   execSingleEventByName(runtime->ToWideString(params[0]).AsStringView(),
                         XFA_Element::Subform);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Subform::execInitialize(
@@ -49,7 +49,7 @@
   if (pNotify)
     pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize, false,
                                   true);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Subform::execCalculate(
@@ -62,7 +62,7 @@
   if (pNotify)
     pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false,
                                   true);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Subform::execValidate(
diff --git a/fxjs/xfa/cjx_template.cpp b/fxjs/xfa/cjx_template.cpp
index 6612a7c..0b9c3b2 100644
--- a/fxjs/xfa/cjx_template.cpp
+++ b/fxjs/xfa/cjx_template.cpp
@@ -42,7 +42,7 @@
     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
 
   GetDocument()->DoDataRemerge(true);
-  return CJS_Return(true);
+  return CJS_Return();
 }
 
 CJS_Return CJX_Template::execInitialize(
diff --git a/fxjs/xfa/cjx_tree.cpp b/fxjs/xfa/cjx_tree.cpp
index 219953d..442a82d 100644
--- a/fxjs/xfa/cjx_tree.cpp
+++ b/fxjs/xfa/cjx_tree.cpp
@@ -38,7 +38,7 @@
   WideString expression = runtime->ToWideString(params[0]);
   CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
   if (!pScriptContext)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CXFA_Object* refNode = GetXFAObject();
   if (refNode->GetElementType() == XFA_Element::Xfa)
@@ -90,7 +90,7 @@
 
   CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
   if (!pScriptContext)
-    return CJS_Return(true);
+    return CJS_Return();
 
   auto pValue = pdfium::MakeUnique<CFXJSE_Value>(pScriptContext->GetIsolate());
   ResolveNodeList(pValue.get(), runtime->ToWideString(params[0]),
diff --git a/fxjs/xfa/cjx_treelist.cpp b/fxjs/xfa/cjx_treelist.cpp
index 904e093..b608734 100644
--- a/fxjs/xfa/cjx_treelist.cpp
+++ b/fxjs/xfa/cjx_treelist.cpp
@@ -37,7 +37,7 @@
   CXFA_Node* pNode = GetXFATreeList()->NamedItem(
       runtime->ToWideString(params[0]).AsStringView());
   if (!pNode)
-    return CJS_Return(true);
+    return CJS_Return();
 
   CFXJSE_Value* value =
       GetDocument()->GetScriptContext()->GetJSValueFromMap(pNode);
diff --git a/testing/resources/javascript/app_props_expected.txt b/testing/resources/javascript/app_props_expected.txt
index a17e0f8..a221272 100644
--- a/testing/resources/javascript/app_props_expected.txt
+++ b/testing/resources/javascript/app_props_expected.txt
@@ -2,36 +2,36 @@
 Alert: app.activeDocs is object [object global]
 Alert: app.calculate is boolean true
 Alert: app.formsVersion is number 7
-Alert: ERROR: app.fs: 
-Alert: ERROR: app.fullscreen: 
+Alert: ERROR: app.fs: Operation not supported.
+Alert: ERROR: app.fullscreen: Operation not supported.
 Alert: app.language is string ENU
-Alert: ERROR: app.media: 
+Alert: ERROR: app.media: Operation not supported.
 Alert: app.platform is string WIN
 Alert: app.runtimeHighlight is boolean false
 Alert: app.viewerType is string pdfium
 Alert: app.viewerVariation is string Full
 Alert: app.viewerVersion is number 8
 Alert: *** Setting properties ***
-Alert: ERROR: app.activeDocs: 
+Alert: ERROR: app.activeDocs: Operation not supported.
 Alert: app.calculate = 3; yields 3
-Alert: ERROR: app.formsVersion: 
-Alert: ERROR: app.fs: 
-Alert: ERROR: app.fullscreen: 
-Alert: ERROR: app.language: 
-Alert: ERROR: app.media: 
-Alert: ERROR: app.platform: 
+Alert: ERROR: app.formsVersion: Operation not supported.
+Alert: ERROR: app.fs: Operation not supported.
+Alert: ERROR: app.fullscreen: Operation not supported.
+Alert: ERROR: app.language: Operation not supported.
+Alert: ERROR: app.media: Operation not supported.
+Alert: ERROR: app.platform: Operation not supported.
 Alert: app.runtimeHighlight = 3; yields 3
-Alert: ERROR: app.viewerType: 
-Alert: ERROR: app.viewerVariation: 
-Alert: ERROR: app.viewerVersion: 
+Alert: ERROR: app.viewerType: Operation not supported.
+Alert: ERROR: app.viewerVariation: Operation not supported.
+Alert: ERROR: app.viewerVersion: Operation not supported.
 Alert: *** Getting properties ***
 Alert: app.activeDocs is object [object global]
 Alert: app.calculate is boolean true
 Alert: app.formsVersion is number 7
-Alert: ERROR: app.fs: 
-Alert: ERROR: app.fullscreen: 
+Alert: ERROR: app.fs: Operation not supported.
+Alert: ERROR: app.fullscreen: Operation not supported.
 Alert: app.language is string ENU
-Alert: ERROR: app.media: 
+Alert: ERROR: app.media: Operation not supported.
 Alert: app.platform is string WIN
 Alert: app.runtimeHighlight is boolean true
 Alert: app.viewerType is string pdfium