Rename CJS_{KeyValue,GlobalData,GlobalVariableArray}.{h,cpp} to CFX_

Because these implement a typed value system akin to base::Value,
and do not call into any JavaScript at this layer. We can
reduce the number of simliar-sounding CJS_Global* names by using
the CFX_ prefix, and the CFX_ prefix hints that we should be
able someday to write a unit test for this without needing JS.

Rename CFX_GlobalVariableArray to CFX_GlobalArray for brevity.

Change-Id: I7e16760eb86c1690a68f8ac05c9a84a63f506556
Reviewed-on: https://pdfium-review.googlesource.com/c/44912
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/BUILD.gn b/fxjs/BUILD.gn
index 71551c3..433f726 100644
--- a/fxjs/BUILD.gn
+++ b/fxjs/BUILD.gn
@@ -24,6 +24,12 @@
 
   if (pdf_enable_v8) {
     sources += [
+      "cfx_globalarray.cpp",
+      "cfx_globalarray.h",
+      "cfx_globaldata.cpp",
+      "cfx_globaldata.h",
+      "cfx_keyvalue.cpp",
+      "cfx_keyvalue.h",
       "cfx_v8.cpp",
       "cfx_v8.h",
       "cfxjs_engine.cpp",
@@ -60,16 +66,10 @@
       "cjs_globalarrays.h",
       "cjs_globalconsts.cpp",
       "cjs_globalconsts.h",
-      "cjs_globaldata.cpp",
-      "cjs_globaldata.h",
-      "cjs_globalvariablearray.cpp",
-      "cjs_globalvariablearray.h",
       "cjs_highlight.cpp",
       "cjs_highlight.h",
       "cjs_icon.cpp",
       "cjs_icon.h",
-      "cjs_keyvalue.cpp",
-      "cjs_keyvalue.h",
       "cjs_object.cpp",
       "cjs_object.h",
       "cjs_position.cpp",
diff --git a/fxjs/cjs_globalvariablearray.cpp b/fxjs/cfx_globalarray.cpp
similarity index 67%
rename from fxjs/cjs_globalvariablearray.cpp
rename to fxjs/cfx_globalarray.cpp
index e8155b6..4221f65 100644
--- a/fxjs/cjs_globalvariablearray.cpp
+++ b/fxjs/cfx_globalarray.cpp
@@ -4,56 +4,55 @@
 
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
-#include "fxjs/cjs_globalvariablearray.h"
+#include "fxjs/cfx_globalarray.h"
 
 #include <utility>
 
-#include "fxjs/cjs_keyvalue.h"
+#include "fxjs/cfx_keyvalue.h"
 #include "third_party/base/ptr_util.h"
 
-CJS_GlobalVariableArray::CJS_GlobalVariableArray() {}
+CFX_GlobalArray::CFX_GlobalArray() = default;
 
-CJS_GlobalVariableArray::~CJS_GlobalVariableArray() {}
+CFX_GlobalArray::~CFX_GlobalArray() = default;
 
-CJS_GlobalVariableArray& CJS_GlobalVariableArray::operator=(
-    const CJS_GlobalVariableArray& that) {
+CFX_GlobalArray& CFX_GlobalArray::operator=(const CFX_GlobalArray& that) {
   if (this == &that)
     return *this;
 
   m_Array.clear();
   for (int i = 0, sz = that.Count(); i < sz; i++) {
-    CJS_KeyValue* pOldObjData = that.GetAt(i);
+    CFX_KeyValue* pOldObjData = that.GetAt(i);
     switch (pOldObjData->nType) {
       case JS_GlobalDataType::NUMBER: {
-        auto pNewObjData = pdfium::MakeUnique<CJS_KeyValue>();
+        auto pNewObjData = pdfium::MakeUnique<CFX_KeyValue>();
         pNewObjData->sKey = pOldObjData->sKey;
         pNewObjData->nType = pOldObjData->nType;
         pNewObjData->dData = pOldObjData->dData;
         Add(std::move(pNewObjData));
       } break;
       case JS_GlobalDataType::BOOLEAN: {
-        auto pNewObjData = pdfium::MakeUnique<CJS_KeyValue>();
+        auto pNewObjData = pdfium::MakeUnique<CFX_KeyValue>();
         pNewObjData->sKey = pOldObjData->sKey;
         pNewObjData->nType = pOldObjData->nType;
         pNewObjData->bData = pOldObjData->bData;
         Add(std::move(pNewObjData));
       } break;
       case JS_GlobalDataType::STRING: {
-        auto pNewObjData = pdfium::MakeUnique<CJS_KeyValue>();
+        auto pNewObjData = pdfium::MakeUnique<CFX_KeyValue>();
         pNewObjData->sKey = pOldObjData->sKey;
         pNewObjData->nType = pOldObjData->nType;
         pNewObjData->sData = pOldObjData->sData;
         Add(std::move(pNewObjData));
       } break;
       case JS_GlobalDataType::OBJECT: {
-        auto pNewObjData = pdfium::MakeUnique<CJS_KeyValue>();
+        auto pNewObjData = pdfium::MakeUnique<CFX_KeyValue>();
         pNewObjData->sKey = pOldObjData->sKey;
         pNewObjData->nType = pOldObjData->nType;
         pNewObjData->objData = pOldObjData->objData;
         Add(std::move(pNewObjData));
       } break;
       case JS_GlobalDataType::NULLOBJ: {
-        auto pNewObjData = pdfium::MakeUnique<CJS_KeyValue>();
+        auto pNewObjData = pdfium::MakeUnique<CFX_KeyValue>();
         pNewObjData->sKey = pOldObjData->sKey;
         pNewObjData->nType = pOldObjData->nType;
         Add(std::move(pNewObjData));
@@ -63,14 +62,14 @@
   return *this;
 }
 
-void CJS_GlobalVariableArray::Add(std::unique_ptr<CJS_KeyValue> pKeyValue) {
+void CFX_GlobalArray::Add(std::unique_ptr<CFX_KeyValue> pKeyValue) {
   m_Array.push_back(std::move(pKeyValue));
 }
 
-int CJS_GlobalVariableArray::Count() const {
+int CFX_GlobalArray::Count() const {
   return m_Array.size();
 }
 
-CJS_KeyValue* CJS_GlobalVariableArray::GetAt(int index) const {
+CFX_KeyValue* CFX_GlobalArray::GetAt(int index) const {
   return m_Array.at(index).get();
 }
diff --git a/fxjs/cfx_globalarray.h b/fxjs/cfx_globalarray.h
new file mode 100644
index 0000000..76c4157
--- /dev/null
+++ b/fxjs/cfx_globalarray.h
@@ -0,0 +1,30 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXJS_CFX_GLOBALARRAY_H_
+#define FXJS_CFX_GLOBALARRAY_H_
+
+#include <memory>
+#include <vector>
+
+class CFX_KeyValue;
+
+class CFX_GlobalArray {
+ public:
+  CFX_GlobalArray();
+  ~CFX_GlobalArray();
+
+  CFX_GlobalArray& operator=(const CFX_GlobalArray& array);
+
+  void Add(std::unique_ptr<CFX_KeyValue> pKeyValue);
+  int Count() const;
+  CFX_KeyValue* GetAt(int index) const;
+
+ private:
+  std::vector<std::unique_ptr<CFX_KeyValue>> m_Array;
+};
+
+#endif  // FXJS_CFX_GLOBALARRAY_H_
diff --git a/fxjs/cjs_globaldata.cpp b/fxjs/cfx_globaldata.cpp
similarity index 81%
rename from fxjs/cjs_globaldata.cpp
rename to fxjs/cfx_globaldata.cpp
index 0872b6a..e2036de 100644
--- a/fxjs/cjs_globaldata.cpp
+++ b/fxjs/cfx_globaldata.cpp
@@ -4,7 +4,7 @@
 
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
-#include "fxjs/cjs_globaldata.h"
+#include "fxjs/cfx_globaldata.h"
 
 #include <utility>
 
@@ -34,36 +34,36 @@
   return sPropName->GetLength() != 0;
 }
 
-CJS_GlobalData* g_pInstance = nullptr;
+CFX_GlobalData* g_pInstance = nullptr;
 
 }  // namespace
 
 // static
-CJS_GlobalData* CJS_GlobalData::GetRetainedInstance(
+CFX_GlobalData* CFX_GlobalData::GetRetainedInstance(
     CPDFSDK_FormFillEnvironment* pApp) {
   if (!g_pInstance) {
-    g_pInstance = new CJS_GlobalData();
+    g_pInstance = new CFX_GlobalData();
   }
   ++g_pInstance->m_RefCount;
   return g_pInstance;
 }
 
-void CJS_GlobalData::Release() {
+void CFX_GlobalData::Release() {
   if (!--m_RefCount) {
     delete g_pInstance;
     g_pInstance = nullptr;
   }
 }
 
-CJS_GlobalData::CJS_GlobalData() : m_sFilePath(SDK_JS_GLOBALDATA_FILENAME) {
+CFX_GlobalData::CFX_GlobalData() : m_sFilePath(SDK_JS_GLOBALDATA_FILENAME) {
   LoadGlobalPersistentVariables();
 }
 
-CJS_GlobalData::~CJS_GlobalData() {
+CFX_GlobalData::~CFX_GlobalData() {
   SaveGlobalPersisitentVariables();
 }
 
-CJS_GlobalData::iterator CJS_GlobalData::FindGlobalVariable(
+CFX_GlobalData::iterator CFX_GlobalData::FindGlobalVariable(
     const ByteString& propname) {
   for (auto it = m_arrayGlobalData.begin(); it != m_arrayGlobalData.end();
        ++it) {
@@ -73,7 +73,7 @@
   return m_arrayGlobalData.end();
 }
 
-CJS_GlobalData::const_iterator CJS_GlobalData::FindGlobalVariable(
+CFX_GlobalData::const_iterator CFX_GlobalData::FindGlobalVariable(
     const ByteString& propname) const {
   for (auto it = m_arrayGlobalData.begin(); it != m_arrayGlobalData.end();
        ++it) {
@@ -83,106 +83,105 @@
   return m_arrayGlobalData.end();
 }
 
-CJS_GlobalData::Element* CJS_GlobalData::GetGlobalVariable(
+CFX_GlobalData::Element* CFX_GlobalData::GetGlobalVariable(
     const ByteString& propname) {
   auto iter = FindGlobalVariable(propname);
   return iter != m_arrayGlobalData.end() ? iter->get() : nullptr;
 }
 
-void CJS_GlobalData::SetGlobalVariableNumber(ByteString sPropName,
+void CFX_GlobalData::SetGlobalVariableNumber(ByteString sPropName,
                                              double dData) {
   if (!TrimPropName(&sPropName))
     return;
 
-  CJS_GlobalData::Element* pData = GetGlobalVariable(sPropName);
+  CFX_GlobalData::Element* pData = GetGlobalVariable(sPropName);
   if (pData) {
     pData->data.nType = JS_GlobalDataType::NUMBER;
     pData->data.dData = dData;
     return;
   }
-  auto pNewData = pdfium::MakeUnique<CJS_GlobalData::Element>();
+  auto pNewData = pdfium::MakeUnique<CFX_GlobalData::Element>();
   pNewData->data.sKey = std::move(sPropName);
   pNewData->data.nType = JS_GlobalDataType::NUMBER;
   pNewData->data.dData = dData;
   m_arrayGlobalData.push_back(std::move(pNewData));
 }
 
-void CJS_GlobalData::SetGlobalVariableBoolean(ByteString sPropName,
+void CFX_GlobalData::SetGlobalVariableBoolean(ByteString sPropName,
                                               bool bData) {
   if (!TrimPropName(&sPropName))
     return;
 
-  CJS_GlobalData::Element* pData = GetGlobalVariable(sPropName);
+  CFX_GlobalData::Element* pData = GetGlobalVariable(sPropName);
   if (pData) {
     pData->data.nType = JS_GlobalDataType::BOOLEAN;
     pData->data.bData = bData;
     return;
   }
-  auto pNewData = pdfium::MakeUnique<CJS_GlobalData::Element>();
+  auto pNewData = pdfium::MakeUnique<CFX_GlobalData::Element>();
   pNewData->data.sKey = std::move(sPropName);
   pNewData->data.nType = JS_GlobalDataType::BOOLEAN;
   pNewData->data.bData = bData;
   m_arrayGlobalData.push_back(std::move(pNewData));
 }
 
-void CJS_GlobalData::SetGlobalVariableString(ByteString sPropName,
+void CFX_GlobalData::SetGlobalVariableString(ByteString sPropName,
                                              const ByteString& sData) {
   if (!TrimPropName(&sPropName))
     return;
 
-  CJS_GlobalData::Element* pData = GetGlobalVariable(sPropName);
+  CFX_GlobalData::Element* pData = GetGlobalVariable(sPropName);
   if (pData) {
     pData->data.nType = JS_GlobalDataType::STRING;
     pData->data.sData = sData;
     return;
   }
-  auto pNewData = pdfium::MakeUnique<CJS_GlobalData::Element>();
+  auto pNewData = pdfium::MakeUnique<CFX_GlobalData::Element>();
   pNewData->data.sKey = std::move(sPropName);
   pNewData->data.nType = JS_GlobalDataType::STRING;
   pNewData->data.sData = sData;
   m_arrayGlobalData.push_back(std::move(pNewData));
 }
 
-void CJS_GlobalData::SetGlobalVariableObject(
-    ByteString sPropName,
-    const CJS_GlobalVariableArray& array) {
+void CFX_GlobalData::SetGlobalVariableObject(ByteString sPropName,
+                                             const CFX_GlobalArray& array) {
   if (!TrimPropName(&sPropName))
     return;
 
-  CJS_GlobalData::Element* pData = GetGlobalVariable(sPropName);
+  CFX_GlobalData::Element* pData = GetGlobalVariable(sPropName);
   if (pData) {
     pData->data.nType = JS_GlobalDataType::OBJECT;
     pData->data.objData = array;
     return;
   }
-  auto pNewData = pdfium::MakeUnique<CJS_GlobalData::Element>();
+  auto pNewData = pdfium::MakeUnique<CFX_GlobalData::Element>();
   pNewData->data.sKey = std::move(sPropName);
   pNewData->data.nType = JS_GlobalDataType::OBJECT;
   pNewData->data.objData = array;
   m_arrayGlobalData.push_back(std::move(pNewData));
 }
 
-void CJS_GlobalData::SetGlobalVariableNull(ByteString sPropName) {
+void CFX_GlobalData::SetGlobalVariableNull(ByteString sPropName) {
   if (!TrimPropName(&sPropName))
     return;
 
-  CJS_GlobalData::Element* pData = GetGlobalVariable(sPropName);
+  CFX_GlobalData::Element* pData = GetGlobalVariable(sPropName);
   if (pData) {
     pData->data.nType = JS_GlobalDataType::NULLOBJ;
     return;
   }
-  auto pNewData = pdfium::MakeUnique<CJS_GlobalData::Element>();
+  auto pNewData = pdfium::MakeUnique<CFX_GlobalData::Element>();
   pNewData->data.sKey = std::move(sPropName);
   pNewData->data.nType = JS_GlobalDataType::NULLOBJ;
   m_arrayGlobalData.push_back(std::move(pNewData));
 }
 
-bool CJS_GlobalData::SetGlobalVariablePersistent(ByteString sPropName,
+bool CFX_GlobalData::SetGlobalVariablePersistent(ByteString sPropName,
                                                  bool bPersistent) {
   if (!TrimPropName(&sPropName))
     return false;
 
-  CJS_GlobalData::Element* pData = GetGlobalVariable(sPropName);
+  CFX_GlobalData::Element* pData = GetGlobalVariable(sPropName);
   if (!pData)
     return false;
 
@@ -190,7 +189,7 @@
   return true;
 }
 
-bool CJS_GlobalData::DeleteGlobalVariable(ByteString sPropName) {
+bool CFX_GlobalData::DeleteGlobalVariable(ByteString sPropName) {
   if (!TrimPropName(&sPropName))
     return false;
 
@@ -202,17 +201,17 @@
   return true;
 }
 
-int32_t CJS_GlobalData::GetSize() const {
+int32_t CFX_GlobalData::GetSize() const {
   return pdfium::CollectionSize<int32_t>(m_arrayGlobalData);
 }
 
-CJS_GlobalData::Element* CJS_GlobalData::GetAt(int index) const {
+CFX_GlobalData::Element* CFX_GlobalData::GetAt(int index) const {
   if (index < 0 || index >= GetSize())
     return nullptr;
   return m_arrayGlobalData[index].get();
 }
 
-void CJS_GlobalData::LoadGlobalPersistentVariables() {
+void CFX_GlobalData::LoadGlobalPersistentVariables() {
   uint8_t* pBuffer = nullptr;
   int32_t nLength = 0;
 
@@ -302,7 +301,7 @@
   }
 }
 
-void CJS_GlobalData::SaveGlobalPersisitentVariables() {
+void CFX_GlobalData::SaveGlobalPersisitentVariables() {
   uint32_t nCount = 0;
   CFX_BinaryBuf sData;
   for (const auto& pElement : m_arrayGlobalData) {
@@ -334,20 +333,20 @@
                   reinterpret_cast<char*>(sFile.GetBuffer()), sFile.GetSize());
 }
 
-void CJS_GlobalData::LoadFileBuffer(const wchar_t* sFilePath,
+void CFX_GlobalData::LoadFileBuffer(const wchar_t* sFilePath,
                                     uint8_t*& pBuffer,
                                     int32_t& nLength) {
   // UnSupport.
 }
 
-void CJS_GlobalData::WriteFileBuffer(const wchar_t* sFilePath,
+void CFX_GlobalData::WriteFileBuffer(const wchar_t* sFilePath,
                                      const char* pBuffer,
                                      int32_t nLength) {
   // UnSupport.
 }
 
-void CJS_GlobalData::MakeByteString(const ByteString& name,
-                                    CJS_KeyValue* pData,
+void CFX_GlobalData::MakeByteString(const ByteString& name,
+                                    CFX_KeyValue* pData,
                                     CFX_BinaryBuf& sData) {
   switch (pData->nType) {
     case JS_GlobalDataType::NUMBER: {
@@ -389,6 +388,6 @@
   }
 }
 
-CJS_GlobalData::Element::Element() = default;
+CFX_GlobalData::Element::Element() = default;
 
-CJS_GlobalData::Element::~Element() = default;
+CFX_GlobalData::Element::~Element() = default;
diff --git a/fxjs/cjs_globaldata.h b/fxjs/cfx_globaldata.h
similarity index 82%
rename from fxjs/cjs_globaldata.h
rename to fxjs/cfx_globaldata.h
index 1bff94d..d02e836 100644
--- a/fxjs/cjs_globaldata.h
+++ b/fxjs/cfx_globaldata.h
@@ -4,36 +4,36 @@
 
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
-#ifndef FXJS_CJS_GLOBALDATA_H_
-#define FXJS_CJS_GLOBALDATA_H_
+#ifndef FXJS_CFX_GLOBALDATA_H_
+#define FXJS_CFX_GLOBALDATA_H_
 
 #include <memory>
 #include <vector>
 
 #include "core/fxcrt/cfx_binarybuf.h"
-#include "fxjs/cjs_keyvalue.h"
+#include "fxjs/cfx_keyvalue.h"
 
 class CPDFSDK_FormFillEnvironment;
 
-class CJS_GlobalData {
+class CFX_GlobalData {
  public:
   class Element {
    public:
     Element();
     ~Element();
 
-    CJS_KeyValue data;
+    CFX_KeyValue data;
     bool bPersistent;
   };
 
-  static CJS_GlobalData* GetRetainedInstance(CPDFSDK_FormFillEnvironment* pApp);
+  static CFX_GlobalData* GetRetainedInstance(CPDFSDK_FormFillEnvironment* pApp);
   void Release();
 
   void SetGlobalVariableNumber(ByteString propname, double dData);
   void SetGlobalVariableBoolean(ByteString propname, bool bData);
   void SetGlobalVariableString(ByteString propname, const ByteString& sData);
   void SetGlobalVariableObject(ByteString propname,
-                               const CJS_GlobalVariableArray& array);
+                               const CFX_GlobalArray& array);
   void SetGlobalVariableNull(ByteString propname);
   bool SetGlobalVariablePersistent(ByteString propname, bool bPersistent);
   bool DeleteGlobalVariable(ByteString propname);
@@ -45,8 +45,8 @@
   using iterator = std::vector<std::unique_ptr<Element>>::iterator;
   using const_iterator = std::vector<std::unique_ptr<Element>>::const_iterator;
 
-  CJS_GlobalData();
-  ~CJS_GlobalData();
+  CFX_GlobalData();
+  ~CFX_GlobalData();
 
   void LoadGlobalPersistentVariables();
   void SaveGlobalPersisitentVariables();
@@ -62,7 +62,7 @@
                        const char* pBuffer,
                        int32_t nLength);
   void MakeByteString(const ByteString& name,
-                      CJS_KeyValue* pData,
+                      CFX_KeyValue* pData,
                       CFX_BinaryBuf& sData);
 
   size_t m_RefCount = 0;
@@ -70,4 +70,4 @@
   WideString m_sFilePath;
 };
 
-#endif  // FXJS_CJS_GLOBALDATA_H_
+#endif  // FXJS_CFX_GLOBALDATA_H_
diff --git a/fxjs/cjs_keyvalue.cpp b/fxjs/cfx_keyvalue.cpp
similarity index 68%
rename from fxjs/cjs_keyvalue.cpp
rename to fxjs/cfx_keyvalue.cpp
index 4fda3d6..5a4a5fb7 100644
--- a/fxjs/cjs_keyvalue.cpp
+++ b/fxjs/cfx_keyvalue.cpp
@@ -4,8 +4,8 @@
 
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
-#include "fxjs/cjs_keyvalue.h"
+#include "fxjs/cfx_keyvalue.h"
 
-CJS_KeyValue::CJS_KeyValue() {}
+CFX_KeyValue::CFX_KeyValue() = default;
 
-CJS_KeyValue::~CJS_KeyValue() {}
+CFX_KeyValue::~CFX_KeyValue() = default;
diff --git a/fxjs/cjs_keyvalue.h b/fxjs/cfx_keyvalue.h
similarity index 67%
rename from fxjs/cjs_keyvalue.h
rename to fxjs/cfx_keyvalue.h
index a1fd314..4563c00 100644
--- a/fxjs/cjs_keyvalue.h
+++ b/fxjs/cfx_keyvalue.h
@@ -4,25 +4,25 @@
 
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
-#ifndef FXJS_CJS_KEYVALUE_H_
-#define FXJS_CJS_KEYVALUE_H_
+#ifndef FXJS_CFX_KEYVALUE_H_
+#define FXJS_CFX_KEYVALUE_H_
 
 #include "core/fxcrt/fx_string.h"
-#include "fxjs/cjs_globalvariablearray.h"
+#include "fxjs/cfx_globalarray.h"
 
 enum class JS_GlobalDataType { NUMBER = 0, BOOLEAN, STRING, OBJECT, NULLOBJ };
 
-class CJS_KeyValue {
+class CFX_KeyValue {
  public:
-  CJS_KeyValue();
-  ~CJS_KeyValue();
+  CFX_KeyValue();
+  ~CFX_KeyValue();
 
   ByteString sKey;
   JS_GlobalDataType nType;
   double dData;
   bool bData;
   ByteString sData;
-  CJS_GlobalVariableArray objData;
+  CFX_GlobalArray objData;
 };
 
-#endif  // FXJS_CJS_KEYVALUE_H_
+#endif  // FXJS_CFX_KEYVALUE_H_
diff --git a/fxjs/cjs_global.cpp b/fxjs/cjs_global.cpp
index 62c5284..5bbedbb 100644
--- a/fxjs/cjs_global.cpp
+++ b/fxjs/cjs_global.cpp
@@ -12,10 +12,10 @@
 #include <vector>
 
 #include "core/fxcrt/fx_extension.h"
+#include "fxjs/cfx_globaldata.h"
+#include "fxjs/cfx_keyvalue.h"
 #include "fxjs/cjs_event_context.h"
 #include "fxjs/cjs_eventhandler.h"
-#include "fxjs/cjs_globaldata.h"
-#include "fxjs/cjs_keyvalue.h"
 #include "fxjs/cjs_object.h"
 #include "fxjs/js_define.h"
 #include "fxjs/js_resources.h"
@@ -220,7 +220,7 @@
     : CJS_Object(pObject, pRuntime) {
   CPDFSDK_FormFillEnvironment* pFormFillEnv = GetRuntime()->GetFormFillEnv();
   m_pFormFillEnv.Reset(pFormFillEnv);
-  m_pGlobalData = CJS_GlobalData::GetRetainedInstance(pFormFillEnv);
+  m_pGlobalData = CFX_GlobalData::GetRetainedInstance(pFormFillEnv);
   UpdateGlobalPersistentVariables();
 }
 
@@ -328,7 +328,7 @@
     return;
 
   for (int i = 0, sz = m_pGlobalData->GetSize(); i < sz; i++) {
-    CJS_GlobalData::Element* pData = m_pGlobalData->GetAt(i);
+    CFX_GlobalData::Element* pData = m_pGlobalData->GetAt(i);
     switch (pData->data.nType) {
       case JS_GlobalDataType::NUMBER:
         SetGlobalVariables(pData->data.sKey, JS_GlobalDataType::NUMBER,
@@ -396,7 +396,7 @@
         m_pGlobalData->SetGlobalVariablePersistent(name, pData->bPersistent);
         break;
       case JS_GlobalDataType::OBJECT: {
-        CJS_GlobalVariableArray array;
+        CFX_GlobalArray array;
         v8::Local<v8::Object> obj =
             v8::Local<v8::Object>::New(GetIsolate(), pData->pData);
         ObjectToArray(pRuntime, obj, &array);
@@ -413,13 +413,13 @@
 
 void CJS_Global::ObjectToArray(CJS_Runtime* pRuntime,
                                v8::Local<v8::Object> pObj,
-                               CJS_GlobalVariableArray* pArray) {
+                               CFX_GlobalArray* pArray) {
   std::vector<WideString> pKeyList = pRuntime->GetObjectPropertyNames(pObj);
   for (const auto& ws : pKeyList) {
     ByteString sKey = ws.UTF8Encode();
     v8::Local<v8::Value> v = pRuntime->GetObjectProperty(pObj, ws);
     if (v->IsNumber()) {
-      auto pObjElement = pdfium::MakeUnique<CJS_KeyValue>();
+      auto pObjElement = pdfium::MakeUnique<CFX_KeyValue>();
       pObjElement->nType = JS_GlobalDataType::NUMBER;
       pObjElement->sKey = sKey;
       pObjElement->dData = pRuntime->ToDouble(v);
@@ -427,7 +427,7 @@
       continue;
     }
     if (v->IsBoolean()) {
-      auto pObjElement = pdfium::MakeUnique<CJS_KeyValue>();
+      auto pObjElement = pdfium::MakeUnique<CFX_KeyValue>();
       pObjElement->nType = JS_GlobalDataType::BOOLEAN;
       pObjElement->sKey = sKey;
       pObjElement->dData = pRuntime->ToBoolean(v);
@@ -436,7 +436,7 @@
     }
     if (v->IsString()) {
       ByteString sValue = pRuntime->ToWideString(v).ToDefANSI();
-      auto pObjElement = pdfium::MakeUnique<CJS_KeyValue>();
+      auto pObjElement = pdfium::MakeUnique<CFX_KeyValue>();
       pObjElement->nType = JS_GlobalDataType::STRING;
       pObjElement->sKey = sKey;
       pObjElement->sData = sValue;
@@ -444,7 +444,7 @@
       continue;
     }
     if (v->IsObject()) {
-      auto pObjElement = pdfium::MakeUnique<CJS_KeyValue>();
+      auto pObjElement = pdfium::MakeUnique<CFX_KeyValue>();
       pObjElement->nType = JS_GlobalDataType::OBJECT;
       pObjElement->sKey = sKey;
       ObjectToArray(pRuntime, pRuntime->ToObject(v), &pObjElement->objData);
@@ -452,7 +452,7 @@
       continue;
     }
     if (v->IsNull()) {
-      auto pObjElement = pdfium::MakeUnique<CJS_KeyValue>();
+      auto pObjElement = pdfium::MakeUnique<CFX_KeyValue>();
       pObjElement->nType = JS_GlobalDataType::NULLOBJ;
       pObjElement->sKey = sKey;
       pArray->Add(std::move(pObjElement));
@@ -461,13 +461,13 @@
 }
 
 void CJS_Global::PutObjectProperty(v8::Local<v8::Object> pObj,
-                                   CJS_KeyValue* pData) {
+                                   CFX_KeyValue* pData) {
   CJS_Runtime* pRuntime = GetRuntime();
   if (pRuntime)
     return;
 
   for (int i = 0, sz = pData->objData.Count(); i < sz; i++) {
-    CJS_KeyValue* pObjData = pData->objData.GetAt(i);
+    CFX_KeyValue* pObjData = pData->objData.GetAt(i);
     switch (pObjData->nType) {
       case JS_GlobalDataType::NUMBER:
         pRuntime->PutObjectProperty(pObj, pObjData->sKey.UTF8Decode(),
diff --git a/fxjs/cjs_global.h b/fxjs/cjs_global.h
index abdcfa3..4996266 100644
--- a/fxjs/cjs_global.h
+++ b/fxjs/cjs_global.h
@@ -11,11 +11,11 @@
 #include <memory>
 #include <vector>
 
-#include "fxjs/cjs_keyvalue.h"
+#include "fxjs/cfx_keyvalue.h"
 #include "fxjs/cjs_object.h"
 #include "fxjs/cjs_result.h"
 
-class CJS_GlobalData;
+class CFX_GlobalData;
 
 class CJS_Global final : public CJS_Object {
  public:
@@ -79,12 +79,12 @@
                                 bool bDefaultPersistent);
   void ObjectToArray(CJS_Runtime* pRuntime,
                      v8::Local<v8::Object> pObj,
-                     CJS_GlobalVariableArray* pArray);
-  void PutObjectProperty(v8::Local<v8::Object> obj, CJS_KeyValue* pData);
+                     CFX_GlobalArray* pArray);
+  void PutObjectProperty(v8::Local<v8::Object> obj, CFX_KeyValue* pData);
 
   std::map<ByteString, std::unique_ptr<JSGlobalData>> m_MapGlobal;
   WideString m_sFilePath;
-  CJS_GlobalData* m_pGlobalData;
+  CFX_GlobalData* m_pGlobalData;
   CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
 };
 
diff --git a/fxjs/cjs_globalvariablearray.h b/fxjs/cjs_globalvariablearray.h
deleted file mode 100644
index ae98d3e..0000000
--- a/fxjs/cjs_globalvariablearray.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2017 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FXJS_CJS_GLOBALVARIABLEARRAY_H_
-#define FXJS_CJS_GLOBALVARIABLEARRAY_H_
-
-#include <memory>
-#include <vector>
-
-class CJS_KeyValue;
-
-class CJS_GlobalVariableArray {
- public:
-  CJS_GlobalVariableArray();
-  ~CJS_GlobalVariableArray();
-
-  CJS_GlobalVariableArray& operator=(const CJS_GlobalVariableArray& array);
-
-  void Add(std::unique_ptr<CJS_KeyValue> pKeyValue);
-  int Count() const;
-  CJS_KeyValue* GetAt(int index) const;
-
- private:
-  std::vector<std::unique_ptr<CJS_KeyValue>> m_Array;
-};
-
-#endif  // FXJS_CJS_GLOBALVARIABLEARRAY_H_
diff --git a/fxjs/cjs_runtime.cpp b/fxjs/cjs_runtime.cpp
index 5034915..fb2a6e2 100644
--- a/fxjs/cjs_runtime.cpp
+++ b/fxjs/cjs_runtime.cpp
@@ -9,6 +9,7 @@
 #include <algorithm>
 
 #include "fpdfsdk/cpdfsdk_formfillenvironment.h"
+#include "fxjs/cfx_globaldata.h"
 #include "fxjs/cjs_annot.h"
 #include "fxjs/cjs_app.h"
 #include "fxjs/cjs_border.h"
@@ -24,7 +25,6 @@
 #include "fxjs/cjs_global.h"
 #include "fxjs/cjs_globalarrays.h"
 #include "fxjs/cjs_globalconsts.h"
-#include "fxjs/cjs_globaldata.h"
 #include "fxjs/cjs_highlight.h"
 #include "fxjs/cjs_icon.h"
 #include "fxjs/cjs_object.h"