summaryrefslogtreecommitdiff
path: root/fxjs
diff options
context:
space:
mode:
authorDan Elphick <delphick@chromium.org>2018-08-21 13:48:43 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-21 13:48:43 +0000
commita16d9c72d60fcdf07cf5a40bfa325e7c8eaea02d (patch)
treec760a0ee7cfcbdd23aced90552d0ef4ad5903bec /fxjs
parentb2b00c31f48c86a1bde7f3e6c07752d1c9195cea (diff)
downloadpdfium-a16d9c72d60fcdf07cf5a40bfa325e7c8eaea02d.tar.xz
Fix usage of deprecated V8 Value::*Value methods
These parameterless methods are deprecated since the Isolate is inferred from the memory address of the object being converted to a string which will soon not be reliable. As such these method will be removed in the very near future. Bug: v8:7786 Change-Id: Idbcd56a633c3b0b06ba8e60909fc0fb9c80f3410 Reviewed-on: https://pdfium-review.googlesource.com/40310 Commit-Queue: Jochen Eisinger <jochen@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Diffstat (limited to 'fxjs')
-rw-r--r--fxjs/cfxjse_arguments.cpp19
-rw-r--r--fxjs/cfxjse_value.cpp13
2 files changed, 22 insertions, 10 deletions
diff --git a/fxjs/cfxjse_arguments.cpp b/fxjs/cfxjse_arguments.cpp
index b8670ad981..0b0dc39953 100644
--- a/fxjs/cfxjse_arguments.cpp
+++ b/fxjs/cfxjse_arguments.cpp
@@ -28,20 +28,29 @@ std::unique_ptr<CFXJSE_Value> CFXJSE_Arguments::GetValue(int32_t index) const {
}
bool CFXJSE_Arguments::GetBoolean(int32_t index) const {
- return (*m_pInfo)[index]->BooleanValue();
+ return (*m_pInfo)[index]
+ ->BooleanValue(m_pInfo->GetIsolate()->GetCurrentContext())
+ .FromMaybe(false);
}
int32_t CFXJSE_Arguments::GetInt32(int32_t index) const {
- return static_cast<int32_t>((*m_pInfo)[index]->NumberValue());
+ return static_cast<int32_t>(
+ (*m_pInfo)[index]
+ ->NumberValue(m_pInfo->GetIsolate()->GetCurrentContext())
+ .FromMaybe(0.0));
}
float CFXJSE_Arguments::GetFloat(int32_t index) const {
- return static_cast<float>((*m_pInfo)[index]->NumberValue());
+ return static_cast<float>(
+ (*m_pInfo)[index]
+ ->NumberValue(m_pInfo->GetIsolate()->GetCurrentContext())
+ .FromMaybe(0.0));
}
ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const {
- v8::Local<v8::String> hString = (*m_pInfo)[index]->ToString();
- v8::String::Utf8Value szStringVal(m_pInfo->GetIsolate(), hString);
+ v8::Isolate* isolate = m_pInfo->GetIsolate();
+ v8::Local<v8::String> hString = (*m_pInfo)[index]->ToString(isolate);
+ v8::String::Utf8Value szStringVal(isolate, hString);
return ByteString(*szStringVal);
}
diff --git a/fxjs/cfxjse_value.cpp b/fxjs/cfxjse_value.cpp
index 90f553b169..6afba97c2d 100644
--- a/fxjs/cfxjse_value.cpp
+++ b/fxjs/cfxjse_value.cpp
@@ -370,7 +370,8 @@ bool CFXJSE_Value::ToBoolean() const {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(GetIsolate());
v8::Local<v8::Value> hValue =
v8::Local<v8::Value>::New(GetIsolate(), m_hValue);
- return static_cast<bool>(hValue->BooleanValue());
+ return hValue->BooleanValue(GetIsolate()->GetCurrentContext())
+ .FromMaybe(false);
}
float CFXJSE_Value::ToFloat() const {
@@ -378,7 +379,8 @@ float CFXJSE_Value::ToFloat() const {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(GetIsolate());
v8::Local<v8::Value> hValue =
v8::Local<v8::Value>::New(GetIsolate(), m_hValue);
- return static_cast<float>(hValue->NumberValue());
+ return static_cast<float>(
+ hValue->NumberValue(GetIsolate()->GetCurrentContext()).FromMaybe(0.0));
}
double CFXJSE_Value::ToDouble() const {
@@ -386,7 +388,7 @@ double CFXJSE_Value::ToDouble() const {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(GetIsolate());
v8::Local<v8::Value> hValue =
v8::Local<v8::Value>::New(GetIsolate(), m_hValue);
- return static_cast<double>(hValue->NumberValue());
+ return hValue->NumberValue(GetIsolate()->GetCurrentContext()).FromMaybe(0.0);
}
int32_t CFXJSE_Value::ToInteger() const {
@@ -394,7 +396,8 @@ int32_t CFXJSE_Value::ToInteger() const {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(GetIsolate());
v8::Local<v8::Value> hValue =
v8::Local<v8::Value>::New(GetIsolate(), m_hValue);
- return static_cast<int32_t>(hValue->NumberValue());
+ return static_cast<int32_t>(
+ hValue->NumberValue(GetIsolate()->GetCurrentContext()).FromMaybe(0.0));
}
ByteString CFXJSE_Value::ToString() const {
@@ -402,7 +405,7 @@ ByteString CFXJSE_Value::ToString() const {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(GetIsolate());
v8::Local<v8::Value> hValue =
v8::Local<v8::Value>::New(GetIsolate(), m_hValue);
- v8::Local<v8::String> hString = hValue->ToString();
+ v8::Local<v8::String> hString = hValue->ToString(GetIsolate());
v8::String::Utf8Value hStringVal(GetIsolate(), hString);
return ByteString(*hStringVal);
}