diff options
Diffstat (limited to 'fpdfsdk/javascript/JS_Define.h')
-rw-r--r-- | fpdfsdk/javascript/JS_Define.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h index 4bcdcdf994..46469d7dec 100644 --- a/fpdfsdk/javascript/JS_Define.h +++ b/fpdfsdk/javascript/JS_Define.h @@ -52,13 +52,13 @@ void JSPropGetter(const char* prop_name_string, C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject()); WideString sError; - CJS_Value prop_value(pRuntime); + CJS_Value prop_value; if (!(pObj->*M)(pRuntime, &prop_value, &sError)) { pRuntime->Error( JSFormatErrorString(class_name_string, prop_name_string, sError)); return; } - info.GetReturnValue().Set(prop_value.ToV8Value(pRuntime)); + info.GetReturnValue().Set(prop_value.ToV8Value()); } template <class C, bool (C::*M)(CJS_Runtime*, const CJS_Value&, WideString*)> @@ -80,7 +80,7 @@ void JSPropSetter(const char* prop_name_string, C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject()); WideString sError; - CJS_Value prop_value(pRuntime, value); + CJS_Value prop_value(value); if (!(pObj->*M)(pRuntime, prop_value, &sError)) { pRuntime->Error( JSFormatErrorString(class_name_string, prop_name_string, sError)); @@ -113,23 +113,25 @@ void JSMethod(const char* method_name_string, CJS_Runtime::CurrentRuntimeFromIsolate(info.GetIsolate()); if (!pRuntime) return; + std::vector<CJS_Value> parameters; - for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) { - parameters.push_back(CJS_Value(pRuntime, info[i])); - } + for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) + parameters.push_back(CJS_Value(info[i])); + CJS_Object* pJSObj = static_cast<CJS_Object*>(pRuntime->GetObjectPrivate(info.Holder())); if (!pJSObj) return; + C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject()); WideString sError; - CJS_Value valueRes(pRuntime); + CJS_Value valueRes; if (!(pObj->*M)(pRuntime, parameters, valueRes, sError)) { pRuntime->Error( JSFormatErrorString(class_name_string, method_name_string, sError)); return; } - info.GetReturnValue().Set(valueRes.ToV8Value(pRuntime)); + info.GetReturnValue().Set(valueRes.ToV8Value()); } #define JS_STATIC_METHOD(method_name, class_name) \ |