diff options
Diffstat (limited to 'fxjs')
-rw-r--r-- | fxjs/cjs_document.cpp | 8 | ||||
-rw-r--r-- | fxjs/cjs_document.h | 3 | ||||
-rw-r--r-- | fxjs/cjs_global.cpp | 8 | ||||
-rw-r--r-- | fxjs/cjs_global.h | 3 | ||||
-rw-r--r-- | fxjs/cjs_object.cpp | 2 | ||||
-rw-r--r-- | fxjs/cjs_object.h | 2 | ||||
-rw-r--r-- | fxjs/js_define.h | 5 |
7 files changed, 8 insertions, 23 deletions
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp index a259767560..791e9bdfd7 100644 --- a/fxjs/cjs_document.cpp +++ b/fxjs/cjs_document.cpp @@ -124,14 +124,12 @@ void CJS_Document::DefineJSObjects(CFXJS_Engine* pEngine) { } CJS_Document::CJS_Document(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime) - : CJS_Object(pObject, pRuntime) {} - -CJS_Document::~CJS_Document() = default; - -void CJS_Document::InitInstance() { + : CJS_Object(pObject, pRuntime) { SetFormFillEnv(GetRuntime()->GetFormFillEnv()); } +CJS_Document::~CJS_Document() = default; + // The total number of fields in document. CJS_Return CJS_Document::get_num_fields(CJS_Runtime* pRuntime) { if (!m_pFormFillEnv) diff --git a/fxjs/cjs_document.h b/fxjs/cjs_document.h index 6727f4e5aa..262d472cca 100644 --- a/fxjs/cjs_document.h +++ b/fxjs/cjs_document.h @@ -26,9 +26,6 @@ class CJS_Document : public CJS_Object { CJS_Document(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime); ~CJS_Document() override; - // CJS_Object: - void InitInstance() override; - void SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv); CPDFSDK_FormFillEnvironment* GetFormFillEnv() const { return m_pFormFillEnv.Get(); diff --git a/fxjs/cjs_global.cpp b/fxjs/cjs_global.cpp index 5d5bc3ccf0..ffa30a54a8 100644 --- a/fxjs/cjs_global.cpp +++ b/fxjs/cjs_global.cpp @@ -200,17 +200,15 @@ void CJS_Global::DefineJSObjects(CFXJS_Engine* pEngine) { } CJS_Global::CJS_Global(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime) - : CJS_Object(pObject, pRuntime) {} + : CJS_Object(pObject, pRuntime) { + Initial(GetRuntime()->GetFormFillEnv()); +} CJS_Global::~CJS_Global() { DestroyGlobalPersisitentVariables(); m_pGlobalData->Release(); } -void CJS_Global::InitInstance() { - Initial(GetRuntime()->GetFormFillEnv()); -} - void CJS_Global::Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv) { m_pFormFillEnv.Reset(pFormFillEnv); m_pGlobalData = CJS_GlobalData::GetRetainedInstance(pFormFillEnv); diff --git a/fxjs/cjs_global.h b/fxjs/cjs_global.h index e0d41b801d..17a519e651 100644 --- a/fxjs/cjs_global.h +++ b/fxjs/cjs_global.h @@ -38,9 +38,6 @@ class CJS_Global : public CJS_Object { CJS_Global(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime); ~CJS_Global() override; - // CJS_Object: - void InitInstance() override; - CJS_Return DelProperty(CJS_Runtime* pRuntime, const wchar_t* propname); void Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv); diff --git a/fxjs/cjs_object.cpp b/fxjs/cjs_object.cpp index 62fa42154d..36fcc744d1 100644 --- a/fxjs/cjs_object.cpp +++ b/fxjs/cjs_object.cpp @@ -46,5 +46,3 @@ CJS_Object::CJS_Object(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime) m_pRuntime(pRuntime) {} CJS_Object::~CJS_Object() {} - -void CJS_Object::InitInstance() {} diff --git a/fxjs/cjs_object.h b/fxjs/cjs_object.h index c33fd7710f..c3766fc2c0 100644 --- a/fxjs/cjs_object.h +++ b/fxjs/cjs_object.h @@ -53,8 +53,6 @@ class CJS_Object { CJS_Object(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime); virtual ~CJS_Object(); - virtual void InitInstance(); - v8::Local<v8::Object> ToV8Object() { return m_pV8Object.Get(GetIsolate()); } v8::Isolate* GetIsolate() const { return m_pIsolate.Get(); } CJS_Runtime* GetRuntime() const { return m_pRuntime.Get(); } diff --git a/fxjs/js_define.h b/fxjs/js_define.h index 93dfd49099..0f16749779 100644 --- a/fxjs/js_define.h +++ b/fxjs/js_define.h @@ -50,9 +50,8 @@ std::vector<v8::Local<v8::Value>> ExpandKeywordParams( template <class T> static void JSConstructor(CFXJS_Engine* pEngine, v8::Local<v8::Object> obj) { - auto pObj = pdfium::MakeUnique<T>(obj, static_cast<CJS_Runtime*>(pEngine)); - pObj->InitInstance(); - pEngine->SetObjectPrivate(obj, std::move(pObj)); + pEngine->SetObjectPrivate( + obj, pdfium::MakeUnique<T>(obj, static_cast<CJS_Runtime*>(pEngine))); } // CJS_Object has vitual dtor, template not required. |