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

Unified Diff: fxjs/fxjs_v8.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/global.cpp ('k') | fxjs/fxjs_v8_embeddertest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fxjs/fxjs_v8.cpp
diff --git a/fxjs/fxjs_v8.cpp b/fxjs/fxjs_v8.cpp
index d161af62819c68fe5b69d556c8e9457dfb6afa25..92207fdd47010962b85b08c2e21b9d028d9181e6 100644
--- a/fxjs/fxjs_v8.cpp
+++ b/fxjs/fxjs_v8.cpp
@@ -596,7 +596,7 @@ v8::Local<v8::String> FXJS_WSToJSString(v8::Isolate* pIsolate,
.ToLocalChecked();
}
-v8::Local<v8::Value> FXJS_GetObjectElement(
+v8::Local<v8::Value> FXJS_GetObjectProperty(
v8::Isolate* pIsolate,
v8::Local<v8::Object> pObj,
const CFX_WideString& wsPropertyName) {
@@ -610,14 +610,23 @@ v8::Local<v8::Value> FXJS_GetObjectElement(
return val;
}
-v8::Local<v8::Array> FXJS_GetObjectElementNames(v8::Isolate* pIsolate,
- v8::Local<v8::Object> pObj) {
+std::vector<CFX_WideString> FXJS_GetObjectPropertyNames(
+ v8::Isolate* pIsolate,
+ v8::Local<v8::Object> pObj) {
if (pObj.IsEmpty())
- return v8::Local<v8::Array>();
+ return std::vector<CFX_WideString>();
+
v8::Local<v8::Array> val;
if (!pObj->GetPropertyNames(pIsolate->GetCurrentContext()).ToLocal(&val))
- return v8::Local<v8::Array>();
- return val;
+ return std::vector<CFX_WideString>();
+
+ std::vector<CFX_WideString> result;
+ for (uint32_t i = 0; i < val->Length(); ++i) {
+ result.push_back(FXJS_ToString(
+ pIsolate, val->Get(pIsolate->GetCurrentContext(), i).ToLocalChecked()));
+ }
+
+ return result;
}
void FXJS_PutObjectString(v8::Isolate* pIsolate,
« no previous file with comments | « fpdfsdk/javascript/global.cpp ('k') | fxjs/fxjs_v8_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698