Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1932)

Unified Diff: fpdfsdk/javascript/global.cpp

Issue 2242593002: Make FXJS_GetObjectElement return std::vector<CFX_WideString>. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/javascript/JS_Value.cpp ('k') | fxjs/fxjs_v8.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/javascript/global.cpp
diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp
index 10bab26dd0b3397c75ad8c233870771635e84212..5ffc5594a67e76cf9c4cdaddc411a5ccc0151345 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;
« no previous file with comments | « fpdfsdk/javascript/JS_Value.cpp ('k') | fxjs/fxjs_v8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698