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>
diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp
index 35a5b1c..f535f69 100644
--- a/fpdfsdk/javascript/JS_Value.cpp
+++ b/fpdfsdk/javascript/JS_Value.cpp
@@ -196,7 +196,7 @@
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 @@
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 @@
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;
}