summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/jsapi/fxjs_v8.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-13 15:00:10 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-13 15:00:10 -0700
commit3342090d65e852f3f37a8f04d3fbe3ff2467d05c (patch)
tree04ea6a1adeae79279a4d4e0f147161c2b4601dcb /fpdfsdk/src/jsapi/fxjs_v8.cpp
parentf6c67325ebb931ecad6c0f0e90302d854db75900 (diff)
downloadpdfium-3342090d65e852f3f37a8f04d3fbe3ff2467d05c.tar.xz
Merge to XFA: Pass IJS_Runtime, not IJS_Context, to native object constructors.
Original Review URL: https://codereview.chromium.org/1389163007 . (cherry picked from commit 848a13b6777cbff8cc4aea3ab3d69eaa0b82ae6c) Merge conflics in: fpdfsdk/src/javascript/JS_Runtime.cpp fpdfsdk/src/javascript/JS_Runtime_Stub.cpp fpdfsdk/src/jsapi/fxjs_v8.cpp R=thestig@chromium.org Review URL: https://codereview.chromium.org/1394993006 .
Diffstat (limited to 'fpdfsdk/src/jsapi/fxjs_v8.cpp')
-rw-r--r--fpdfsdk/src/jsapi/fxjs_v8.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp
index f400efbcd5..1f8c5728b0 100644
--- a/fpdfsdk/src/jsapi/fxjs_v8.cpp
+++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp
@@ -273,8 +273,7 @@ void FXJS_DefineGlobalConst(v8::Isolate* pIsolate,
}
void FXJS_InitializeRuntime(v8::Isolate* pIsolate,
- IJS_Runtime* pFXRuntime,
- IJS_Context* context,
+ IJS_Runtime* pIRuntime,
v8::Global<v8::Context>& v8PersistentContext) {
if (pIsolate == g_isolate)
++g_isolate_ref_count;
@@ -287,7 +286,7 @@ void FXJS_InitializeRuntime(v8::Isolate* pIsolate,
v8::Context::Scope context_scope(v8Context);
FXJS_PerIsolateData::SetUp(pIsolate);
- v8Context->SetAlignedPointerInEmbedderData(kPerContextDataIndex, pFXRuntime);
+ v8Context->SetAlignedPointerInEmbedderData(kPerContextDataIndex, pIRuntime);
int maxID = CFXJS_ObjDefinition::MaxID(pIsolate);
for (int i = 0; i < maxID; ++i) {
@@ -305,14 +304,13 @@ void FXJS_InitializeRuntime(v8::Isolate* pIsolate,
.ToLocalChecked()
->SetAlignedPointerInInternalField(0, new CFXJS_PrivateData(i));
- if (pObjDef->m_pConstructor) {
- pObjDef->m_pConstructor(context, v8Context->Global()
- ->GetPrototype()
- ->ToObject(v8Context)
- .ToLocalChecked());
- }
+ if (pObjDef->m_pConstructor)
+ pObjDef->m_pConstructor(pIRuntime, v8Context->Global()
+ ->GetPrototype()
+ ->ToObject(v8Context)
+ .ToLocalChecked());
} else if (pObjDef->m_ObjType == FXJSOBJTYPE_STATIC) {
- v8::Local<v8::Object> obj = FXJS_NewFxDynamicObj(pIsolate, context, i);
+ v8::Local<v8::Object> obj = FXJS_NewFxDynamicObj(pIsolate, pIRuntime, i);
v8Context->Global()->Set(v8Context, m_ObjName, obj).FromJust();
pObjDef->m_StaticObj.Reset(pIsolate, obj);
}
@@ -365,7 +363,6 @@ IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate) {
int FXJS_Execute(v8::Isolate* pIsolate,
IJS_Context* pJSContext,
const wchar_t* script,
- long length,
FXJSErr* pError) {
v8::Isolate::Scope isolate_scope(pIsolate);
v8::TryCatch try_catch(pIsolate);
@@ -392,7 +389,7 @@ int FXJS_Execute(v8::Isolate* pIsolate,
}
v8::Local<v8::Object> FXJS_NewFxDynamicObj(v8::Isolate* pIsolate,
- IJS_Context* pJSContext,
+ IJS_Runtime* pIRuntime,
int nObjDefnID) {
v8::Isolate::Scope isolate_scope(pIsolate);
v8::Local<v8::Context> context = pIsolate->GetCurrentContext();
@@ -419,7 +416,7 @@ v8::Local<v8::Object> FXJS_NewFxDynamicObj(v8::Isolate* pIsolate,
obj->SetAlignedPointerInInternalField(0, new CFXJS_PrivateData(nObjDefnID));
if (pObjDef->m_pConstructor)
- pObjDef->m_pConstructor(pJSContext, obj);
+ pObjDef->m_pConstructor(pIRuntime, obj);
return obj;
}