summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/global.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-09-10 12:28:37 -0700
committerTom Sepez <tsepez@chromium.org>2015-09-10 12:28:37 -0700
commit808a99e8c6f72713ca9492508faa4b8445ae0d33 (patch)
treeb171af528eac6ff284bcb257418f49c031f640cd /fpdfsdk/src/javascript/global.cpp
parentab54bc0f66ca3130ea4780580060f75f20c12234 (diff)
downloadpdfium-808a99e8c6f72713ca9492508faa4b8445ae0d33.tar.xz
Merge to XFA: Remove some abstractions in fxjs_v8.h.
Conflicts: fpdfsdk/src/javascript/Document.cpp fpdfsdk/src/javascript/JS_Runtime.cpp fpdfsdk/src/jsapi/fxjs_v8.cpp New: fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp (cherry picked from commit 6df59849472958e7de96da6d9fc7b223b7c1f1c3) Original Review URL: https://codereview.chromium.org/1332973002 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1334833003 .
Diffstat (limited to 'fpdfsdk/src/javascript/global.cpp')
-rw-r--r--fpdfsdk/src/javascript/global.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp
index f8be3687db..ee1f1ef137 100644
--- a/fpdfsdk/src/javascript/global.cpp
+++ b/fpdfsdk/src/javascript/global.cpp
@@ -160,7 +160,7 @@ FX_BOOL JSGlobalAlternate::DoProperty(IFXJS_Context* cc,
false, sData, v8::Local<v8::Object>(), FALSE);
}
case VT_object: {
- JSObject pData;
+ v8::Local<v8::Object> pData;
vp >> pData;
return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_OBJECT, 0,
false, "", pData, FALSE);
@@ -248,7 +248,7 @@ void JSGlobalAlternate::UpdateGlobalPersistentVariables() {
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),
+ JS_PutObjectNumber(NULL, (v8::Local<v8::Object>)(*m_pJSObject),
pData->data.sKey.UTF8Decode().c_str(),
pData->data.dData);
break;
@@ -256,7 +256,7 @@ void JSGlobalAlternate::UpdateGlobalPersistentVariables() {
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),
+ JS_PutObjectBoolean(NULL, (v8::Local<v8::Object>)(*m_pJSObject),
pData->data.sKey.UTF8Decode().c_str(),
(bool)(pData->data.bData == 1));
break;
@@ -264,27 +264,29 @@ void JSGlobalAlternate::UpdateGlobalPersistentVariables() {
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),
+ JS_PutObjectString(NULL, (v8::Local<v8::Object>)(*m_pJSObject),
pData->data.sKey.UTF8Decode().c_str(),
pData->data.sData.UTF8Decode().c_str());
break;
case JS_GLOBALDATA_TYPE_OBJECT: {
- IJS_Runtime* pRuntime = JS_GetRuntime((JSFXObject)(*m_pJSObject));
+ v8::Isolate* pRuntime =
+ JS_GetRuntime((v8::Local<v8::Object>)(*m_pJSObject));
v8::Local<v8::Object> pObj = JS_NewFxDynamicObj(pRuntime, NULL, -1);
PutObjectProperty(pObj, &pData->data);
SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_OBJECT, 0,
- false, "", (JSObject)pObj, pData->bPersistent == 1);
- JS_PutObjectObject(NULL, (JSFXObject)(*m_pJSObject),
+ false, "", (v8::Local<v8::Object>)pObj,
+ pData->bPersistent == 1);
+ JS_PutObjectObject(NULL, (v8::Local<v8::Object>)(*m_pJSObject),
pData->data.sKey.UTF8Decode().c_str(),
- (JSObject)pObj);
+ (v8::Local<v8::Object>)pObj);
} break;
case JS_GLOBALDATA_TYPE_NULL:
SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NULL, 0, false,
"", v8::Local<v8::Object>(),
pData->bPersistent == 1);
- JS_PutObjectNull(NULL, (JSFXObject)(*m_pJSObject),
+ JS_PutObjectNull(NULL, (v8::Local<v8::Object>)(*m_pJSObject),
pData->data.sKey.UTF8Decode().c_str());
break;
}
@@ -400,30 +402,31 @@ void JSGlobalAlternate::PutObjectProperty(v8::Local<v8::Object> pObj,
switch (pObjData->nType) {
case JS_GLOBALDATA_TYPE_NUMBER:
- JS_PutObjectNumber(NULL, (JSObject)pObj,
+ JS_PutObjectNumber(NULL, (v8::Local<v8::Object>)pObj,
pObjData->sKey.UTF8Decode().c_str(),
pObjData->dData);
break;
case JS_GLOBALDATA_TYPE_BOOLEAN:
- JS_PutObjectBoolean(NULL, (JSObject)pObj,
+ JS_PutObjectBoolean(NULL, (v8::Local<v8::Object>)pObj,
pObjData->sKey.UTF8Decode().c_str(),
(bool)(pObjData->bData == 1));
break;
case JS_GLOBALDATA_TYPE_STRING:
- JS_PutObjectString(NULL, (JSObject)pObj,
+ JS_PutObjectString(NULL, (v8::Local<v8::Object>)pObj,
pObjData->sKey.UTF8Decode().c_str(),
pObjData->sData.UTF8Decode().c_str());
break;
case JS_GLOBALDATA_TYPE_OBJECT: {
- IJS_Runtime* pRuntime = JS_GetRuntime((JSFXObject)(*m_pJSObject));
+ v8::Isolate* pRuntime =
+ JS_GetRuntime((v8::Local<v8::Object>)(*m_pJSObject));
v8::Local<v8::Object> pNewObj = JS_NewFxDynamicObj(pRuntime, NULL, -1);
PutObjectProperty(pNewObj, pObjData);
- JS_PutObjectObject(NULL, (JSObject)pObj,
+ JS_PutObjectObject(NULL, (v8::Local<v8::Object>)pObj,
pObjData->sKey.UTF8Decode().c_str(),
- (JSObject)pNewObj);
+ (v8::Local<v8::Object>)pNewObj);
} break;
case JS_GLOBALDATA_TYPE_NULL:
- JS_PutObjectNull(NULL, (JSObject)pObj,
+ JS_PutObjectNull(NULL, (v8::Local<v8::Object>)pObj,
pObjData->sKey.UTF8Decode().c_str());
break;
}
@@ -442,7 +445,7 @@ FX_BOOL JSGlobalAlternate::SetGlobalVariables(const FX_CHAR* propname,
double dData,
bool bData,
const CFX_ByteString& sData,
- JSObject pData,
+ v8::Local<v8::Object> pData,
bool bDefaultPersistent) {
if (!propname)
return FALSE;