summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-08-05 09:32:50 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-05 09:32:50 -0700
commit135b99861d0d898850754a845f607ec48f0bcccc (patch)
tree3e045fd8e3ed049e2a5a24aa727cdf0a07c05efe /fpdfsdk/javascript
parentb20ab6c7acb3be1393461eb650ca8fa4660c937e (diff)
downloadpdfium-135b99861d0d898850754a845f607ec48f0bcccc.tar.xz
Return v8::Date specialization not v8::Value where possiblechromium/2824chromium/2823chromium/2822chromium/2821
Also get rid of FXJS_ValueCopy() while we're at it. BUG=pdfium:556 Review-Url: https://codereview.chromium.org/2215093002
Diffstat (limited to 'fpdfsdk/javascript')
-rw-r--r--fpdfsdk/javascript/JS_Value.cpp17
-rw-r--r--fpdfsdk/javascript/JS_Value.h4
2 files changed, 11 insertions, 10 deletions
diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp
index fa1f7d95c5..9d65c79a1b 100644
--- a/fpdfsdk/javascript/JS_Value.cpp
+++ b/fpdfsdk/javascript/JS_Value.cpp
@@ -252,7 +252,8 @@ FX_BOOL CJS_Value::ConvertToArray(CJS_Array& array) const {
FX_BOOL CJS_Value::ConvertToDate(CJS_Date& date) const {
if (IsDateObject()) {
- date.Attach(m_pValue);
+ v8::Local<v8::Value> mutable_value = m_pValue;
+ date.Attach(mutable_value.As<v8::Date>());
return TRUE;
}
@@ -437,7 +438,7 @@ bool CJS_Date::IsValidDate() const {
!JS_PortIsNan(FXJS_ToNumber(m_pJSRuntime->GetIsolate(), m_pDate));
}
-void CJS_Date::Attach(v8::Local<v8::Value> pDate) {
+void CJS_Date::Attach(v8::Local<v8::Date> pDate) {
m_pDate = pDate;
}
@@ -452,7 +453,7 @@ int CJS_Date::GetYear() const {
void CJS_Date::SetYear(int iYear) {
double date = MakeDate(iYear, GetMonth(), GetDay(), GetHours(), GetMinutes(),
GetSeconds(), 0);
- FXJS_ValueCopy(m_pDate, FXJS_NewDate(m_pJSRuntime->GetIsolate(), date));
+ m_pDate = FXJS_NewDate(m_pJSRuntime->GetIsolate(), date);
}
int CJS_Date::GetMonth() const {
@@ -466,7 +467,7 @@ int CJS_Date::GetMonth() const {
void CJS_Date::SetMonth(int iMonth) {
double date = MakeDate(GetYear(), iMonth, GetDay(), GetHours(), GetMinutes(),
GetSeconds(), 0);
- FXJS_ValueCopy(m_pDate, FXJS_NewDate(m_pJSRuntime->GetIsolate(), date));
+ m_pDate = FXJS_NewDate(m_pJSRuntime->GetIsolate(), date);
}
int CJS_Date::GetDay() const {
@@ -480,7 +481,7 @@ int CJS_Date::GetDay() const {
void CJS_Date::SetDay(int iDay) {
double date = MakeDate(GetYear(), GetMonth(), iDay, GetHours(), GetMinutes(),
GetSeconds(), 0);
- FXJS_ValueCopy(m_pDate, FXJS_NewDate(m_pJSRuntime->GetIsolate(), date));
+ m_pDate = FXJS_NewDate(m_pJSRuntime->GetIsolate(), date);
}
int CJS_Date::GetHours() const {
@@ -494,7 +495,7 @@ int CJS_Date::GetHours() const {
void CJS_Date::SetHours(int iHours) {
double date = MakeDate(GetYear(), GetMonth(), GetDay(), iHours, GetMinutes(),
GetSeconds(), 0);
- FXJS_ValueCopy(m_pDate, FXJS_NewDate(m_pJSRuntime->GetIsolate(), date));
+ m_pDate = FXJS_NewDate(m_pJSRuntime->GetIsolate(), date);
}
int CJS_Date::GetMinutes() const {
@@ -508,7 +509,7 @@ int CJS_Date::GetMinutes() const {
void CJS_Date::SetMinutes(int minutes) {
double date = MakeDate(GetYear(), GetMonth(), GetDay(), GetHours(), minutes,
GetSeconds(), 0);
- FXJS_ValueCopy(m_pDate, FXJS_NewDate(m_pJSRuntime->GetIsolate(), date));
+ m_pDate = FXJS_NewDate(m_pJSRuntime->GetIsolate(), date);
}
int CJS_Date::GetSeconds() const {
@@ -522,7 +523,7 @@ int CJS_Date::GetSeconds() const {
void CJS_Date::SetSeconds(int seconds) {
double date = MakeDate(GetYear(), GetMonth(), GetDay(), GetHours(),
GetMinutes(), seconds, 0);
- FXJS_ValueCopy(m_pDate, FXJS_NewDate(m_pJSRuntime->GetIsolate(), date));
+ m_pDate = FXJS_NewDate(m_pJSRuntime->GetIsolate(), date);
}
double CJS_Date::ToDouble() const {
diff --git a/fpdfsdk/javascript/JS_Value.h b/fpdfsdk/javascript/JS_Value.h
index 5943aaf888..01b4e5ba45 100644
--- a/fpdfsdk/javascript/JS_Value.h
+++ b/fpdfsdk/javascript/JS_Value.h
@@ -159,7 +159,7 @@ class CJS_Date {
int sec);
virtual ~CJS_Date();
- void Attach(v8::Local<v8::Value> pDate);
+ void Attach(v8::Local<v8::Date> pDate);
bool IsValidDate() const;
int GetYear() const;
@@ -186,7 +186,7 @@ class CJS_Date {
CFX_WideString ToString() const;
protected:
- v8::Local<v8::Value> m_pDate;
+ v8::Local<v8::Date> m_pDate;
CJS_Runtime* const m_pJSRuntime;
};