Make FXJS_GetObjectElement return std::vector<CFX_WideString>.

Analogous to getting the length of JS array, this result
should be a C++-side object only.

Also rename to FXJS_GetObjectProperty to match JS nomenclature.

Review-Url: https://codereview.chromium.org/2242593002
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index ea77e1c..a55bf81 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -615,17 +615,17 @@
   } else if (v.GetType() == CJS_Value::VT_object) {
     v8::Local<v8::Object> pObj = params[0].ToV8Object(pIsolate);
     v8::Local<v8::Value> pValue =
-        FXJS_GetObjectElement(pIsolate, pObj, L"cURL");
+        FXJS_GetObjectProperty(pIsolate, pObj, L"cURL");
     if (!pValue.IsEmpty())
       strURL = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate);
 
-    pValue = FXJS_GetObjectElement(pIsolate, pObj, L"bFDF");
+    pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"bFDF");
     bFDF = CJS_Value(pRuntime, pValue).ToBool(pIsolate);
 
-    pValue = FXJS_GetObjectElement(pIsolate, pObj, L"bEmpty");
+    pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"bEmpty");
     bEmpty = CJS_Value(pRuntime, pValue).ToBool(pIsolate);
 
-    pValue = FXJS_GetObjectElement(pIsolate, pObj, L"aFields");
+    pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"aFields");
     aFields.Attach(CJS_Value(pRuntime, pValue).ToV8Array(pIsolate));
   }
 
@@ -712,22 +712,23 @@
   if (params.size() >= 1 && params[0].GetType() == CJS_Value::VT_object) {
     v8::Local<v8::Object> pObj = params[0].ToV8Object(pIsolate);
 
-    v8::Local<v8::Value> pValue = FXJS_GetObjectElement(pIsolate, pObj, L"bUI");
+    v8::Local<v8::Value> pValue =
+        FXJS_GetObjectProperty(pIsolate, pObj, L"bUI");
     bUI = CJS_Value(pRuntime, pValue).ToInt(pIsolate);
 
-    pValue = FXJS_GetObjectElement(pIsolate, pObj, L"cTo");
+    pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"cTo");
     cTo = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate);
 
-    pValue = FXJS_GetObjectElement(pIsolate, pObj, L"cCc");
+    pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"cCc");
     cCc = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate);
 
-    pValue = FXJS_GetObjectElement(pIsolate, pObj, L"cBcc");
+    pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"cBcc");
     cBcc = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate);
 
-    pValue = FXJS_GetObjectElement(pIsolate, pObj, L"cSubject");
+    pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"cSubject");
     cSubject = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate);
 
-    pValue = FXJS_GetObjectElement(pIsolate, pObj, L"cMsg");
+    pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"cMsg");
     cMsg = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate);
   }
 
diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp
index 8f448a9..b719835 100644
--- a/fpdfsdk/javascript/JS_Value.cpp
+++ b/fpdfsdk/javascript/JS_Value.cpp
@@ -771,7 +771,7 @@
   for (size_t i = 0; i < nKeywords; ++i) {
     const wchar_t* property = va_arg(ap, const wchar_t*);
     v8::Local<v8::Value> v8Value =
-        FXJS_GetObjectElement(pRuntime->GetIsolate(), pObj, property);
+        FXJS_GetObjectProperty(pRuntime->GetIsolate(), pObj, property);
     if (!v8Value->IsUndefined())
       result[i] = CJS_Value(pRuntime, v8Value);
   }
diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp
index 10bab26..5ffc559 100644
--- a/fpdfsdk/javascript/global.cpp
+++ b/fpdfsdk/javascript/global.cpp
@@ -273,13 +273,11 @@
                                       CJS_GlobalVariableArray& array) {
   v8::Isolate* isolate = pObj->GetIsolate();
   CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
-  v8::Local<v8::Array> pKeyList = FXJS_GetObjectElementNames(isolate, pObj);
-  int nObjElements = pKeyList->Length();
-  for (int i = 0; i < nObjElements; i++) {
-    CFX_WideString ws =
-        FXJS_ToString(isolate, FXJS_GetArrayElement(isolate, pKeyList, i));
+  std::vector<CFX_WideString> pKeyList =
+      FXJS_GetObjectPropertyNames(isolate, pObj);
+  for (const auto& ws : pKeyList) {
     CFX_ByteString sKey = ws.UTF8Encode();
-    v8::Local<v8::Value> v = FXJS_GetObjectElement(isolate, pObj, ws);
+    v8::Local<v8::Value> v = FXJS_GetObjectProperty(isolate, pObj, ws);
     switch (CJS_Value::GetValueType(v)) {
       case CJS_Value::VT_number: {
         CJS_KeyValue* pObjElement = new CJS_KeyValue;