diff options
Diffstat (limited to 'fpdfsdk/javascript/JS_Value.cpp')
-rw-r--r-- | fpdfsdk/javascript/JS_Value.cpp | 25 |
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; } |