summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/JS_Value.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-24 15:15:27 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-24 19:28:02 +0000
commit3cac3602f24f56413cc2ca312731675fc080b7ef (patch)
treecc5741593ce51f41276be2f8a1826bf452a7841c /fpdfsdk/javascript/JS_Value.cpp
parent1b2a18ec4ed99fc2ac56b5fde230bc2b348d9725 (diff)
downloadpdfium-3cac3602f24f56413cc2ca312731675fc080b7ef.tar.xz
Remove GetType from CJS_Value
This CL removes the GetType method from CJS_Value and, instead, retrieves the value from the v8 object directly. Change-Id: Ia8390f3ead163c09a39cae493e75fccdd41a0961 Reviewed-on: https://pdfium-review.googlesource.com/16615 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/JS_Value.cpp')
-rw-r--r--fpdfsdk/javascript/JS_Value.cpp25
1 files changed, 2 insertions, 23 deletions
diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp
index 35a5b1c682..f535f69f94 100644
--- a/fpdfsdk/javascript/JS_Value.cpp
+++ b/fpdfsdk/javascript/JS_Value.cpp
@@ -196,7 +196,7 @@ v8::Local<v8::Value> CJS_Value::ToV8Value() const {
void CJS_Value::MaybeCoerceToNumber(CJS_Runtime* pRuntime) {
bool bAllowNaN = false;
- if (GetType() == VT_string) {
+ if (ToV8Value()->IsString()) {
ByteString bstr =
ByteString::FromUnicode(pRuntime->ToWideString(ToV8Value()));
if (bstr.GetLength() == 0)
@@ -216,27 +216,6 @@ void CJS_Value::MaybeCoerceToNumber(CJS_Runtime* pRuntime) {
m_pValue = num;
}
-// static
-CJS_Value::Type CJS_Value::GetValueType(v8::Local<v8::Value> value) {
- if (value.IsEmpty())
- return VT_unknown;
- if (value->IsString())
- return VT_string;
- if (value->IsNumber())
- return VT_number;
- if (value->IsBoolean())
- return VT_boolean;
- if (value->IsDate())
- return VT_date;
- if (value->IsObject())
- return VT_object;
- if (value->IsNull())
- return VT_null;
- if (value->IsUndefined())
- return VT_undefined;
- return VT_unknown;
-}
-
bool CJS_Value::IsArrayObject() const {
return !m_pValue.IsEmpty() && m_pValue->IsArray();
}
@@ -456,7 +435,7 @@ std::vector<CJS_Value> ExpandKeywordParams(
for (size_t i = 0; i < size; ++i)
result[i] = originals[i];
- if (originals.size() != 1 || originals[0].GetType() != CJS_Value::VT_object ||
+ if (originals.size() != 1 || !originals[0].ToV8Value()->IsObject() ||
originals[0].IsArrayObject()) {
return result;
}