From b165ffb64e59998ec6d5f76c82bd2fe53734b3cd Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 11 Jul 2018 17:23:53 +0000 Subject: Use JSGetObject() in more places. Change-Id: I7f26709bdad56cc2712f21e8e644be7c53ec5ec4 Reviewed-on: https://pdfium-review.googlesource.com/37513 Reviewed-by: dsinclair Commit-Queue: Lei Zhang --- fxjs/cjs_app.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'fxjs/cjs_app.cpp') diff --git a/fxjs/cjs_app.cpp b/fxjs/cjs_app.cpp index 4648f462b4..ad155b787c 100644 --- a/fxjs/cjs_app.cpp +++ b/fxjs/cjs_app.cpp @@ -102,12 +102,8 @@ CJS_App::CJS_App(v8::Local pObject, CJS_Runtime* pRuntime) CJS_App::~CJS_App() = default; CJS_Return CJS_App::get_active_docs(CJS_Runtime* pRuntime) { - CJS_Document* pJSDocument = nullptr; v8::Local pObj = pRuntime->GetThisObj(); - if (CFXJS_Engine::GetObjDefnID(pObj) == CJS_Document::GetObjDefnID()) { - pJSDocument = - static_cast(CFXJS_Engine::GetObjectPrivate(pObj)); - } + CJS_Document* pJSDocument = JSGetObject(pObj); v8::Local aDocs = pRuntime->NewArray(); pRuntime->PutArrayElement( aDocs, 0, @@ -398,14 +394,11 @@ void CJS_App::ClearTimerCommon(CJS_Runtime* pRuntime, return; v8::Local pObj = pRuntime->ToObject(param); - if (CFXJS_Engine::GetObjDefnID(pObj) != CJS_TimerObj::GetObjDefnID()) - return; - - CJS_Object* pJSObj = CFXJS_Engine::GetObjectPrivate(pObj); - if (!pJSObj) + CJS_TimerObj* pTimer = JSGetObject(pObj); + if (!pTimer) return; - GlobalTimer::Cancel(static_cast(pJSObj)->GetTimerID()); + GlobalTimer::Cancel(pTimer->GetTimerID()); } CJS_Return CJS_App::execMenuItem( -- cgit v1.2.3