Fix typos of the word occurrence.

Change-Id: I6bdeb64c7276850b5538a1e70faa2b740cb45739
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/85230
Commit-Queue: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index 3989829..2e6c5a4 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -780,8 +780,8 @@
     return false;
 
   // Verify that the number of values is equal to |selected_indices_size|. Then,
-  // count the number of occurances of each of the distinct values in the values
-  // object.
+  // count the number of occurrences of each of the distinct values in the
+  // values object.
   std::map<WideString, size_t> values;
   const CPDF_Array* pValueArray = pValueObject->AsArray();
   if (pValueArray) {
diff --git a/fxjs/js_resources.cpp b/fxjs/js_resources.cpp
index af306d3..8fb88a4 100644
--- a/fxjs/js_resources.cpp
+++ b/fxjs/js_resources.cpp
@@ -83,8 +83,8 @@
     case JSMessage::kUserGestureRequiredError:
       msg_string = "User gesture required.";
       break;
-    case JSMessage::kTooManyOccurances:
-      msg_string = "Too many occurances.";
+    case JSMessage::kTooManyOccurrences:
+      msg_string = "Too many occurrences.";
       break;
     case JSMessage::kUnknownMethod:
       msg_string = "Unknown method.";
diff --git a/fxjs/js_resources.h b/fxjs/js_resources.h
index 1f0518d..73907b6 100644
--- a/fxjs/js_resources.h
+++ b/fxjs/js_resources.h
@@ -33,7 +33,7 @@
   kUnknownProperty,
   kInvalidSetError,
   kUserGestureRequiredError,
-  kTooManyOccurances,
+  kTooManyOccurrences,
   kUnknownMethod,
   kWouldBeCyclic,
 };
diff --git a/fxjs/xfa/cjx_instancemanager.cpp b/fxjs/xfa/cjx_instancemanager.cpp
index c73438a..cba15a9 100644
--- a/fxjs/xfa/cjx_instancemanager.cpp
+++ b/fxjs/xfa/cjx_instancemanager.cpp
@@ -41,13 +41,13 @@
   CXFA_Occur* occur = GetXFANode()->GetOccurIfExists();
   int32_t iMin = occur ? occur->GetMin() : CXFA_Occur::kDefaultMin;
   if (iDesired < iMin) {
-    ThrowTooManyOccurancesException(L"min");
+    ThrowTooManyOccurrencesException(L"min");
     return 1;
   }
 
   int32_t iMax = occur ? occur->GetMax() : CXFA_Occur::kDefaultMax;
   if (iMax >= 0 && iDesired > iMax) {
-    ThrowTooManyOccurancesException(L"max");
+    ThrowTooManyOccurrencesException(L"max");
     return 2;
   }
 
@@ -179,7 +179,7 @@
   CXFA_Occur* occur = GetXFANode()->GetOccurIfExists();
   int32_t iMin = occur ? occur->GetMin() : CXFA_Occur::kDefaultMin;
   if (iCount - 1 < iMin)
-    return CJS_Result::Failure(JSMessage::kTooManyOccurances);
+    return CJS_Result::Failure(JSMessage::kTooManyOccurrences);
 
   CXFA_Node* pRemoveInstance = GetXFANode()->GetItemIfExists(iIndex);
   if (!pRemoveInstance)
@@ -234,7 +234,7 @@
   CXFA_Occur* occur = GetXFANode()->GetOccurIfExists();
   int32_t iMax = occur ? occur->GetMax() : CXFA_Occur::kDefaultMax;
   if (iMax >= 0 && iCount >= iMax)
-    return CJS_Result::Failure(JSMessage::kTooManyOccurances);
+    return CJS_Result::Failure(JSMessage::kTooManyOccurrences);
 
   CXFA_Node* pNewInstance = GetXFANode()->CreateInstanceIfPossible(fFlags);
   if (!pNewInstance)
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index d4082d1..c10394d 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -166,7 +166,7 @@
                     params);
 }
 
-void CJX_Object::ThrowTooManyOccurancesException(const WideString& obj) const {
+void CJX_Object::ThrowTooManyOccurrencesException(const WideString& obj) const {
   ThrowException(WideString::FromASCII("The element [") + obj +
                  WideString::FromASCII(
                      "] has violated its allowable number of occurrences."));
diff --git a/fxjs/xfa/cjx_object.h b/fxjs/xfa/cjx_object.h
index aec1d19..3b46650 100644
--- a/fxjs/xfa/cjx_object.h
+++ b/fxjs/xfa/cjx_object.h
@@ -212,7 +212,7 @@
   void ThrowArgumentMismatchException() const;
   void ThrowIndexOutOfBoundsException() const;
   void ThrowParamCountMismatchException(const WideString& method) const;
-  void ThrowTooManyOccurancesException(const WideString& obj) const;
+  void ThrowTooManyOccurrencesException(const WideString& obj) const;
 
  protected:
   enum class SOMMessageType {
diff --git a/testing/resources/javascript/xfa_specific/instance_manager_expected.txt b/testing/resources/javascript/xfa_specific/instance_manager_expected.txt
index 9956b88..d39657f 100644
--- a/testing/resources/javascript/xfa_specific/instance_manager_expected.txt
+++ b/testing/resources/javascript/xfa_specific/instance_manager_expected.txt
@@ -35,5 +35,5 @@
 Alert: PASS: mgr.removeInstance(0) = undefined
 Alert: PASS: mgr.removeInstance(0) = undefined
 Alert: PASS: mgr.count = 1
-Alert: PASS: mgr.removeInstance(0) threw XFAObject.removeInstance: Too many occurances.
+Alert: PASS: mgr.removeInstance(0) threw XFAObject.removeInstance: Too many occurrences.
 Alert: PASS: mgr.count = 1
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 90db28d..c285580 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -1101,15 +1101,15 @@
   return data && !!(data->flags & flag);
 }
 
-uint8_t CXFA_Node::PropertyOccuranceCount(XFA_Element property) const {
+uint8_t CXFA_Node::PropertyOccurrenceCount(XFA_Element property) const {
   const PropertyData* data = GetPropertyData(property);
-  return data ? data->occurance_count : 0;
+  return data ? data->occurrence_count : 0;
 }
 
 std::pair<CXFA_Node*, int32_t> CXFA_Node::GetProperty(
     int32_t index,
     XFA_Element eProperty) const {
-  if (index < 0 || index >= PropertyOccuranceCount(eProperty))
+  if (index < 0 || index >= PropertyOccurrenceCount(eProperty))
     return {nullptr, 0};
 
   int32_t iCount = 0;
@@ -1126,7 +1126,7 @@
 
 CXFA_Node* CXFA_Node::GetOrCreateProperty(int32_t index,
                                           XFA_Element eProperty) {
-  if (index < 0 || index >= PropertyOccuranceCount(eProperty))
+  if (index < 0 || index >= PropertyOccurrenceCount(eProperty))
     return nullptr;
 
   int32_t iCount = 0;
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 0bbf817..c6cec42 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -95,7 +95,7 @@
     PropertyData() = delete;
 
     XFA_Element property;
-    uint8_t occurance_count;
+    uint8_t occurrence_count;
     Mask<XFA_PropertyFlag> flags;
   };
 
@@ -117,7 +117,7 @@
 
   bool HasProperty(XFA_Element property) const;
   bool HasPropertyFlag(XFA_Element property, XFA_PropertyFlag flag) const;
-  uint8_t PropertyOccuranceCount(XFA_Element property) const;
+  uint8_t PropertyOccurrenceCount(XFA_Element property) const;
 
   std::pair<CXFA_Node*, int32_t> GetProperty(int32_t index,
                                              XFA_Element eProperty) const;