summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/global.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-08-11 19:50:57 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-11 19:50:57 -0700
commitd0b6ed1a0842386e474c5fcd6bdbb260bb631bd1 (patch)
tree6d7282f78ac953fc965e17815bcbef7995dd59ec /fpdfsdk/javascript/global.cpp
parent229d05df5bc5deb3890b26b614113c25d9b6935e (diff)
downloadpdfium-d0b6ed1a0842386e474c5fcd6bdbb260bb631bd1.tar.xz
Make FXJS_GetObjectElement return std::vector<CFX_WideString>.chromium/2829chromium/2828
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
Diffstat (limited to 'fpdfsdk/javascript/global.cpp')
-rw-r--r--fpdfsdk/javascript/global.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp
index 10bab26dd0..5ffc5594a6 100644
--- a/fpdfsdk/javascript/global.cpp
+++ b/fpdfsdk/javascript/global.cpp
@@ -273,13 +273,11 @@ void JSGlobalAlternate::ObjectToArray(IJS_Context* cc,
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;