diff options
author | Bo Xu <bo_xu@foxitsoftware.com> | 2014-10-28 23:03:33 -0700 |
---|---|---|
committer | Bo Xu <bo_xu@foxitsoftware.com> | 2014-11-03 11:10:11 -0800 |
commit | fdc00a7042d912aafaabddae4d9c84199921ef23 (patch) | |
tree | 32ab8ac91cc68d2cd15b9168782a71b3f3f5e7b9 /fpdfsdk/include/javascript/JS_Define.h | |
parent | e9b38fa38de2c95d8260be31c57d9272c4d127ed (diff) | |
download | pdfium-fdc00a7042d912aafaabddae4d9c84199921ef23.tar.xz |
Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
Diffstat (limited to 'fpdfsdk/include/javascript/JS_Define.h')
-rw-r--r-- | fpdfsdk/include/javascript/JS_Define.h | 56 |
1 files changed, 16 insertions, 40 deletions
diff --git a/fpdfsdk/include/javascript/JS_Define.h b/fpdfsdk/include/javascript/JS_Define.h index 108c1e23ee..1798e01591 100644 --- a/fpdfsdk/include/javascript/JS_Define.h +++ b/fpdfsdk/include/javascript/JS_Define.h @@ -93,11 +93,8 @@ typedef CFX_WideString JS_ErrorString; {\ v8::Isolate* isolate = info.GetIsolate();\ v8::Local<v8::Context> context = isolate->GetCurrentContext();\ - v8::Local<v8::Value> v = context->GetEmbedderData(1);\ - ASSERT(!v.IsEmpty());\ - if(v.IsEmpty()) return;\ - v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\ - IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\ + IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);\ + if (pRuntime == NULL) return;\ IFXJS_Context* cc = pRuntime->GetCurrentContext();\ CJS_PropValue value(isolate);\ value.StartGetting();\ @@ -129,11 +126,8 @@ typedef CFX_WideString JS_ErrorString; {\ v8::Isolate* isolate = info.GetIsolate();\ v8::Local<v8::Context> context = isolate->GetCurrentContext();\ - v8::Local<v8::Value> v = context->GetEmbedderData(1);\ - ASSERT(!v.IsEmpty());\ - if(v.IsEmpty()) return;\ - v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\ - IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\ + IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);\ + if (pRuntime == NULL) return;\ IFXJS_Context* cc = pRuntime->GetCurrentContext();\ CJS_PropValue propValue(CJS_Value(isolate,value,VT_unknown));\ propValue.StartSetting();\ @@ -170,11 +164,8 @@ JS_STATIC_PROP_SET(prop_name, class_name) {\ v8::Isolate* isolate = info.GetIsolate();\ v8::Local<v8::Context> context = isolate->GetCurrentContext();\ - v8::Local<v8::Value> v = context->GetEmbedderData(1);\ - ASSERT(!v.IsEmpty());\ - if(v.IsEmpty()) return;\ - v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\ - IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\ + IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);\ + if (pRuntime == NULL) return;\ IFXJS_Context* cc = pRuntime->GetCurrentContext();\ CJS_Parameters parameters;\ for (unsigned int i = 0; i<(unsigned int)info.Length(); i++)\ @@ -359,11 +350,8 @@ const wchar_t * js_class_name::m_pClassName = JS_WIDESTRING(class_name);\ {\ v8::Isolate* isolate = info.GetIsolate();\ v8::Local<v8::Context> context = isolate->GetCurrentContext();\ - v8::Local<v8::Value> v = context->GetEmbedderData(1);\ - ASSERT(!v.IsEmpty());\ - if(v.IsEmpty()) return;\ - v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\ - IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\ + IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);\ + if (pRuntime == NULL) return;\ IFXJS_Context* cc = pRuntime->GetCurrentContext();\ v8::String::Utf8Value utf8_value(property);\ CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());\ @@ -397,11 +385,8 @@ const wchar_t * js_class_name::m_pClassName = JS_WIDESTRING(class_name);\ {\ v8::Isolate* isolate = info.GetIsolate();\ v8::Local<v8::Context> context = isolate->GetCurrentContext();\ - v8::Local<v8::Value> v = context->GetEmbedderData(1);\ - ASSERT(!v.IsEmpty());\ - if(v.IsEmpty()) return;\ - v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\ - IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\ + IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);\ + if (pRuntime == NULL) return;\ IFXJS_Context* cc = pRuntime->GetCurrentContext();\ v8::String::Utf8Value utf8_value(property);\ CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());\ @@ -434,11 +419,8 @@ const wchar_t * js_class_name::m_pClassName = JS_WIDESTRING(class_name);\ {\ v8::Isolate* isolate = info.GetIsolate();\ v8::Local<v8::Context> context = isolate->GetCurrentContext();\ - v8::Local<v8::Value> v = context->GetEmbedderData(1);\ - ASSERT(!v.IsEmpty());\ - if(v.IsEmpty()) return;\ - v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\ - IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\ + IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);\ + if (pRuntime == NULL) return;\ IFXJS_Context* cc = pRuntime->GetCurrentContext();\ v8::String::Utf8Value utf8_value(property);\ CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());\ @@ -525,11 +507,8 @@ void js_class_name::GetMethods(JSMethodSpec*& pMethods, int& nSize)\ {\ v8::Isolate* isolate = info.GetIsolate();\ v8::Local<v8::Context> context = isolate->GetCurrentContext();\ - v8::Local<v8::Value> v = context->GetEmbedderData(1);\ - ASSERT(!v.IsEmpty());\ - if(v.IsEmpty()) return;\ - v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\ - IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\ + IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);\ + if (pRuntime == NULL) return;\ IFXJS_Context* cc = pRuntime->GetCurrentContext();\ CJS_Parameters parameters;\ for (unsigned int i = 0; i<(unsigned int)info.Length(); i++)\ @@ -568,11 +547,8 @@ static void fun_name##_static(JS_METHOD_ARGS)\ {\ v8::Isolate* isolate = info.GetIsolate();\ v8::Local<v8::Context> context = isolate->GetCurrentContext();\ - v8::Local<v8::Value> v = context->GetEmbedderData(1);\ - ASSERT(!v.IsEmpty());\ - if(v.IsEmpty()) return;\ - v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(v);\ - IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)field->Value();\ + IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);\ + if (pRuntime == NULL) return;\ IFXJS_Context* cc = pRuntime->GetCurrentContext();\ CJS_Parameters parameters;\ for (unsigned int i = 0; i<(unsigned int)info.Length(); i++)\ |