diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-10-24 15:29:22 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-10-24 21:00:44 +0000 |
commit | e85107bc8ab5bbd5b2d3f97fd6071d7ce4a78bcc (patch) | |
tree | 77bc28ff0366d3ff873c9d62db0e262421aedc9a /fpdfsdk/javascript/JS_Value.cpp | |
parent | 037eae6e99ef16a42cb74a72b0b52d515a099b3a (diff) | |
download | pdfium-e85107bc8ab5bbd5b2d3f97fd6071d7ce4a78bcc.tar.xz |
Move MaybeCoerceToNumber to CJS_Runtime
This CL moves MaybeCoerceToNumber from CJS_Value to CJS_Runtime.
Change-Id: I22bb605045daa63f405ef256e4b8a5c7ffb78425
Reviewed-on: https://pdfium-review.googlesource.com/16617
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/JS_Value.cpp')
-rw-r--r-- | fpdfsdk/javascript/JS_Value.cpp | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp index 9275de3d52..ddea0a4caa 100644 --- a/fpdfsdk/javascript/JS_Value.cpp +++ b/fpdfsdk/javascript/JS_Value.cpp @@ -194,28 +194,6 @@ v8::Local<v8::Value> CJS_Value::ToV8Value() const { return m_pValue; } -void CJS_Value::MaybeCoerceToNumber(CJS_Runtime* pRuntime) { - bool bAllowNaN = false; - if (ToV8Value()->IsString()) { - ByteString bstr = - ByteString::FromUnicode(pRuntime->ToWideString(ToV8Value())); - if (bstr.GetLength() == 0) - return; - if (bstr == "NaN") - bAllowNaN = true; - } - v8::Isolate* pIsolate = pRuntime->GetIsolate(); - v8::TryCatch try_catch(pIsolate); - v8::MaybeLocal<v8::Number> maybeNum = - m_pValue->ToNumber(pIsolate->GetCurrentContext()); - if (maybeNum.IsEmpty()) - return; - v8::Local<v8::Number> num = maybeNum.ToLocalChecked(); - if (std::isnan(num->Value()) && !bAllowNaN) - return; - m_pValue = num; -} - CJS_Array::CJS_Array() {} CJS_Array::CJS_Array(v8::Local<v8::Array> pArray) : m_pArray(pArray) {} |