summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/javascript')
-rw-r--r--fpdfsdk/src/javascript/JS_Value.cpp39
-rw-r--r--fpdfsdk/src/javascript/global.cpp13
2 files changed, 26 insertions, 26 deletions
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<v8::Object> pObj = JS_ToObject(m_pValue);
+ v8::Handle<v8::Object> pObj = JS_ToObject(m_isolate, m_pValue);
return (CJS_Object*)JS_GetPrivate(m_isolate, pObj);
}
v8::Handle<v8::Object> 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<v8::Value> CJS_Value::ToV8Value() const
v8::Handle<v8::Array>CJS_Value::ToV8Array() const
{
if (IsArrayObject())
- return v8::Handle<v8::Array>::Cast(JS_ToObject(m_pValue));
+ return v8::Handle<v8::Array>::Cast(JS_ToObject(m_isolate, m_pValue));
return v8::Handle<v8::Array>();
}
@@ -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<v8::Value> p = JS_GetArrayElemnet(m_pArray,index);
+ v8::Handle<v8::Value> 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<v8::Value> pDate)
@@ -556,7 +557,7 @@ void CJS_Date::Attach(v8::Handle<v8::Value> 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);
}
diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp
index 418508f89e..99db9e7a71 100644
--- a/fpdfsdk/src/javascript/global.cpp
+++ b/fpdfsdk/src/javascript/global.cpp
@@ -387,16 +387,15 @@ void global_alternate::CommitGlobalPersisitentVariables()
void global_alternate::ObjectToArray(v8::Handle<v8::Object> pObj, CJS_GlobalVariableArray& array)
{
- v8::Handle<v8::Array> pKeyList = JS_GetObjectElementNames(pObj);
- int nObjElements = pKeyList->Length();
-
v8::Local<v8::Context> context = pObj->CreationContext();
v8::Isolate* isolate = context->GetIsolate();
+ v8::Handle<v8::Array> pKeyList = JS_GetObjectElementNames(isolate, pObj);
+ int nObjElements = pKeyList->Length();
for (int i=0; i<nObjElements; i++)
{
- CFX_WideString ws = JS_ToString(JS_GetArrayElemnet(pKeyList, i));
+ CFX_WideString ws = JS_ToString(isolate, JS_GetArrayElement(isolate, pKeyList, i));
CFX_ByteString sKey = ws.UTF8Encode();
v8::Handle<v8::Value> v = JS_GetObjectElement(isolate, pObj, ws.c_str());
@@ -408,7 +407,7 @@ void global_alternate::ObjectToArray(v8::Handle<v8::Object> pObj, CJS_GlobalVari
CJS_KeyValue* pObjElement = new CJS_KeyValue;
pObjElement->nType = JS_GLOBALDATA_TYPE_NUMBER;
pObjElement->sKey = sKey;
- pObjElement->dData = JS_ToNumber(v);
+ pObjElement->dData = JS_ToNumber(isolate, v);
array.Add(pObjElement);
}
break;
@@ -417,7 +416,7 @@ void global_alternate::ObjectToArray(v8::Handle<v8::Object> pObj, CJS_GlobalVari
CJS_KeyValue* pObjElement = new CJS_KeyValue;
pObjElement->nType = JS_GLOBALDATA_TYPE_BOOLEAN;
pObjElement->sKey = sKey;
- pObjElement->dData = JS_ToBoolean(v);
+ pObjElement->dData = JS_ToBoolean(isolate, v);
array.Add(pObjElement);
}
break;
@@ -436,7 +435,7 @@ void global_alternate::ObjectToArray(v8::Handle<v8::Object> pObj, CJS_GlobalVari
CJS_KeyValue* pObjElement = new CJS_KeyValue;
pObjElement->nType = JS_GLOBALDATA_TYPE_OBJECT;
pObjElement->sKey = sKey;
- ObjectToArray(JS_ToObject(v), pObjElement->objData);
+ ObjectToArray(JS_ToObject(isolate, v), pObjElement->objData);
array.Add(pObjElement);
}
break;