Index: fpdfsdk/src/javascript/app.cpp |
diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp |
index 9d4fa9ca137e375095138fb40964284f54b93784..4bdfd4f8e9f62870193312b7fbe23b475ae54dbf 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); |
@@ -415,24 +413,16 @@ FX_BOOL app::setInterval(IFXJS_Context* cc, |
pTimer->SetRuntime(pRuntime); |
pTimer->SetJScript(script); |
pTimer->SetTimeOut(0); |
- // pTimer->SetStartTime(GetTickCount()); |
pTimer->SetJSTimer(dwInterval); |
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; |
} |
@@ -472,20 +462,13 @@ FX_BOOL app::setTimeOut(IFXJS_Context* cc, |
pTimer->SetJSTimer(dwTimeOut); |
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; |
} |
@@ -494,20 +477,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()) { |
if (TimerObj* pTimerObj = (TimerObj*)pJSObj->GetEmbedObject()) { |
if (CJS_Timer* pTimer = pTimerObj->GetTimer()) { |
@@ -525,7 +502,6 @@ FX_BOOL app::clearTimeOut(IFXJS_Context* cc, |
} |
} |
} |
- } |
} |
} |
@@ -537,20 +513,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()) { |
if (TimerObj* pTimerObj = (TimerObj*)pJSObj->GetEmbedObject()) { |
if (CJS_Timer* pTimer = pTimerObj->GetTimer()) { |
@@ -567,7 +537,6 @@ FX_BOOL app::clearInterval(IFXJS_Context* cc, |
pTimerObj->SetTimer(NULL); |
} |
} |
- } |
} |
} |
} |