[js] Convert to using size instead of sentinels

This CL changes the DefineMethod, DefineProps and DefineConsts methods
to pass a size instead of depending on a sentinel value in the
definition arrays.

Change-Id: Ie054544124290c0833a8b21af175a203ca99591a
Reviewed-on: https://pdfium-review.googlesource.com/20551
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fxjs/cjs_annot.cpp b/fxjs/cjs_annot.cpp
index 62fdfb8..69eccef 100644
--- a/fxjs/cjs_annot.cpp
+++ b/fxjs/cjs_annot.cpp
@@ -22,8 +22,7 @@
 const JSPropertySpec CJS_Annot::PropertySpecs[] = {
     {"hidden", get_hidden_static, set_hidden_static},
     {"name", get_name_static, set_name_static},
-    {"type", get_type_static, set_type_static},
-    {0, 0, 0}};
+    {"type", get_type_static, set_type_static}};
 
 int CJS_Annot::ObjDefnID = -1;
 
@@ -37,7 +36,7 @@
   ObjDefnID = pEngine->DefineObj("Annot", FXJSOBJTYPE_DYNAMIC,
                                  JSConstructor<CJS_Annot, Annot>,
                                  JSDestructor<CJS_Annot>);
-  DefineProps(pEngine, ObjDefnID, PropertySpecs);
+  DefineProps(pEngine, ObjDefnID, PropertySpecs, FX_ArraySize(PropertySpecs));
 }
 
 Annot::Annot(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {}
diff --git a/fxjs/cjs_app.cpp b/fxjs/cjs_app.cpp
index e89fb2a..32cac22 100644
--- a/fxjs/cjs_app.cpp
+++ b/fxjs/cjs_app.cpp
@@ -48,8 +48,7 @@
     {"viewerType", get_viewer_type_static, set_viewer_type_static},
     {"viewerVariation", get_viewer_variation_static,
      set_viewer_variation_static},
-    {"viewerVersion", get_viewer_version_static, set_viewer_version_static},
-    {0, 0, 0}};
+    {"viewerVersion", get_viewer_version_static, set_viewer_version_static}};
 
 const JSMethodSpec CJS_App::MethodSpecs[] = {
     {"alert", alert_static},
@@ -72,8 +71,7 @@
     {"popUpMenu", popUpMenu_static},
     {"response", response_static},
     {"setInterval", setInterval_static},
-    {"setTimeOut", setTimeOut_static},
-    {0, 0}};
+    {"setTimeOut", setTimeOut_static}};
 
 int CJS_App::ObjDefnID = -1;
 
@@ -82,8 +80,8 @@
   ObjDefnID =
       pEngine->DefineObj("app", FXJSOBJTYPE_STATIC, JSConstructor<CJS_App, app>,
                          JSDestructor<CJS_App>);
-  DefineProps(pEngine, ObjDefnID, PropertySpecs);
-  DefineMethods(pEngine, ObjDefnID, MethodSpecs);
+  DefineProps(pEngine, ObjDefnID, PropertySpecs, FX_ArraySize(PropertySpecs));
+  DefineMethods(pEngine, ObjDefnID, MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 app::app(CJS_Object* pJSObject)
diff --git a/fxjs/cjs_border.cpp b/fxjs/cjs_border.cpp
index 24d50ff..95693f4 100644
--- a/fxjs/cjs_border.cpp
+++ b/fxjs/cjs_border.cpp
@@ -11,8 +11,7 @@
     {"b", JSConstSpec::String, 0, "beveled"},
     {"d", JSConstSpec::String, 0, "dashed"},
     {"i", JSConstSpec::String, 0, "inset"},
-    {"u", JSConstSpec::String, 0, "underline"},
-    {0, JSConstSpec::Number, 0, 0}};
+    {"u", JSConstSpec::String, 0, "underline"}};
 
 int CJS_Border::ObjDefnID = -1;
 
@@ -20,5 +19,5 @@
 void CJS_Border::DefineJSObjects(CFXJS_Engine* pEngine) {
   ObjDefnID =
       pEngine->DefineObj("border", FXJSOBJTYPE_STATIC, nullptr, nullptr);
-  DefineConsts(pEngine, ObjDefnID, ConstSpecs);
+  DefineConsts(pEngine, ObjDefnID, ConstSpecs, FX_ArraySize(ConstSpecs));
 }
diff --git a/fxjs/cjs_color.cpp b/fxjs/cjs_color.cpp
index 1bebf79..58a98dd 100644
--- a/fxjs/cjs_color.cpp
+++ b/fxjs/cjs_color.cpp
@@ -26,12 +26,10 @@
     {"red", get_red_static, set_red_static},
     {"transparent", get_transparent_static, set_transparent_static},
     {"white", get_white_static, set_white_static},
-    {"yellow", get_yellow_static, set_yellow_static},
-    {0, 0, 0}};
+    {"yellow", get_yellow_static, set_yellow_static}};
 
 const JSMethodSpec CJS_Color::MethodSpecs[] = {{"convert", convert_static},
-                                               {"equal", equal_static},
-                                               {0, 0}};
+                                               {"equal", equal_static}};
 
 int CJS_Color::ObjDefnID = -1;
 
@@ -40,8 +38,8 @@
   ObjDefnID = pEngine->DefineObj("color", FXJSOBJTYPE_STATIC,
                                  JSConstructor<CJS_Color, color>,
                                  JSDestructor<CJS_Color>);
-  DefineProps(pEngine, ObjDefnID, PropertySpecs);
-  DefineMethods(pEngine, ObjDefnID, MethodSpecs);
+  DefineProps(pEngine, ObjDefnID, PropertySpecs, FX_ArraySize(PropertySpecs));
+  DefineMethods(pEngine, ObjDefnID, MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 // static
diff --git a/fxjs/cjs_console.cpp b/fxjs/cjs_console.cpp
index c5e23a3..1921cd2 100644
--- a/fxjs/cjs_console.cpp
+++ b/fxjs/cjs_console.cpp
@@ -16,8 +16,7 @@
 const JSMethodSpec CJS_Console::MethodSpecs[] = {{"clear", clear_static},
                                                  {"hide", hide_static},
                                                  {"println", println_static},
-                                                 {"show", show_static},
-                                                 {0, 0}};
+                                                 {"show", show_static}};
 
 int CJS_Console::ObjDefnID = -1;
 
@@ -26,7 +25,7 @@
   ObjDefnID = pEngine->DefineObj("console", FXJSOBJTYPE_STATIC,
                                  JSConstructor<CJS_Console, console>,
                                  JSDestructor<CJS_Console>);
-  DefineMethods(pEngine, ObjDefnID, MethodSpecs);
+  DefineMethods(pEngine, ObjDefnID, MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 console::console(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {}
diff --git a/fxjs/cjs_display.cpp b/fxjs/cjs_display.cpp
index a52b51d..6970bfc 100644
--- a/fxjs/cjs_display.cpp
+++ b/fxjs/cjs_display.cpp
@@ -10,8 +10,7 @@
     {"visible", JSConstSpec::Number, 0, 0},
     {"hidden", JSConstSpec::Number, 1, 0},
     {"noPrint", JSConstSpec::Number, 2, 0},
-    {"noView", JSConstSpec::Number, 3, 0},
-    {0, JSConstSpec::Number, 0, 0}};
+    {"noView", JSConstSpec::Number, 3, 0}};
 
 int CJS_Display::ObjDefnID = -1;
 
@@ -19,5 +18,5 @@
 void CJS_Display::DefineJSObjects(CFXJS_Engine* pEngine) {
   ObjDefnID =
       pEngine->DefineObj("display", FXJSOBJTYPE_STATIC, nullptr, nullptr);
-  DefineConsts(pEngine, ObjDefnID, ConstSpecs);
+  DefineConsts(pEngine, ObjDefnID, ConstSpecs, FX_ArraySize(ConstSpecs));
 }
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index 46ece17..d4eca2f 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -61,8 +61,7 @@
     {"title", get_title_static, set_title_static},
     {"URL", get_URL_static, set_URL_static},
     {"zoom", get_zoom_static, set_zoom_static},
-    {"zoomType", get_zoom_type_static, set_zoom_type_static},
-    {0, 0, 0}};
+    {"zoomType", get_zoom_type_static, set_zoom_type_static}};
 
 const JSMethodSpec CJS_Document::MethodSpecs[] = {
     {"addAnnot", addAnnot_static},
@@ -106,8 +105,7 @@
     {"saveAs", saveAs_static},
     {"submitForm", submitForm_static},
     {"syncAnnotScan", syncAnnotScan_static},
-    {"mailDoc", mailDoc_static},
-    {0, 0}};
+    {"mailDoc", mailDoc_static}};
 
 int CJS_Document::ObjDefnID = -1;
 
@@ -121,8 +119,8 @@
   ObjDefnID = pEngine->DefineObj("Document", FXJSOBJTYPE_GLOBAL,
                                  JSConstructor<CJS_Document, Document>,
                                  JSDestructor<CJS_Document>);
-  DefineProps(pEngine, ObjDefnID, PropertySpecs);
-  DefineMethods(pEngine, ObjDefnID, MethodSpecs);
+  DefineProps(pEngine, ObjDefnID, PropertySpecs, FX_ArraySize(PropertySpecs));
+  DefineMethods(pEngine, ObjDefnID, MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 void CJS_Document::InitInstance(IJS_Runtime* pIRuntime) {
diff --git a/fxjs/cjs_event.cpp b/fxjs/cjs_event.cpp
index 2d4508a..4fb988f 100644
--- a/fxjs/cjs_event.cpp
+++ b/fxjs/cjs_event.cpp
@@ -32,8 +32,7 @@
     {"targetName", get_target_name_static, set_target_name_static},
     {"type", get_type_static, set_type_static},
     {"value", get_value_static, set_value_static},
-    {"willCommit", get_will_commit_static, set_will_commit_static},
-    {0, 0, 0}};
+    {"willCommit", get_will_commit_static, set_will_commit_static}};
 
 int CJS_Event::ObjDefnID = -1;
 
@@ -42,7 +41,7 @@
   ObjDefnID = pEngine->DefineObj("event", FXJSOBJTYPE_STATIC,
                                  JSConstructor<CJS_Event, event>,
                                  JSDestructor<CJS_Event>);
-  DefineProps(pEngine, ObjDefnID, PropertySpecs);
+  DefineProps(pEngine, ObjDefnID, PropertySpecs, FX_ArraySize(PropertySpecs));
 }
 
 event::event(CJS_Object* pJsObject) : CJS_EmbedObj(pJsObject) {}
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index cb8eb6b..f2e27f2 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -124,8 +124,7 @@
     {"userName", get_user_name_static, set_user_name_static},
     {"value", get_value_static, set_value_static},
     {"valueAsString", get_value_as_string_static, set_value_as_string_static},
-    {"source", get_source_static, set_source_static},
-    {0, 0, 0}};
+    {"source", get_source_static, set_source_static}};
 
 const JSMethodSpec CJS_Field::MethodSpecs[] = {
     {"browseForFileToSubmit", browseForFileToSubmit_static},
@@ -153,8 +152,7 @@
     {"signatureInfo", signatureInfo_static},
     {"signatureSetSeedValue", signatureSetSeedValue_static},
     {"signatureSign", signatureSign_static},
-    {"signatureValidate", signatureValidate_static},
-    {0, 0}};
+    {"signatureValidate", signatureValidate_static}};
 
 int CJS_Field::ObjDefnID = -1;
 
@@ -168,8 +166,8 @@
   ObjDefnID = pEngine->DefineObj("Field", FXJSOBJTYPE_DYNAMIC,
                                  JSConstructor<CJS_Field, Field>,
                                  JSDestructor<CJS_Field>);
-  DefineProps(pEngine, ObjDefnID, PropertySpecs);
-  DefineMethods(pEngine, ObjDefnID, MethodSpecs);
+  DefineProps(pEngine, ObjDefnID, PropertySpecs, FX_ArraySize(PropertySpecs));
+  DefineMethods(pEngine, ObjDefnID, MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 void CJS_Field::InitInstance(IJS_Runtime* pIRuntime) {}
diff --git a/fxjs/cjs_font.cpp b/fxjs/cjs_font.cpp
index b4ef66b..54b392f 100644
--- a/fxjs/cjs_font.cpp
+++ b/fxjs/cjs_font.cpp
@@ -20,13 +20,12 @@
     {"CourI", JSConstSpec::String, 0, "Courier-Oblique"},
     {"CourBI", JSConstSpec::String, 0, "Courier-BoldOblique"},
     {"Symbol", JSConstSpec::String, 0, "Symbol"},
-    {"ZapfD", JSConstSpec::String, 0, "ZapfDingbats"},
-    {0, JSConstSpec::Number, 0, 0}};
+    {"ZapfD", JSConstSpec::String, 0, "ZapfDingbats"}};
 
 int CJS_Font::ObjDefnID = -1;
 
 // static
 void CJS_Font::DefineJSObjects(CFXJS_Engine* pEngine) {
   ObjDefnID = pEngine->DefineObj("font", FXJSOBJTYPE_STATIC, nullptr, nullptr);
-  DefineConsts(pEngine, ObjDefnID, ConstSpecs);
+  DefineConsts(pEngine, ObjDefnID, ConstSpecs, FX_ArraySize(ConstSpecs));
 }
diff --git a/fxjs/cjs_global.cpp b/fxjs/cjs_global.cpp
index 95124ff..2376354 100644
--- a/fxjs/cjs_global.cpp
+++ b/fxjs/cjs_global.cpp
@@ -174,8 +174,7 @@
 }  // namespace
 
 const JSMethodSpec CJS_Global::MethodSpecs[] = {
-    {"setPersistent", setPersistent_static},
-    {0, 0}};
+    {"setPersistent", setPersistent_static}};
 
 int CJS_Global::ObjDefnID = -1;
 
@@ -227,7 +226,7 @@
   ObjDefnID = pEngine->DefineObj("global", FXJSOBJTYPE_STATIC,
                                  JSConstructor<CJS_Global, JSGlobalAlternate>,
                                  JSDestructor<CJS_Global>);
-  DefineMethods(pEngine, ObjDefnID, MethodSpecs);
+  DefineMethods(pEngine, ObjDefnID, MethodSpecs, FX_ArraySize(MethodSpecs));
   DefineAllProperties(pEngine);
 }
 
diff --git a/fxjs/cjs_highlight.cpp b/fxjs/cjs_highlight.cpp
index 453a266..e60a5a8 100644
--- a/fxjs/cjs_highlight.cpp
+++ b/fxjs/cjs_highlight.cpp
@@ -10,8 +10,7 @@
     {"n", JSConstSpec::String, 0, "none"},
     {"i", JSConstSpec::String, 0, "invert"},
     {"p", JSConstSpec::String, 0, "push"},
-    {"o", JSConstSpec::String, 0, "outline"},
-    {0, JSConstSpec::Number, 0, 0}};
+    {"o", JSConstSpec::String, 0, "outline"}};
 
 int CJS_Highlight::ObjDefnID = -1;
 
@@ -19,5 +18,5 @@
 void CJS_Highlight::DefineJSObjects(CFXJS_Engine* pEngine) {
   ObjDefnID =
       pEngine->DefineObj("highlight", FXJSOBJTYPE_STATIC, nullptr, nullptr);
-  DefineConsts(pEngine, ObjDefnID, ConstSpecs);
+  DefineConsts(pEngine, ObjDefnID, ConstSpecs, FX_ArraySize(ConstSpecs));
 }
diff --git a/fxjs/cjs_icon.cpp b/fxjs/cjs_icon.cpp
index c4ef8e1..2b56f70 100644
--- a/fxjs/cjs_icon.cpp
+++ b/fxjs/cjs_icon.cpp
@@ -7,8 +7,7 @@
 #include "fxjs/cjs_icon.h"
 
 const JSPropertySpec CJS_Icon::PropertySpecs[] = {
-    {"name", get_name_static, set_name_static},
-    {0, 0, 0}};
+    {"name", get_name_static, set_name_static}};
 
 int CJS_Icon::ObjDefnID = -1;
 
@@ -22,7 +21,7 @@
   ObjDefnID =
       pEngine->DefineObj("Icon", FXJSOBJTYPE_DYNAMIC,
                          JSConstructor<CJS_Icon, Icon>, JSDestructor<CJS_Icon>);
-  DefineProps(pEngine, ObjDefnID, PropertySpecs);
+  DefineProps(pEngine, ObjDefnID, PropertySpecs, FX_ArraySize(PropertySpecs));
 }
 
 Icon::Icon(CJS_Object* pJSObject)
diff --git a/fxjs/cjs_object.cpp b/fxjs/cjs_object.cpp
index ccddc7f..a1e5ce1 100644
--- a/fxjs/cjs_object.cpp
+++ b/fxjs/cjs_object.cpp
@@ -9,8 +9,9 @@
 // static
 void CJS_Object::DefineConsts(CFXJS_Engine* pEngine,
                               int objId,
-                              const JSConstSpec consts[]) {
-  for (size_t i = 0; consts[i].pName != 0; ++i) {
+                              const JSConstSpec consts[],
+                              size_t count) {
+  for (size_t i = 0; i < count; ++i) {
     pEngine->DefineObjConst(
         objId, consts[i].pName,
         consts[i].eType == JSConstSpec::Number
@@ -22,8 +23,9 @@
 // static
 void CJS_Object::DefineProps(CFXJS_Engine* pEngine,
                              int objId,
-                             const JSPropertySpec props[]) {
-  for (size_t i = 0; props[i].pName != 0; ++i) {
+                             const JSPropertySpec props[],
+                             size_t count) {
+  for (size_t i = 0; i < count; ++i) {
     pEngine->DefineObjProperty(objId, props[i].pName, props[i].pPropGet,
                                props[i].pPropPut);
   }
@@ -32,8 +34,9 @@
 // static
 void CJS_Object::DefineMethods(CFXJS_Engine* pEngine,
                                int objId,
-                               const JSMethodSpec methods[]) {
-  for (size_t i = 0; methods[i].pName != 0; ++i)
+                               const JSMethodSpec methods[],
+                               size_t count) {
+  for (size_t i = 0; i < count; ++i)
     pEngine->DefineObjMethod(objId, methods[i].pName, methods[i].pMethodCall);
 }
 
diff --git a/fxjs/cjs_object.h b/fxjs/cjs_object.h
index bed5088..d929a01 100644
--- a/fxjs/cjs_object.h
+++ b/fxjs/cjs_object.h
@@ -38,13 +38,16 @@
  public:
   static void DefineConsts(CFXJS_Engine* pEngine,
                            int objId,
-                           const JSConstSpec consts[]);
+                           const JSConstSpec consts[],
+                           size_t count);
   static void DefineProps(CFXJS_Engine* pEngine,
                           int objId,
-                          const JSPropertySpec props[]);
+                          const JSPropertySpec props[],
+                          size_t count);
   static void DefineMethods(CFXJS_Engine* pEngine,
                             int objId,
-                            const JSMethodSpec methods[]);
+                            const JSMethodSpec methods[],
+                            size_t count);
 
   explicit CJS_Object(v8::Local<v8::Object> pObject);
   virtual ~CJS_Object();
diff --git a/fxjs/cjs_position.cpp b/fxjs/cjs_position.cpp
index ba1f3d9..16e4ab0 100644
--- a/fxjs/cjs_position.cpp
+++ b/fxjs/cjs_position.cpp
@@ -13,8 +13,7 @@
     {"textIconV", JSConstSpec::Number, 3, 0},
     {"iconTextH", JSConstSpec::Number, 4, 0},
     {"textIconH", JSConstSpec::Number, 5, 0},
-    {"overlay", JSConstSpec::Number, 6, 0},
-    {0, JSConstSpec::Number, 0, 0}};
+    {"overlay", JSConstSpec::Number, 6, 0}};
 
 int CJS_Position::ObjDefnID = -1;
 
@@ -22,5 +21,5 @@
 void CJS_Position::DefineJSObjects(CFXJS_Engine* pEngine) {
   ObjDefnID =
       pEngine->DefineObj("position", FXJSOBJTYPE_STATIC, nullptr, nullptr);
-  DefineConsts(pEngine, ObjDefnID, ConstSpecs);
+  DefineConsts(pEngine, ObjDefnID, ConstSpecs, FX_ArraySize(ConstSpecs));
 }
diff --git a/fxjs/cjs_report.cpp b/fxjs/cjs_report.cpp
index 2aa3f49..0788a90 100644
--- a/fxjs/cjs_report.cpp
+++ b/fxjs/cjs_report.cpp
@@ -11,9 +11,9 @@
 #include "fxjs/JS_Define.h"
 #include "fxjs/cjs_object.h"
 
-const JSMethodSpec CJS_Report::MethodSpecs[] = {{"save", save_static},
-                                                {"writeText", writeText_static},
-                                                {0, 0}};
+const JSMethodSpec CJS_Report::MethodSpecs[] = {
+    {"save", save_static},
+    {"writeText", writeText_static}};
 
 int CJS_Report::ObjDefnID = -1;
 
@@ -22,7 +22,7 @@
   ObjDefnID =
       pEngine->DefineObj("Report", eObjType, JSConstructor<CJS_Report, Report>,
                          JSDestructor<CJS_Report>);
-  DefineMethods(pEngine, ObjDefnID, MethodSpecs);
+  DefineMethods(pEngine, ObjDefnID, MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 Report::Report(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {}
diff --git a/fxjs/cjs_scalehow.cpp b/fxjs/cjs_scalehow.cpp
index 35c5ec2..762863b 100644
--- a/fxjs/cjs_scalehow.cpp
+++ b/fxjs/cjs_scalehow.cpp
@@ -8,8 +8,7 @@
 
 const JSConstSpec CJS_ScaleHow::ConstSpecs[] = {
     {"proportional", JSConstSpec::Number, 0, 0},
-    {"anamorphic", JSConstSpec::Number, 1, 0},
-    {0, JSConstSpec::Number, 0, 0}};
+    {"anamorphic", JSConstSpec::Number, 1, 0}};
 
 int CJS_ScaleHow::ObjDefnID = -1;
 
@@ -17,5 +16,5 @@
 void CJS_ScaleHow::DefineJSObjects(CFXJS_Engine* pEngine) {
   ObjDefnID =
       pEngine->DefineObj("scaleHow", FXJSOBJTYPE_STATIC, nullptr, nullptr);
-  DefineConsts(pEngine, ObjDefnID, ConstSpecs);
+  DefineConsts(pEngine, ObjDefnID, ConstSpecs, FX_ArraySize(ConstSpecs));
 }
diff --git a/fxjs/cjs_scalewhen.cpp b/fxjs/cjs_scalewhen.cpp
index b13e7ed..59f0487 100644
--- a/fxjs/cjs_scalewhen.cpp
+++ b/fxjs/cjs_scalewhen.cpp
@@ -10,8 +10,7 @@
     {"always", JSConstSpec::Number, 0, 0},
     {"never", JSConstSpec::Number, 1, 0},
     {"tooBig", JSConstSpec::Number, 2, 0},
-    {"tooSmall", JSConstSpec::Number, 3, 0},
-    {0, JSConstSpec::Number, 0, 0}};
+    {"tooSmall", JSConstSpec::Number, 3, 0}};
 
 int CJS_ScaleWhen::ObjDefnID = -1;
 
@@ -19,5 +18,5 @@
 void CJS_ScaleWhen::DefineJSObjects(CFXJS_Engine* pEngine) {
   ObjDefnID =
       pEngine->DefineObj("scaleWhen", FXJSOBJTYPE_STATIC, nullptr, nullptr);
-  DefineConsts(pEngine, ObjDefnID, ConstSpecs);
+  DefineConsts(pEngine, ObjDefnID, ConstSpecs, FX_ArraySize(ConstSpecs));
 }
diff --git a/fxjs/cjs_style.cpp b/fxjs/cjs_style.cpp
index 7458b2a..be95e9a 100644
--- a/fxjs/cjs_style.cpp
+++ b/fxjs/cjs_style.cpp
@@ -12,13 +12,12 @@
     {"di", JSConstSpec::String, 0, "diamond"},
     {"ci", JSConstSpec::String, 0, "circle"},
     {"st", JSConstSpec::String, 0, "star"},
-    {"sq", JSConstSpec::String, 0, "square"},
-    {0, JSConstSpec::Number, 0, 0}};
+    {"sq", JSConstSpec::String, 0, "square"}};
 
 int CJS_Style::ObjDefnID = -1;
 
 // static
 void CJS_Style::DefineJSObjects(CFXJS_Engine* pEngine) {
   ObjDefnID = pEngine->DefineObj("style", FXJSOBJTYPE_STATIC, nullptr, nullptr);
-  DefineConsts(pEngine, ObjDefnID, ConstSpecs);
+  DefineConsts(pEngine, ObjDefnID, ConstSpecs, FX_ArraySize(ConstSpecs));
 }
diff --git a/fxjs/cjs_util.cpp b/fxjs/cjs_util.cpp
index c7bf027..57267ad 100644
--- a/fxjs/cjs_util.cpp
+++ b/fxjs/cjs_util.cpp
@@ -58,9 +58,11 @@
 }  // namespace
 
 const JSMethodSpec CJS_Util::MethodSpecs[] = {
-    {"printd", printd_static},         {"printf", printf_static},
-    {"printx", printx_static},         {"scand", scand_static},
-    {"byteToChar", byteToChar_static}, {0, 0}};
+    {"printd", printd_static},
+    {"printf", printf_static},
+    {"printx", printx_static},
+    {"scand", scand_static},
+    {"byteToChar", byteToChar_static}};
 
 int CJS_Util::ObjDefnID = -1;
 
@@ -69,7 +71,7 @@
   ObjDefnID =
       pEngine->DefineObj("util", FXJSOBJTYPE_STATIC,
                          JSConstructor<CJS_Util, util>, JSDestructor<CJS_Util>);
-  DefineMethods(pEngine, ObjDefnID, MethodSpecs);
+  DefineMethods(pEngine, ObjDefnID, MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 util::util(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {}
diff --git a/fxjs/cjs_zoomtype.cpp b/fxjs/cjs_zoomtype.cpp
index 1cca58e..528bba0 100644
--- a/fxjs/cjs_zoomtype.cpp
+++ b/fxjs/cjs_zoomtype.cpp
@@ -13,8 +13,7 @@
     {"fitH", JSConstSpec::String, 0, "FitHeight"},
     {"fitV", JSConstSpec::String, 0, "FitVisibleWidth"},
     {"pref", JSConstSpec::String, 0, "Preferred"},
-    {"refW", JSConstSpec::String, 0, "ReflowWidth"},
-    {0, JSConstSpec::Number, 0, 0}};
+    {"refW", JSConstSpec::String, 0, "ReflowWidth"}};
 
 int CJS_Zoomtype::ObjDefnID = -1;
 
@@ -22,5 +21,5 @@
 void CJS_Zoomtype::DefineJSObjects(CFXJS_Engine* pEngine) {
   ObjDefnID =
       pEngine->DefineObj("zoomtype", FXJSOBJTYPE_STATIC, nullptr, nullptr);
-  DefineConsts(pEngine, ObjDefnID, ConstSpecs);
+  DefineConsts(pEngine, ObjDefnID, ConstSpecs, FX_ArraySize(ConstSpecs));
 }
diff --git a/fxjs/xfa/cjx_container.cpp b/fxjs/xfa/cjx_container.cpp
index a5d7921..cf0aca0 100644
--- a/fxjs/xfa/cjx_container.cpp
+++ b/fxjs/xfa/cjx_container.cpp
@@ -16,11 +16,10 @@
 
 const CJX_MethodSpec CJX_Container::MethodSpecs[] = {
     {"getDelta", getDelta_static},
-    {"getDeltas", getDeltas_static},
-    {"", nullptr}};
+    {"getDeltas", getDeltas_static}};
 
 CJX_Container::CJX_Container(CXFA_Node* node) : CJX_Node(node) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_Container::~CJX_Container() {}
diff --git a/fxjs/xfa/cjx_datawindow.cpp b/fxjs/xfa/cjx_datawindow.cpp
index 54f3204..47c743f 100644
--- a/fxjs/xfa/cjx_datawindow.cpp
+++ b/fxjs/xfa/cjx_datawindow.cpp
@@ -15,12 +15,11 @@
     {"gotoRecord", gotoRecord_static},
     {"isRecordGroup", isRecordGroup_static},
     {"moveCurrentRecord", moveCurrentRecord_static},
-    {"record", record_static},
-    {"", nullptr}};
+    {"record", record_static}};
 
 CJX_DataWindow::CJX_DataWindow(CScript_DataWindow* window)
     : CJX_Object(window) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_DataWindow::~CJX_DataWindow() {}
diff --git a/fxjs/xfa/cjx_delta.cpp b/fxjs/xfa/cjx_delta.cpp
index 1dfad24..c361bbb 100644
--- a/fxjs/xfa/cjx_delta.cpp
+++ b/fxjs/xfa/cjx_delta.cpp
@@ -12,11 +12,10 @@
 #include "fxjs/js_resources.h"
 #include "xfa/fxfa/parser/cxfa_delta.h"
 
-const CJX_MethodSpec CJX_Delta::MethodSpecs[] = {{"restore", restore_static},
-                                                 {"", nullptr}};
+const CJX_MethodSpec CJX_Delta::MethodSpecs[] = {{"restore", restore_static}};
 
 CJX_Delta::CJX_Delta(CXFA_Delta* delta) : CJX_Object(delta) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_Delta::~CJX_Delta() {}
diff --git a/fxjs/xfa/cjx_desc.cpp b/fxjs/xfa/cjx_desc.cpp
index 7ff58a7..03ab8f8 100644
--- a/fxjs/xfa/cjx_desc.cpp
+++ b/fxjs/xfa/cjx_desc.cpp
@@ -12,11 +12,10 @@
 #include "fxjs/js_resources.h"
 #include "xfa/fxfa/parser/cxfa_desc.h"
 
-const CJX_MethodSpec CJX_Desc::MethodSpecs[] = {{"metadata", metadata_static},
-                                                {"", nullptr}};
+const CJX_MethodSpec CJX_Desc::MethodSpecs[] = {{"metadata", metadata_static}};
 
 CJX_Desc::CJX_Desc(CXFA_Desc* desc) : CJX_Node(desc) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_Desc::~CJX_Desc() {}
diff --git a/fxjs/xfa/cjx_eventpseudomodel.cpp b/fxjs/xfa/cjx_eventpseudomodel.cpp
index a109d1c..449153c 100644
--- a/fxjs/xfa/cjx_eventpseudomodel.cpp
+++ b/fxjs/xfa/cjx_eventpseudomodel.cpp
@@ -45,12 +45,11 @@
 
 const CJX_MethodSpec CJX_EventPseudoModel::MethodSpecs[] = {
     {"emit", emit_static},
-    {"reset", reset_static},
-    {"", nullptr}};
+    {"reset", reset_static}};
 
 CJX_EventPseudoModel::CJX_EventPseudoModel(CScript_EventPseudoModel* model)
     : CJX_Object(model) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_EventPseudoModel::~CJX_EventPseudoModel() {}
diff --git a/fxjs/xfa/cjx_exclgroup.cpp b/fxjs/xfa/cjx_exclgroup.cpp
index 6317736..e24be80 100644
--- a/fxjs/xfa/cjx_exclgroup.cpp
+++ b/fxjs/xfa/cjx_exclgroup.cpp
@@ -23,11 +23,10 @@
     {"execEvent", execEvent_static},
     {"execInitialize", execInitialize_static},
     {"execValidate", execValidate_static},
-    {"selectedMember", selectedMember_static},
-    {"", nullptr}};
+    {"selectedMember", selectedMember_static}};
 
 CJX_ExclGroup::CJX_ExclGroup(CXFA_ExclGroup* group) : CJX_Node(group) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_ExclGroup::~CJX_ExclGroup() {}
diff --git a/fxjs/xfa/cjx_field.cpp b/fxjs/xfa/cjx_field.cpp
index d2cffbc..4b5f840 100644
--- a/fxjs/xfa/cjx_field.cpp
+++ b/fxjs/xfa/cjx_field.cpp
@@ -29,11 +29,10 @@
     {"getDisplayItem", getDisplayItem_static},
     {"getItemState", getItemState_static},
     {"getSaveItem", getSaveItem_static},
-    {"setItemState", setItemState_static},
-    {"", nullptr}};
+    {"setItemState", setItemState_static}};
 
 CJX_Field::CJX_Field(CXFA_Field* field) : CJX_Container(field) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_Field::~CJX_Field() {}
diff --git a/fxjs/xfa/cjx_form.cpp b/fxjs/xfa/cjx_form.cpp
index 22a7db2..54f06fe 100644
--- a/fxjs/xfa/cjx_form.cpp
+++ b/fxjs/xfa/cjx_form.cpp
@@ -23,11 +23,10 @@
     {"execValidate", execValidate_static},
     {"formNodes", formNodes_static},
     {"recalculate", recalculate_static},
-    {"remerge", remerge_static},
-    {"", nullptr}};
+    {"remerge", remerge_static}};
 
 CJX_Form::CJX_Form(CXFA_Form* form) : CJX_Model(form) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_Form::~CJX_Form() {}
diff --git a/fxjs/xfa/cjx_hostpseudomodel.cpp b/fxjs/xfa/cjx_hostpseudomodel.cpp
index 20e3bfe..555381f 100644
--- a/fxjs/xfa/cjx_hostpseudomodel.cpp
+++ b/fxjs/xfa/cjx_hostpseudomodel.cpp
@@ -61,12 +61,11 @@
     {"print", print_static},
     {"resetData", resetData_static},
     {"response", response_static},
-    {"setFocus", setFocus_static},
-    {"", nullptr}};
+    {"setFocus", setFocus_static}};
 
 CJX_HostPseudoModel::CJX_HostPseudoModel(CScript_HostPseudoModel* model)
     : CJX_Object(model) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_HostPseudoModel::~CJX_HostPseudoModel() {}
diff --git a/fxjs/xfa/cjx_instancemanager.cpp b/fxjs/xfa/cjx_instancemanager.cpp
index 19c6d72..23048f9 100644
--- a/fxjs/xfa/cjx_instancemanager.cpp
+++ b/fxjs/xfa/cjx_instancemanager.cpp
@@ -22,12 +22,11 @@
     {"insertInstance", insertInstance_static},
     {"moveInstance", moveInstance_static},
     {"removeInstance", removeInstance_static},
-    {"setInstances", setInstances_static},
-    {"", nullptr}};
+    {"setInstances", setInstances_static}};
 
 CJX_InstanceManager::CJX_InstanceManager(CXFA_InstanceManager* mgr)
     : CJX_Node(mgr) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_InstanceManager::~CJX_InstanceManager() {}
diff --git a/fxjs/xfa/cjx_layoutpseudomodel.cpp b/fxjs/xfa/cjx_layoutpseudomodel.cpp
index b80000a..4165a36 100644
--- a/fxjs/xfa/cjx_layoutpseudomodel.cpp
+++ b/fxjs/xfa/cjx_layoutpseudomodel.cpp
@@ -43,12 +43,11 @@
     {"sheetInBatch", sheetInBatch_static},
     {"w", w_static},
     {"x", x_static},
-    {"y", y_static},
-    {"", nullptr}};
+    {"y", y_static}};
 
 CJX_LayoutPseudoModel::CJX_LayoutPseudoModel(CScript_LayoutPseudoModel* model)
     : CJX_Object(model) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_LayoutPseudoModel::~CJX_LayoutPseudoModel() {}
diff --git a/fxjs/xfa/cjx_list.cpp b/fxjs/xfa/cjx_list.cpp
index 84bdf7b..198804d 100644
--- a/fxjs/xfa/cjx_list.cpp
+++ b/fxjs/xfa/cjx_list.cpp
@@ -18,11 +18,10 @@
 const CJX_MethodSpec CJX_List::MethodSpecs[] = {{"append", append_static},
                                                 {"insert", insert_static},
                                                 {"item", item_static},
-                                                {"remove", remove_static},
-                                                {"", nullptr}};
+                                                {"remove", remove_static}};
 
 CJX_List::CJX_List(CXFA_List* list) : CJX_Object(list) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_List::~CJX_List() {}
diff --git a/fxjs/xfa/cjx_logpseudomodel.cpp b/fxjs/xfa/cjx_logpseudomodel.cpp
index e0ed05d..810ddfa 100644
--- a/fxjs/xfa/cjx_logpseudomodel.cpp
+++ b/fxjs/xfa/cjx_logpseudomodel.cpp
@@ -16,12 +16,11 @@
     {"traceEnabled", traceEnabled_static},
     {"traceActivate", traceActivate_static},
     {"traceDeactivate", traceDeactivate_static},
-    {"trace", trace_static},
-    {"", nullptr}};
+    {"trace", trace_static}};
 
 CJX_LogPseudoModel::CJX_LogPseudoModel(CScript_LogPseudoModel* model)
     : CJX_Object(model) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_LogPseudoModel::~CJX_LogPseudoModel() {}
diff --git a/fxjs/xfa/cjx_manifest.cpp b/fxjs/xfa/cjx_manifest.cpp
index 6d5da2c..0f48b1d 100644
--- a/fxjs/xfa/cjx_manifest.cpp
+++ b/fxjs/xfa/cjx_manifest.cpp
@@ -13,11 +13,10 @@
 #include "xfa/fxfa/parser/cxfa_manifest.h"
 
 const CJX_MethodSpec CJX_Manifest::MethodSpecs[] = {
-    {"evaluate", evaluate_static},
-    {"", nullptr}};
+    {"evaluate", evaluate_static}};
 
 CJX_Manifest::CJX_Manifest(CXFA_Manifest* manifest) : CJX_Node(manifest) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_Manifest::~CJX_Manifest() {}
diff --git a/fxjs/xfa/cjx_model.cpp b/fxjs/xfa/cjx_model.cpp
index 6508416..7ab90e2 100644
--- a/fxjs/xfa/cjx_model.cpp
+++ b/fxjs/xfa/cjx_model.cpp
@@ -17,11 +17,10 @@
 const CJX_MethodSpec CJX_Model::MethodSpecs[] = {
     {"clearErrorList", clearErrorList_static},
     {"createNode", createNode_static},
-    {"isCompatibleNS", isCompatibleNS_static},
-    {"", nullptr}};
+    {"isCompatibleNS", isCompatibleNS_static}};
 
 CJX_Model::CJX_Model(CXFA_Node* node) : CJX_Node(node) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_Model::~CJX_Model() {}
diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp
index dd22fb4..d8a3b1c 100644
--- a/fxjs/xfa/cjx_node.cpp
+++ b/fxjs/xfa/cjx_node.cpp
@@ -135,11 +135,10 @@
     {"saveFilteredXML", saveFilteredXML_static},
     {"saveXML", saveXML_static},
     {"setAttribute", setAttribute_static},
-    {"setElement", setElement_static},
-    {"", nullptr}};
+    {"setElement", setElement_static}};
 
 CJX_Node::CJX_Node(CXFA_Node* node) : CJX_Tree(node) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_Node::~CJX_Node() = default;
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index 81ba1ac..d66483d 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -80,8 +80,9 @@
   ClearMapModuleBuffer();
 }
 
-void CJX_Object::DefineMethods(const CJX_MethodSpec method_specs[]) {
-  for (size_t i = 0; method_specs[i].pMethodCall != nullptr; ++i)
+void CJX_Object::DefineMethods(const CJX_MethodSpec method_specs[],
+                               size_t count) {
+  for (size_t i = 0; i < count; ++i)
     method_specs_[method_specs[i].pName] = method_specs[i].pMethodCall;
 }
 
diff --git a/fxjs/xfa/cjx_object.h b/fxjs/xfa/cjx_object.h
index cb8350d..3b9867e 100644
--- a/fxjs/xfa/cjx_object.h
+++ b/fxjs/xfa/cjx_object.h
@@ -116,7 +116,7 @@
   void ThrowParamCountMismatchException(const WideString& method) const;
 
  protected:
-  void DefineMethods(const CJX_MethodSpec method_specs[]);
+  void DefineMethods(const CJX_MethodSpec method_specs[], size_t count);
 
   void MoveBufferMapData(CXFA_Object* pSrcModule, CXFA_Object* pDstModule);
   void SetMapModuleString(void* pKey, const WideStringView& wsValue);
diff --git a/fxjs/xfa/cjx_packet.cpp b/fxjs/xfa/cjx_packet.cpp
index 0040951..2203d9b 100644
--- a/fxjs/xfa/cjx_packet.cpp
+++ b/fxjs/xfa/cjx_packet.cpp
@@ -15,11 +15,10 @@
 const CJX_MethodSpec CJX_Packet::MethodSpecs[] = {
     {"getAttribute", getAttribute_static},
     {"removeAttribute", removeAttribute_static},
-    {"setAttribute", setAttribute_static},
-    {"", nullptr}};
+    {"setAttribute", setAttribute_static}};
 
 CJX_Packet::CJX_Packet(CXFA_Packet* packet) : CJX_Node(packet) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_Packet::~CJX_Packet() {}
diff --git a/fxjs/xfa/cjx_signaturepseudomodel.cpp b/fxjs/xfa/cjx_signaturepseudomodel.cpp
index 6b39ac2..202532c 100644
--- a/fxjs/xfa/cjx_signaturepseudomodel.cpp
+++ b/fxjs/xfa/cjx_signaturepseudomodel.cpp
@@ -16,13 +16,12 @@
     {"verify", verifySignature_static},
     {"sign", sign_static},
     {"enumerate", enumerate_static},
-    {"clear", clear_static},
-    {"", nullptr}};
+    {"clear", clear_static}};
 
 CJX_SignaturePseudoModel::CJX_SignaturePseudoModel(
     CScript_SignaturePseudoModel* model)
     : CJX_Object(model) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_SignaturePseudoModel::~CJX_SignaturePseudoModel() {}
diff --git a/fxjs/xfa/cjx_source.cpp b/fxjs/xfa/cjx_source.cpp
index 17512b3..85742fe 100644
--- a/fxjs/xfa/cjx_source.cpp
+++ b/fxjs/xfa/cjx_source.cpp
@@ -29,11 +29,10 @@
     {"requery", requery_static},
     {"resync", resync_static},
     {"update", update_static},
-    {"updateBatch", updateBatch_static},
-    {"", nullptr}};
+    {"updateBatch", updateBatch_static}};
 
 CJX_Source::CJX_Source(CXFA_Source* src) : CJX_Node(src) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_Source::~CJX_Source() {}
diff --git a/fxjs/xfa/cjx_subform.cpp b/fxjs/xfa/cjx_subform.cpp
index a7e1d2a..fcf4cff 100644
--- a/fxjs/xfa/cjx_subform.cpp
+++ b/fxjs/xfa/cjx_subform.cpp
@@ -20,11 +20,10 @@
     {"execCalculate", execCalculate_static},
     {"execEvent", execEvent_static},
     {"execInitialize", execInitialize_static},
-    {"execValidate", execValidate_static},
-    {"", nullptr}};
+    {"execValidate", execValidate_static}};
 
 CJX_Subform::CJX_Subform(CXFA_Node* node) : CJX_Container(node) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_Subform::~CJX_Subform() {}
diff --git a/fxjs/xfa/cjx_template.cpp b/fxjs/xfa/cjx_template.cpp
index 48507c3..8ba2bca 100644
--- a/fxjs/xfa/cjx_template.cpp
+++ b/fxjs/xfa/cjx_template.cpp
@@ -19,11 +19,10 @@
     {"execValidate", execValidate_static},
     {"formNodes", formNodes_static},
     {"recalculate", recalculate_static},
-    {"remerge", remerge_static},
-    {"", nullptr}};
+    {"remerge", remerge_static}};
 
 CJX_Template::CJX_Template(CXFA_Template* tmpl) : CJX_Model(tmpl) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_Template::~CJX_Template() {}
diff --git a/fxjs/xfa/cjx_tree.cpp b/fxjs/xfa/cjx_tree.cpp
index 6c5e5ab..8e3143e 100644
--- a/fxjs/xfa/cjx_tree.cpp
+++ b/fxjs/xfa/cjx_tree.cpp
@@ -21,11 +21,10 @@
 
 const CJX_MethodSpec CJX_Tree::MethodSpecs[] = {
     {"resolveNode", resolveNode_static},
-    {"resolveNodes", resolveNodes_static},
-    {"", nullptr}};
+    {"resolveNodes", resolveNodes_static}};
 
 CJX_Tree::CJX_Tree(CXFA_Object* obj) : CJX_Object(obj) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_Tree::~CJX_Tree() {}
diff --git a/fxjs/xfa/cjx_treelist.cpp b/fxjs/xfa/cjx_treelist.cpp
index bb9e416..b91a0b7 100644
--- a/fxjs/xfa/cjx_treelist.cpp
+++ b/fxjs/xfa/cjx_treelist.cpp
@@ -16,11 +16,10 @@
 #include "xfa/fxfa/parser/cxfa_treelist.h"
 
 const CJX_MethodSpec CJX_TreeList::MethodSpecs[] = {
-    {"namedItem", namedItem_static},
-    {"", nullptr}};
+    {"namedItem", namedItem_static}};
 
 CJX_TreeList::CJX_TreeList(CXFA_TreeList* list) : CJX_List(list) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_TreeList::~CJX_TreeList() {}
diff --git a/fxjs/xfa/cjx_wsdlconnection.cpp b/fxjs/xfa/cjx_wsdlconnection.cpp
index a1d673f..1d0c306 100644
--- a/fxjs/xfa/cjx_wsdlconnection.cpp
+++ b/fxjs/xfa/cjx_wsdlconnection.cpp
@@ -13,12 +13,11 @@
 #include "xfa/fxfa/parser/cxfa_wsdlconnection.h"
 
 const CJX_MethodSpec CJX_WsdlConnection::MethodSpecs[] = {
-    {"execute", execute_static},
-    {"", nullptr}};
+    {"execute", execute_static}};
 
 CJX_WsdlConnection::CJX_WsdlConnection(CXFA_WsdlConnection* connection)
     : CJX_Node(connection) {
-  DefineMethods(MethodSpecs);
+  DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
 }
 
 CJX_WsdlConnection::~CJX_WsdlConnection() {}