From d94df885e9e680e7dc8a5ac116c8d4ab5e4790cd Mon Sep 17 00:00:00 2001 From: Jochen Eisinger Date: Sun, 17 May 2015 13:07:02 +0200 Subject: Replace deprecated with non-deprecated V8 APIs In most cases, we just CHECK() that no exception was thrown. Previously, we'd just crash. Ideally, this should all be fixed and the system should cope with those exceptions, but that's beyond this CL. R=tsepez@chromium.org BUG= Review URL: https://codereview.chromium.org/1126203010 --- fpdfsdk/src/javascript/JS_Value.cpp | 39 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'fpdfsdk/src/javascript/JS_Value.cpp') diff --git a/fpdfsdk/src/javascript/JS_Value.cpp b/fpdfsdk/src/javascript/JS_Value.cpp index 1b36f314ca..d3de6d1719 100644 --- a/fpdfsdk/src/javascript/JS_Value.cpp +++ b/fpdfsdk/src/javascript/JS_Value.cpp @@ -98,17 +98,17 @@ void CJS_Value::Detach() int CJS_Value::ToInt() const { - return JS_ToInt32(m_pValue); + return JS_ToInt32(m_isolate, m_pValue); } bool CJS_Value::ToBool() const { - return JS_ToBoolean(m_pValue); + return JS_ToBoolean(m_isolate, m_pValue); } double CJS_Value::ToDouble() const { - return JS_ToNumber(m_pValue); + return JS_ToNumber(m_isolate, m_pValue); } float CJS_Value::ToFloat() const @@ -118,18 +118,18 @@ float CJS_Value::ToFloat() const CJS_Object* CJS_Value::ToCJSObject() const { - v8::Handle pObj = JS_ToObject(m_pValue); + v8::Handle pObj = JS_ToObject(m_isolate, m_pValue); return (CJS_Object*)JS_GetPrivate(m_isolate, pObj); } v8::Handle CJS_Value::ToV8Object() const { - return JS_ToObject(m_pValue); + return JS_ToObject(m_isolate, m_pValue); } CFX_WideString CJS_Value::ToCFXWideString() const { - return JS_ToString(m_pValue); + return JS_ToString(m_isolate, m_pValue); } CFX_ByteString CJS_Value::ToCFXByteString() const @@ -145,7 +145,7 @@ v8::Handle CJS_Value::ToV8Value() const v8::HandleCJS_Value::ToV8Array() const { if (IsArrayObject()) - return v8::Handle::Cast(JS_ToObject(m_pValue)); + return v8::Handle::Cast(JS_ToObject(m_isolate, m_pValue)); return v8::Handle(); } @@ -238,6 +238,7 @@ void CJS_Value::operator = (CJS_Value value) m_pValue = value.ToV8Value(); m_eType = value.m_eType; + m_isolate = value.m_isolate; } /* ---------------------------------------------------------------------------------------- */ @@ -272,7 +273,7 @@ FX_BOOL CJS_Value::ConvertToArray(CJS_Array &array) const { if (IsArrayObject()) { - array.Attach(JS_ToArray(m_pValue)); + array.Attach(JS_ToArray(m_isolate, m_pValue)); return TRUE; } @@ -488,7 +489,7 @@ void CJS_Array::GetElement(unsigned index,CJS_Value &value) { if (m_pArray.IsEmpty()) return; - v8::Handle p = JS_GetArrayElemnet(m_pArray,index); + v8::Handle p = JS_GetArrayElement(m_isolate, m_pArray,index); value.Attach(p,VT_object); } @@ -497,7 +498,7 @@ void CJS_Array::SetElement(unsigned index,CJS_Value value) if (m_pArray.IsEmpty()) m_pArray = JS_NewArray(m_isolate); - JS_PutArrayElement(m_pArray, index, value.ToV8Value(), value.GetType()); + JS_PutArrayElement(m_isolate, m_pArray, index, value.ToV8Value(), value.GetType()); } int CJS_Array::GetLength() @@ -545,7 +546,7 @@ CJS_Date::~CJS_Date() FX_BOOL CJS_Date::IsValidDate() { if(m_pDate.IsEmpty()) return FALSE; - return !JS_PortIsNan(JS_ToNumber(m_pDate)); + return !JS_PortIsNan(JS_ToNumber(m_isolate, m_pDate)); } void CJS_Date::Attach(v8::Handle pDate) @@ -556,7 +557,7 @@ void CJS_Date::Attach(v8::Handle pDate) int CJS_Date::GetYear() { if (IsValidDate()) - return JS_GetYearFromTime(JS_LocalTime(JS_ToNumber(m_pDate))); + return JS_GetYearFromTime(JS_LocalTime(JS_ToNumber(m_isolate, m_pDate))); return 0; } @@ -570,7 +571,7 @@ void CJS_Date::SetYear(int iYear) int CJS_Date::GetMonth() { if (IsValidDate()) - return JS_GetMonthFromTime(JS_LocalTime(JS_ToNumber(m_pDate))); + return JS_GetMonthFromTime(JS_LocalTime(JS_ToNumber(m_isolate, m_pDate))); return 0; } @@ -586,7 +587,7 @@ void CJS_Date::SetMonth(int iMonth) int CJS_Date::GetDay() { if (IsValidDate()) - return JS_GetDayFromTime(JS_LocalTime(JS_ToNumber(m_pDate))); + return JS_GetDayFromTime(JS_LocalTime(JS_ToNumber(m_isolate, m_pDate))); return 0; } @@ -602,7 +603,7 @@ void CJS_Date::SetDay(int iDay) int CJS_Date::GetHours() { if (IsValidDate()) - return JS_GetHourFromTime(JS_LocalTime(JS_ToNumber(m_pDate))); + return JS_GetHourFromTime(JS_LocalTime(JS_ToNumber(m_isolate, m_pDate))); return 0; } @@ -616,7 +617,7 @@ void CJS_Date::SetHours(int iHours) int CJS_Date::GetMinutes() { if (IsValidDate()) - return JS_GetMinFromTime(JS_LocalTime(JS_ToNumber(m_pDate))); + return JS_GetMinFromTime(JS_LocalTime(JS_ToNumber(m_isolate, m_pDate))); return 0; } @@ -630,7 +631,7 @@ void CJS_Date::SetMinutes(int minutes) int CJS_Date::GetSeconds() { if (IsValidDate()) - return JS_GetSecFromTime(JS_LocalTime(JS_ToNumber(m_pDate))); + return JS_GetSecFromTime(JS_LocalTime(JS_ToNumber(m_isolate, m_pDate))); return 0; } @@ -650,12 +651,12 @@ CJS_Date::operator double() const { if(m_pDate.IsEmpty()) return 0.0; - return JS_ToNumber(m_pDate); + return JS_ToNumber(m_isolate, m_pDate); } CFX_WideString CJS_Date::ToString() const { if(m_pDate.IsEmpty()) return L""; - return JS_ToString(m_pDate); + return JS_ToString(m_isolate, m_pDate); } -- cgit v1.2.3