Cover some more CJX_Field JavaScript callbacks.

Change-Id: I99c4a2c860da0d4302ff41a8755041e609ecb054
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/66292
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/testing/resources/javascript/xfa_specific/xfa_field.in b/testing/resources/javascript/xfa_specific/xfa_field.in
index 11862d7..a358921 100644
--- a/testing/resources/javascript/xfa_specific/xfa_field.in
+++ b/testing/resources/javascript/xfa_specific/xfa_field.in
@@ -21,8 +21,12 @@
       <occur initial="1" max="10" min="0" name="occur1">
       </occur>
       <field name="field1" h="10mm"  w="40mm" x="10mm" y="12mm" border="solid">
+        <items>
+          <text>and a one</text>
+          <text>and a two</text>
+        </items>
         <event activity="ready" ref="$form">
-          <script contentType="application/x-javascript">
+          <script contentType="application/x-javascript"><![CDATA[
             {{include ../expect.js}}
             {{include ../property_test_helpers.js}}
             var field = xfa.resolveNode("field1");
@@ -38,7 +42,40 @@
             testRWProperty(field, "mandatory", "disabled", "solid");
             testRWProperty(field, "mandatoryMessage", "", "keep out");
             testROProperty(field, "dataNode", "[object XFAObject]");
-          </script>
+            testROProperty(field, "length", 2);
+
+            expectError("field.execInitialize('phooey')");
+            expect("field.execInitialize()", undefined);
+
+            expectError("field.execEvent()");
+            expectError("field.execEvent(1, 2)");
+            expect("field.execEvent('validate')", true);
+
+            expectError("field.deleteItem()");
+            expectError("field.deleteItem(1, 2)");
+            expect("field.deleteItem(1)", true);
+            expect("field.deleteItem(137)", true);  // silently ignored?
+
+            expectError("field.getSaveItem()");
+            expectError("field.getSaveItem(1, 2)");
+            expect("field.getSaveItem(0)", "and a one");
+            expect("field.getSaveItem(137)", null);
+
+            expectError("field.getItemState()");
+            expectError("field.getItemState(1, 2)");
+            expect("field.getItemState(0)", false);
+            expect("field.getItemState(1)", false);
+            expect("field.getItemState(137)", false);
+            expect("field.getItemState(-137)", false);
+
+            expectError("field.setItemState()");
+            expectError("field.setItemState(1, 2, 3)");
+            expect("field.setItemState(0, 1)", undefined);
+            expect("field.getItemState(0)", true);
+            expect("field.setItemState(0, 0)", undefined);
+            expect("field.getItemState(0)", false);
+
+          ]]></script>
         </event>
       </field>
     </subform>
diff --git a/testing/resources/javascript/xfa_specific/xfa_field_expected.txt b/testing/resources/javascript/xfa_specific/xfa_field_expected.txt
index 0d339db..645518a 100644
--- a/testing/resources/javascript/xfa_specific/xfa_field_expected.txt
+++ b/testing/resources/javascript/xfa_specific/xfa_field_expected.txt
@@ -18,3 +18,30 @@
 Alert: PASS: mandatoryMessage = keep out
 Alert: PASS: dataNode = [object XFAObject]
 Alert: PASS: dataNode threw Error: Invalid property set operation.
+Alert: PASS: length = 2
+Alert: PASS: length threw Error: Invalid property set operation.
+Alert: PASS: field.execInitialize('phooey') threw XFAObject.execInitialize: Incorrect number of parameters passed to function.
+Alert: PASS: field.execInitialize() = undefined
+Alert: PASS: field.execEvent() threw XFAObject.execEvent: Incorrect number of parameters passed to function.
+Alert: PASS: field.execEvent(1, 2) threw XFAObject.execEvent: Incorrect number of parameters passed to function.
+Alert: PASS: field.execEvent('validate') = true
+Alert: PASS: field.deleteItem() threw XFAObject.deleteItem: Incorrect number of parameters passed to function.
+Alert: PASS: field.deleteItem(1, 2) threw XFAObject.deleteItem: Incorrect number of parameters passed to function.
+Alert: PASS: field.deleteItem(1) = true
+Alert: PASS: field.deleteItem(137) = true
+Alert: PASS: field.getSaveItem() threw XFAObject.getSaveItem: Incorrect number of parameters passed to function.
+Alert: PASS: field.getSaveItem(1, 2) threw XFAObject.getSaveItem: Incorrect number of parameters passed to function.
+Alert: PASS: field.getSaveItem(0) = and a one
+Alert: PASS: field.getSaveItem(137) = null
+Alert: PASS: field.getItemState() threw XFAObject.getItemState: Incorrect number of parameters passed to function.
+Alert: PASS: field.getItemState(1, 2) threw XFAObject.getItemState: Incorrect number of parameters passed to function.
+Alert: PASS: field.getItemState(0) = false
+Alert: PASS: field.getItemState(1) = false
+Alert: PASS: field.getItemState(137) = false
+Alert: PASS: field.getItemState(-137) = false
+Alert: PASS: field.setItemState() threw XFAObject.setItemState: Incorrect number of parameters passed to function.
+Alert: PASS: field.setItemState(1, 2, 3) threw XFAObject.setItemState: Incorrect number of parameters passed to function.
+Alert: PASS: field.setItemState(0, 1) = undefined
+Alert: PASS: field.getItemState(0) = true
+Alert: PASS: field.setItemState(0, 0) = undefined
+Alert: PASS: field.getItemState(0) = false