summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/global.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/javascript/global.cpp')
-rw-r--r--fpdfsdk/src/javascript/global.cpp45
1 files changed, 22 insertions, 23 deletions
diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp
index 45b9248155..daf5a85ffe 100644
--- a/fpdfsdk/src/javascript/global.cpp
+++ b/fpdfsdk/src/javascript/global.cpp
@@ -169,19 +169,19 @@ FX_BOOL global_alternate::DoProperty(IFXJS_Context* cc, FX_LPCWSTR propname, CJS
{
double dData;
vp >> dData;
- return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_NUMBER, dData, false, "", v8::Handle<v8::Object>(), FALSE);
+ return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_NUMBER, dData, false, "", v8::Local<v8::Object>(), FALSE);
}
case VT_boolean:
{
bool bData;
vp >> bData;
- return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_BOOLEAN, 0, bData, "", v8::Handle<v8::Object>(), FALSE);
+ return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_BOOLEAN, 0, bData, "", v8::Local<v8::Object>(), FALSE);
}
case VT_string:
{
CFX_ByteString sData;
vp >> sData;
- return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_STRING, 0, false, sData, v8::Handle<v8::Object>(), FALSE);
+ return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_STRING, 0, false, sData, v8::Local<v8::Object>(), FALSE);
}
case VT_object:
{
@@ -191,7 +191,7 @@ FX_BOOL global_alternate::DoProperty(IFXJS_Context* cc, FX_LPCWSTR propname, CJS
}
case VT_null:
{
- return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_NULL, 0, false, "", v8::Handle<v8::Object>(), FALSE);
+ return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_NULL, 0, false, "", v8::Local<v8::Object>(), FALSE);
}
case VT_undefined:
{
@@ -226,7 +226,7 @@ FX_BOOL global_alternate::DoProperty(IFXJS_Context* cc, FX_LPCWSTR propname, CJS
break;
case JS_GLOBALDATA_TYPE_OBJECT:
{
- v8::Handle<v8::Object> obj = v8::Local<v8::Object>::New(vp.GetIsolate(),pData->pData);
+ v8::Local<v8::Object> obj = v8::Local<v8::Object>::New(vp.GetIsolate(),pData->pData);
vp << obj;
break;
}
@@ -296,17 +296,17 @@ void global_alternate::UpdateGlobalPersistentVariables()
switch (pData->data.nType)
{
case JS_GLOBALDATA_TYPE_NUMBER:
- this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NUMBER, pData->data.dData, false, "", v8::Handle<v8::Object>(), pData->bPersistent == 1);
+ this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NUMBER, pData->data.dData, false, "", v8::Local<v8::Object>(), pData->bPersistent == 1);
JS_PutObjectNumber(NULL,(JSFXObject)(*m_pJSObject),
pData->data.sKey.UTF8Decode().c_str(), pData->data.dData);
break;
case JS_GLOBALDATA_TYPE_BOOLEAN:
- this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_BOOLEAN, 0, (bool)(pData->data.bData == 1), "", v8::Handle<v8::Object>(), pData->bPersistent == 1);
+ this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_BOOLEAN, 0, (bool)(pData->data.bData == 1), "", v8::Local<v8::Object>(), pData->bPersistent == 1);
JS_PutObjectBoolean(NULL,(JSFXObject)(*m_pJSObject),
pData->data.sKey.UTF8Decode().c_str(), (bool)(pData->data.bData == 1));
break;
case JS_GLOBALDATA_TYPE_STRING:
- this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_STRING, 0, false, pData->data.sData, v8::Handle<v8::Object>(), pData->bPersistent == 1);
+ this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_STRING, 0, false, pData->data.sData, v8::Local<v8::Object>(), pData->bPersistent == 1);
JS_PutObjectString(NULL, (JSFXObject)(*m_pJSObject),
pData->data.sKey.UTF8Decode().c_str(),
pData->data.sData.UTF8Decode().c_str());
@@ -314,7 +314,7 @@ void global_alternate::UpdateGlobalPersistentVariables()
case JS_GLOBALDATA_TYPE_OBJECT:
{
IJS_Runtime* pRuntime = JS_GetRuntime((JSFXObject)(*m_pJSObject));
- v8::Handle<v8::Object> pObj = JS_NewFxDynamicObj(pRuntime, NULL, -1);
+ v8::Local<v8::Object> pObj = JS_NewFxDynamicObj(pRuntime, NULL, -1);
PutObjectProperty(pObj, &pData->data);
@@ -325,7 +325,7 @@ void global_alternate::UpdateGlobalPersistentVariables()
}
break;
case JS_GLOBALDATA_TYPE_NULL:
- this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NULL, 0, false, "", v8::Handle<v8::Object>(), pData->bPersistent == 1);
+ this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NULL, 0, false, "", v8::Local<v8::Object>(), pData->bPersistent == 1);
JS_PutObjectNull(NULL,(JSFXObject)(*m_pJSObject),
pData->data.sKey.UTF8Decode().c_str());
break;
@@ -370,7 +370,7 @@ void global_alternate::CommitGlobalPersisitentVariables()
//if (pData->pData)
{
CJS_GlobalVariableArray array;
- v8::Handle<v8::Object> obj = v8::Local<v8::Object>::New(GetJSObject()->GetIsolate(),pData->pData);
+ v8::Local<v8::Object> obj = v8::Local<v8::Object>::New(GetJSObject()->GetIsolate(),pData->pData);
ObjectToArray(obj, array);
m_pGlobalData->SetGlobalVariableObject(name, array);
m_pGlobalData->SetGlobalVariablePersistent(name, pData->bPersistent);
@@ -386,21 +386,20 @@ void global_alternate::CommitGlobalPersisitentVariables()
}
}
-void global_alternate::ObjectToArray(v8::Handle<v8::Object> pObj, CJS_GlobalVariableArray& array)
+void global_alternate::ObjectToArray(v8::Local<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::Local<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());
+ v8::Local<v8::Value> v = JS_GetObjectElement(isolate, pObj, ws.c_str());
FXJSVALUETYPE vt = GET_VALUE_TYPE(v);
switch (vt)
{
@@ -409,7 +408,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;
@@ -418,7 +417,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;
@@ -437,7 +436,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;
@@ -455,7 +454,7 @@ void global_alternate::ObjectToArray(v8::Handle<v8::Object> pObj, CJS_GlobalVari
}
}
-void global_alternate::PutObjectProperty(v8::Handle<v8::Object> pObj, CJS_KeyValue* pData)
+void global_alternate::PutObjectProperty(v8::Local<v8::Object> pObj, CJS_KeyValue* pData)
{
ASSERT(pData != NULL);
@@ -478,7 +477,7 @@ void global_alternate::PutObjectProperty(v8::Handle<v8::Object> pObj, CJS_KeyVal
case JS_GLOBALDATA_TYPE_OBJECT:
{
IJS_Runtime* pRuntime = JS_GetRuntime((JSFXObject)(*m_pJSObject));
- v8::Handle<v8::Object> pNewObj = JS_NewFxDynamicObj(pRuntime, NULL, -1);
+ v8::Local<v8::Object> pNewObj = JS_NewFxDynamicObj(pRuntime, NULL, -1);
PutObjectProperty(pNewObj, pObjData);
JS_PutObjectObject(NULL, (JSObject)pObj, pObjData->sKey.UTF8Decode().c_str(), (JSObject)pNewObj);
}
@@ -608,7 +607,7 @@ FX_BOOL global_alternate::SetGlobalVariables(FX_LPCSTR propname, int nType,
return TRUE;
}
-FXJSVALUETYPE GET_VALUE_TYPE(v8::Handle<v8::Value> p)
+FXJSVALUETYPE GET_VALUE_TYPE(v8::Local<v8::Value> p)
{
const unsigned int nHash = JS_CalcHash(JS_GetTypeof(p));