Chromium Code Reviews| Index: fpdfsdk/src/javascript/app.cpp |
| diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp |
| index 12f164edf15b3cd4295762702ca9919e388e1a5d..967bba2a973f52ad28134046115f0e73d1084cdb 100644 |
| --- a/fpdfsdk/src/javascript/app.cpp |
| +++ b/fpdfsdk/src/javascript/app.cpp |
| @@ -123,14 +123,12 @@ FX_BOOL app::activeDocs(IFXJS_Context* cc, |
| CJS_Document* pJSDocument = NULL; |
| if (pDoc == pCurDoc) { |
| v8::Local<v8::Object> pObj = FXJS_GetThisObj(pRuntime->GetIsolate()); |
| - if (FXJS_GetObjDefnID(pObj) == |
| - FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Document")) |
| + if (FXJS_GetObjDefnID(pObj) == CJS_Document::g_nObjDefnID) |
| pJSDocument = |
| (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); |
| } else { |
| v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj( |
| - pRuntime->GetIsolate(), pContext, |
| - FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Document")); |
| + pRuntime->GetIsolate(), pContext, CJS_Document::g_nObjDefnID); |
| pJSDocument = |
| (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); |
| ASSERT(pJSDocument != NULL); |
| @@ -413,20 +411,13 @@ FX_BOOL app::setInterval(IFXJS_Context* cc, |
| m_aTimer.Add(pTimer); |
| v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj( |
| - pRuntime->GetIsolate(), pContext, |
| - FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"TimerObj")); |
| - |
| + pRuntime->GetIsolate(), pContext, CJS_TimerObj::g_nObjDefnID); |
| CJS_TimerObj* pJS_TimerObj = |
| (CJS_TimerObj*)FXJS_GetPrivate(pRuntime->GetIsolate(), pRetObj); |
| - ASSERT(pJS_TimerObj != NULL); |
| - |
| TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); |
| - ASSERT(pTimerObj != NULL); |
| - |
| pTimerObj->SetTimer(pTimer); |
| vRet = pRetObj; |
| - |
| return TRUE; |
| } |
| @@ -461,20 +452,13 @@ FX_BOOL app::setTimeOut(IFXJS_Context* cc, |
| m_aTimer.Add(pTimer); |
| v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj( |
| - pRuntime->GetIsolate(), pContext, |
| - FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"TimerObj")); |
| - |
| + pRuntime->GetIsolate(), pContext, CJS_TimerObj::g_nObjDefnID); |
| CJS_TimerObj* pJS_TimerObj = |
| (CJS_TimerObj*)FXJS_GetPrivate(pRuntime->GetIsolate(), pRetObj); |
| - ASSERT(pJS_TimerObj != NULL); |
| - |
| TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); |
| - ASSERT(pTimerObj != NULL); |
| - |
| pTimerObj->SetTimer(pTimer); |
| vRet = pRetObj; |
| - |
| return TRUE; |
| } |
| @@ -483,20 +467,14 @@ FX_BOOL app::clearTimeOut(IFXJS_Context* cc, |
| CJS_Value& vRet, |
| CFX_WideString& sError) { |
| CJS_Context* pContext = (CJS_Context*)cc; |
| - ASSERT(pContext != NULL); |
| - CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| - ASSERT(pRuntime != NULL); |
| - |
| if (params.size() != 1) { |
| - sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAMERROR); |
| + sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); |
| return FALSE; |
| } |
| if (params[0].GetType() == CJS_Value::VT_fxobject) { |
| v8::Local<v8::Object> pObj = params[0].ToV8Object(); |
| - { |
| - if (FXJS_GetObjDefnID(pObj) == |
| - FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"TimerObj")) { |
| + if (FXJS_GetObjDefnID(pObj) == CJS_TimerObj::g_nObjDefnID) { |
| if (CJS_Object* pJSObj = params[0].ToCJSObject()) { |
|
Lei Zhang
2015/10/06 01:15:21
indentation's off
Tom Sepez
2015/10/06 15:33:20
Yow. Git cl format not withstanding.
|
| if (TimerObj* pTimerObj = (TimerObj*)pJSObj->GetEmbedObject()) { |
| if (CJS_Timer* pTimer = pTimerObj->GetTimer()) { |
| @@ -514,7 +492,6 @@ FX_BOOL app::clearTimeOut(IFXJS_Context* cc, |
| } |
| } |
| } |
| - } |
| } |
| } |
| @@ -526,20 +503,14 @@ FX_BOOL app::clearInterval(IFXJS_Context* cc, |
| CJS_Value& vRet, |
| CFX_WideString& sError) { |
| CJS_Context* pContext = (CJS_Context*)cc; |
| - ASSERT(pContext != NULL); |
| - CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| - ASSERT(pRuntime != NULL); |
| - |
| if (params.size() != 1) { |
| - sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAMERROR); |
| + sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); |
| return FALSE; |
| } |
| if (params[0].GetType() == CJS_Value::VT_fxobject) { |
| v8::Local<v8::Object> pObj = params[0].ToV8Object(); |
| - { |
| - if (FXJS_GetObjDefnID(pObj) == |
| - FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"TimerObj")) { |
| + if (FXJS_GetObjDefnID(pObj) == CJS_TimerObj::g_nObjDefnID) { |
| if (CJS_Object* pJSObj = params[0].ToCJSObject()) { |
|
Lei Zhang
2015/10/06 01:15:21
ditto indentation
Tom Sepez
2015/10/06 15:33:20
Ditto yow.
|
| if (TimerObj* pTimerObj = (TimerObj*)pJSObj->GetEmbedObject()) { |
| if (CJS_Timer* pTimer = pTimerObj->GetTimer()) { |
| @@ -556,7 +527,6 @@ FX_BOOL app::clearInterval(IFXJS_Context* cc, |
| pTimerObj->SetTimer(NULL); |
| } |
| } |
| - } |
| } |
| } |
| } |