diff options
author | Lei Zhang <thestig@chromium.org> | 2018-07-11 17:23:53 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-11 17:23:53 +0000 |
commit | b165ffb64e59998ec6d5f76c82bd2fe53734b3cd (patch) | |
tree | 2d1de5e7dc0fc4b6a4e1fbaa8437e57f9acfd4e8 /fxjs/cjs_app.cpp | |
parent | 7c694a4632dc3b11e26d66a44e598a211913d02a (diff) | |
download | pdfium-b165ffb64e59998ec6d5f76c82bd2fe53734b3cd.tar.xz |
Use JSGetObject() in more places.chromium/3489
Change-Id: I7f26709bdad56cc2712f21e8e644be7c53ec5ec4
Reviewed-on: https://pdfium-review.googlesource.com/37513
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fxjs/cjs_app.cpp')
-rw-r--r-- | fxjs/cjs_app.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
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<v8::Object> 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<v8::Object> pObj = pRuntime->GetThisObj(); - if (CFXJS_Engine::GetObjDefnID(pObj) == CJS_Document::GetObjDefnID()) { - pJSDocument = - static_cast<CJS_Document*>(CFXJS_Engine::GetObjectPrivate(pObj)); - } + CJS_Document* pJSDocument = JSGetObject<CJS_Document>(pObj); v8::Local<v8::Array> aDocs = pRuntime->NewArray(); pRuntime->PutArrayElement( aDocs, 0, @@ -398,14 +394,11 @@ void CJS_App::ClearTimerCommon(CJS_Runtime* pRuntime, return; v8::Local<v8::Object> 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<CJS_TimerObj>(pObj); + if (!pTimer) return; - GlobalTimer::Cancel(static_cast<CJS_TimerObj*>(pJSObj)->GetTimerID()); + GlobalTimer::Cancel(pTimer->GetTimerID()); } CJS_Return CJS_App::execMenuItem( |