summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/global.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-24 09:36:16 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-24 17:17:03 +0000
commite49749265c4e503c37a316e4ca6eeff430d13b87 (patch)
treed75c0b641618e66477b2e992ae146f30a3e2dd9f /fpdfsdk/javascript/global.cpp
parent826480cf599f61fe0366ab2bd5803dd53c9d0562 (diff)
downloadpdfium-e49749265c4e503c37a316e4ca6eeff430d13b87.tar.xz
Remove most CJS_Value Set methods
This CL removes all of the Set(*) methods from CJS_Value except for Set(v8::Local<v8::Value>). All uses of Set are changed to convert to a v8::Value before setting. Change-Id: I6e4d2cebec42fce5c039dc0a3abe46086cfdd34f Reviewed-on: https://pdfium-review.googlesource.com/16610 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.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp
index ee76469150..a226bb25cc 100644
--- a/fpdfsdk/javascript/global.cpp
+++ b/fpdfsdk/javascript/global.cpp
@@ -104,12 +104,12 @@ void JSSpecialPropGet(const char* class_name,
WideString propname =
WideString::FromUTF8(ByteStringView(*utf8_value, utf8_value.length()));
- CJS_Value value(pRuntime);
+ CJS_Value value;
if (!pObj->GetProperty(pRuntime, propname.c_str(), &value)) {
pRuntime->Error(JSFormatErrorString(class_name, "GetProperty", L""));
return;
}
- info.GetReturnValue().Set(value.ToV8Value(pRuntime));
+ info.GetReturnValue().Set(value.ToV8Value());
}
template <class Alt>
@@ -131,7 +131,7 @@ void JSSpecialPropPut(const char* class_name,
v8::String::Utf8Value utf8_value(property);
WideString propname =
WideString::FromUTF8(ByteStringView(*utf8_value, utf8_value.length()));
- CJS_Value prop_value(pRuntime, value);
+ CJS_Value prop_value(value);
if (!pObj->SetProperty(pRuntime, propname.c_str(), prop_value)) {
pRuntime->Error(JSFormatErrorString(class_name, "PutProperty", L""));
}
@@ -287,33 +287,33 @@ bool JSGlobalAlternate::GetProperty(CJS_Runtime* pRuntime,
CJS_Value* vp) {
auto it = m_MapGlobal.find(ByteString::FromUnicode(propname));
if (it == m_MapGlobal.end()) {
- vp->SetNull(pRuntime);
+ vp->Set(pRuntime->NewNull());
return true;
}
JSGlobalData* pData = it->second.get();
if (pData->bDeleted) {
- vp->SetNull(pRuntime);
+ vp->Set(pRuntime->NewNull());
return true;
}
switch (pData->nType) {
case JS_GlobalDataType::NUMBER:
- vp->Set(pRuntime, pData->dData);
+ vp->Set(pRuntime->NewNumber(pData->dData));
return true;
case JS_GlobalDataType::BOOLEAN:
- vp->Set(pRuntime, pData->bData);
+ vp->Set(pRuntime->NewBoolean(pData->bData));
return true;
case JS_GlobalDataType::STRING:
- vp->Set(pRuntime, pData->sData);
+ vp->Set(pRuntime->NewString(
+ WideString::FromLocal(pData->sData.c_str()).c_str()));
return true;
case JS_GlobalDataType::OBJECT: {
- vp->Set(pRuntime,
- v8::Local<v8::Object>::New(pRuntime->GetIsolate(), pData->pData));
+ vp->Set(v8::Local<v8::Object>::New(pRuntime->GetIsolate(), pData->pData));
return true;
}
case JS_GlobalDataType::NULLOBJ:
- vp->SetNull(pRuntime);
+ vp->Set(pRuntime->NewNull());
return true;
default:
break;
@@ -485,7 +485,7 @@ void JSGlobalAlternate::ObjectToArray(CJS_Runtime* pRuntime,
array.Add(pObjElement);
} break;
case CJS_Value::VT_string: {
- ByteString sValue = CJS_Value(pRuntime, v).ToByteString(pRuntime);
+ ByteString sValue = CJS_Value(v).ToByteString(pRuntime);
CJS_KeyValue* pObjElement = new CJS_KeyValue;
pObjElement->nType = JS_GlobalDataType::STRING;
pObjElement->sKey = sKey;