summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/global.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-24 13:56:29 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-24 18:08:51 +0000
commit1b2a18ec4ed99fc2ac56b5fde230bc2b348d9725 (patch)
treea529fbb941a15197b050a0aa88e7a9403ff56152 /fpdfsdk/javascript/global.cpp
parent65f3162c91607071322967ea064a4a11e3904722 (diff)
downloadpdfium-1b2a18ec4ed99fc2ac56b5fde230bc2b348d9725.tar.xz
Remove the CJS_Value To* methods.
This CL removes all of the To* methods on the CJS classes except for ToV8Value. Change-Id: If01263c8cfa557ef7b00f573ddbf68b591d5ae9a Reviewed-on: https://pdfium-review.googlesource.com/16614 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/global.cpp')
-rw-r--r--fpdfsdk/javascript/global.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp
index a226bb25cc..f095440413 100644
--- a/fpdfsdk/javascript/global.cpp
+++ b/fpdfsdk/javascript/global.cpp
@@ -328,19 +328,20 @@ bool JSGlobalAlternate::SetProperty(CJS_Runtime* pRuntime,
switch (vp.GetType()) {
case CJS_Value::VT_number:
return SetGlobalVariables(sPropName, JS_GlobalDataType::NUMBER,
- vp.ToDouble(pRuntime), false, "",
+ pRuntime->ToDouble(vp.ToV8Value()), false, "",
v8::Local<v8::Object>(), false);
case CJS_Value::VT_boolean:
return SetGlobalVariables(sPropName, JS_GlobalDataType::BOOLEAN, 0,
- vp.ToBool(pRuntime), "",
+ pRuntime->ToBoolean(vp.ToV8Value()), "",
v8::Local<v8::Object>(), false);
case CJS_Value::VT_string:
- return SetGlobalVariables(sPropName, JS_GlobalDataType::STRING, 0, false,
- vp.ToByteString(pRuntime),
- v8::Local<v8::Object>(), false);
+ return SetGlobalVariables(
+ sPropName, JS_GlobalDataType::STRING, 0, false,
+ ByteString::FromUnicode(pRuntime->ToWideString(vp.ToV8Value())),
+ v8::Local<v8::Object>(), false);
case CJS_Value::VT_object:
return SetGlobalVariables(sPropName, JS_GlobalDataType::OBJECT, 0, false,
- "", vp.ToV8Object(pRuntime), false);
+ "", pRuntime->ToObject(vp.ToV8Value()), false);
case CJS_Value::VT_null:
return SetGlobalVariables(sPropName, JS_GlobalDataType::NULLOBJ, 0, false,
"", v8::Local<v8::Object>(), false);
@@ -361,12 +362,13 @@ bool JSGlobalAlternate::setPersistent(CJS_Runtime* pRuntime,
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- auto it = m_MapGlobal.find(params[0].ToByteString(pRuntime));
+ auto it = m_MapGlobal.find(
+ ByteString::FromUnicode(pRuntime->ToWideString(params[0].ToV8Value())));
if (it == m_MapGlobal.end() || it->second->bDeleted) {
sError = JSGetStringFromID(IDS_STRING_JSNOGLOBAL);
return false;
}
- it->second->bPersistent = params[1].ToBool(pRuntime);
+ it->second->bPersistent = pRuntime->ToBoolean(params[1].ToV8Value());
return true;
}
@@ -485,7 +487,7 @@ void JSGlobalAlternate::ObjectToArray(CJS_Runtime* pRuntime,
array.Add(pObjElement);
} break;
case CJS_Value::VT_string: {
- ByteString sValue = CJS_Value(v).ToByteString(pRuntime);
+ ByteString sValue = ByteString::FromUnicode(pRuntime->ToWideString(v));
CJS_KeyValue* pObjElement = new CJS_KeyValue;
pObjElement->nType = JS_GlobalDataType::STRING;
pObjElement->sKey = sKey;