summaryrefslogtreecommitdiff
path: root/fpdfsdk/include/javascript
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-09-22 08:36:17 -0700
committerTom Sepez <tsepez@chromium.org>2015-09-22 08:36:17 -0700
commited7b2b50aa1744e0bc5a60bef12c61fa91d863b7 (patch)
tree8661329f66b823af324441fb6accec98a8753cb8 /fpdfsdk/include/javascript
parent854a7f65b70d40225a53890a68a57f5c13cf268c (diff)
downloadpdfium-ed7b2b50aa1744e0bc5a60bef12c61fa91d863b7.tar.xz
XFA: contention between FXJSE and FXJS over isolate data slots
This probably broke at 06b60021e when the FXJS slot moved to 0 from 1 unless explicitly overriden by the embedder, which conflicted with the FXJSE_ usage of slot 0. Also simplify some logic used to track global intialization of the underling JS. TEST=run_javascript_tests.py on XFA branch doesn't segv. R=jochen@chromium.org Review URL: https://codereview.chromium.org/1351173002 .
Diffstat (limited to 'fpdfsdk/include/javascript')
-rw-r--r--fpdfsdk/include/javascript/JS_Define.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/fpdfsdk/include/javascript/JS_Define.h b/fpdfsdk/include/javascript/JS_Define.h
index 1addca5cec..3b5798ef5c 100644
--- a/fpdfsdk/include/javascript/JS_Define.h
+++ b/fpdfsdk/include/javascript/JS_Define.h
@@ -79,8 +79,8 @@ void JSPropGetter(const char* prop_name_string,
v8::Local<v8::String> property,
const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
- IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
+ FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(isolate);
+ IFXJS_Context* pRuntimeContext = pData->m_pFXJSRuntime->GetCurrentContext();
CJS_PropValue value(isolate);
value.StartGetting();
CJS_Object* pJSObj = (CJS_Object*)FXJS_GetPrivate(isolate, info.Holder());
@@ -102,8 +102,8 @@ void JSPropSetter(const char* prop_name_string,
v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<void>& info) {
v8::Isolate* isolate = info.GetIsolate();
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
- IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
+ FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(isolate);
+ IFXJS_Context* pRuntimeContext = pData->m_pFXJSRuntime->GetCurrentContext();
CJS_PropValue propValue(CJS_Value(isolate, value, CJS_Value::VT_unknown));
propValue.StartSetting();
CJS_Object* pJSObj = (CJS_Object*)FXJS_GetPrivate(isolate, info.Holder());
@@ -141,8 +141,8 @@ void JSMethod(const char* method_name_string,
const char* class_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
- IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
+ FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(isolate);
+ IFXJS_Context* pRuntimeContext = pData->m_pFXJSRuntime->GetCurrentContext();
CJS_Parameters parameters;
for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) {
parameters.push_back(CJS_Value(isolate, info[i], CJS_Value::VT_unknown));
@@ -268,8 +268,8 @@ void JSSpecialPropGet(const char* class_name,
const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
- IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
+ FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(isolate);
+ IFXJS_Context* pRuntimeContext = pData->m_pFXJSRuntime->GetCurrentContext();
CJS_Object* pJSObj =
reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder()));
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
@@ -293,8 +293,8 @@ void JSSpecialPropPut(const char* class_name,
const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
- IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
+ FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(isolate);
+ IFXJS_Context* pRuntimeContext = pData->m_pFXJSRuntime->GetCurrentContext();
CJS_Object* pJSObj =
reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder()));
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
@@ -315,8 +315,8 @@ void JSSpecialPropDel(const char* class_name,
const v8::PropertyCallbackInfo<v8::Boolean>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
- IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
+ FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(isolate);
+ IFXJS_Context* pRuntimeContext = pData->m_pFXJSRuntime->GetCurrentContext();
CJS_Object* pJSObj =
reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder()));
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
@@ -421,8 +421,8 @@ template <FX_BOOL (
void JSGlobalFunc(const char* func_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
- IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
- IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
+ FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(isolate);
+ IFXJS_Context* pRuntimeContext = pData->m_pFXJSRuntime->GetCurrentContext();
CJS_Parameters parameters;
for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) {
parameters.push_back(CJS_Value(isolate, info[i], CJS_Value::VT_unknown));