| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "../../../third_party/base/nonstd_unique_ptr.h" | 7 #include "../../../third_party/base/nonstd_unique_ptr.h" |
| 8 #include "../../include/javascript/JavaScript.h" | 8 #include "../../include/javascript/JavaScript.h" |
| 9 #include "../../include/javascript/IJavaScript.h" | 9 #include "../../include/javascript/IJavaScript.h" |
| 10 #include "../../include/javascript/JS_Define.h" | 10 #include "../../include/javascript/JS_Define.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 return FALSE; | 115 return FALSE; |
| 116 | 116 |
| 117 CJS_Context* pContext = (CJS_Context*)cc; | 117 CJS_Context* pContext = (CJS_Context*)cc; |
| 118 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); | 118 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); |
| 119 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 119 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 120 CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument(); | 120 CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument(); |
| 121 CJS_Array aDocs(pRuntime->GetIsolate()); | 121 CJS_Array aDocs(pRuntime->GetIsolate()); |
| 122 if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) { | 122 if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) { |
| 123 CJS_Document* pJSDocument = NULL; | 123 CJS_Document* pJSDocument = NULL; |
| 124 if (pDoc == pCurDoc) { | 124 if (pDoc == pCurDoc) { |
| 125 v8::Local<v8::Object> pObj = JS_GetThisObj(pRuntime->GetIsolate()); | 125 v8::Local<v8::Object> pObj = FXJS_GetThisObj(pRuntime->GetIsolate()); |
| 126 if (JS_GetObjDefnID(pObj) == | 126 if (FXJS_GetObjDefnID(pObj) == |
| 127 JS_GetObjDefnID(pRuntime->GetIsolate(), L"Document")) | 127 FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Document")) |
| 128 pJSDocument = | 128 pJSDocument = |
| 129 (CJS_Document*)JS_GetPrivate(pRuntime->GetIsolate(), pObj); | 129 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); |
| 130 } else { | 130 } else { |
| 131 v8::Local<v8::Object> pObj = JS_NewFxDynamicObj( | 131 v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj( |
| 132 pRuntime->GetIsolate(), pContext, | 132 pRuntime->GetIsolate(), pContext, |
| 133 JS_GetObjDefnID(pRuntime->GetIsolate(), L"Document")); | 133 FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Document")); |
| 134 pJSDocument = (CJS_Document*)JS_GetPrivate(pRuntime->GetIsolate(), pObj); | 134 pJSDocument = |
| 135 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); |
| 135 ASSERT(pJSDocument != NULL); | 136 ASSERT(pJSDocument != NULL); |
| 136 } | 137 } |
| 137 aDocs.SetElement(0, CJS_Value(pRuntime->GetIsolate(), pJSDocument)); | 138 aDocs.SetElement(0, CJS_Value(pRuntime->GetIsolate(), pJSDocument)); |
| 138 } | 139 } |
| 139 if (aDocs.GetLength() > 0) | 140 if (aDocs.GetLength() > 0) |
| 140 vp << aDocs; | 141 vp << aDocs; |
| 141 else | 142 else |
| 142 vp.SetNull(); | 143 vp.SetNull(); |
| 143 | 144 |
| 144 return TRUE; | 145 return TRUE; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 return FALSE; | 263 return FALSE; |
| 263 | 264 |
| 264 CFX_WideString swMsg = L""; | 265 CFX_WideString swMsg = L""; |
| 265 CFX_WideString swTitle = L""; | 266 CFX_WideString swTitle = L""; |
| 266 int iIcon = 0; | 267 int iIcon = 0; |
| 267 int iType = 0; | 268 int iType = 0; |
| 268 | 269 |
| 269 v8::Isolate* isolate = GetIsolate(cc); | 270 v8::Isolate* isolate = GetIsolate(cc); |
| 270 | 271 |
| 271 if (iSize == 1) { | 272 if (iSize == 1) { |
| 272 if (params[0].GetType() == VT_object) { | 273 if (params[0].GetType() == CJS_Value::VT_object) { |
| 273 v8::Local<v8::Object> pObj = params[0].ToV8Object(); | 274 v8::Local<v8::Object> pObj = params[0].ToV8Object(); |
| 274 { | 275 { |
| 275 v8::Local<v8::Value> pValue = | 276 v8::Local<v8::Value> pValue = |
| 276 JS_GetObjectElement(isolate, pObj, L"cMsg"); | 277 FXJS_GetObjectElement(isolate, pObj, L"cMsg"); |
| 277 swMsg = CJS_Value(isolate, pValue, VT_unknown).ToCFXWideString(); | 278 swMsg = |
| 279 CJS_Value(isolate, pValue, CJS_Value::VT_unknown).ToCFXWideString(); |
| 278 | 280 |
| 279 pValue = JS_GetObjectElement(isolate, pObj, L"cTitle"); | 281 pValue = FXJS_GetObjectElement(isolate, pObj, L"cTitle"); |
| 280 swTitle = CJS_Value(isolate, pValue, VT_unknown).ToCFXWideString(); | 282 swTitle = |
| 283 CJS_Value(isolate, pValue, CJS_Value::VT_unknown).ToCFXWideString(); |
| 281 | 284 |
| 282 pValue = JS_GetObjectElement(isolate, pObj, L"nIcon"); | 285 pValue = FXJS_GetObjectElement(isolate, pObj, L"nIcon"); |
| 283 iIcon = CJS_Value(isolate, pValue, VT_unknown).ToInt(); | 286 iIcon = CJS_Value(isolate, pValue, CJS_Value::VT_unknown).ToInt(); |
| 284 | 287 |
| 285 pValue = JS_GetObjectElement(isolate, pObj, L"nType"); | 288 pValue = FXJS_GetObjectElement(isolate, pObj, L"nType"); |
| 286 iType = CJS_Value(isolate, pValue, VT_unknown).ToInt(); | 289 iType = CJS_Value(isolate, pValue, CJS_Value::VT_unknown).ToInt(); |
| 287 } | 290 } |
| 288 | 291 |
| 289 if (swMsg == L"") { | 292 if (swMsg == L"") { |
| 290 CJS_Array carray(isolate); | 293 CJS_Array carray(isolate); |
| 291 if (params[0].ConvertToArray(carray)) { | 294 if (params[0].ConvertToArray(carray)) { |
| 292 int iLength = carray.GetLength(); | 295 int iLength = carray.GetLength(); |
| 293 CJS_Value* pValue = new CJS_Value(isolate); | 296 CJS_Value* pValue = new CJS_Value(isolate); |
| 294 for (int i = 0; i < iLength; ++i) { | 297 for (int i = 0; i < iLength; ++i) { |
| 295 carray.GetElement(i, *pValue); | 298 carray.GetElement(i, *pValue); |
| 296 swMsg += (*pValue).ToCFXWideString(); | 299 swMsg += (*pValue).ToCFXWideString(); |
| 297 if (i < iLength - 1) | 300 if (i < iLength - 1) |
| 298 swMsg += L", "; | 301 swMsg += L", "; |
| 299 } | 302 } |
| 300 | 303 |
| 301 delete pValue; | 304 delete pValue; |
| 302 } | 305 } |
| 303 } | 306 } |
| 304 | 307 |
| 305 if (swTitle == L"") | 308 if (swTitle == L"") |
| 306 swTitle = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSALERT); | 309 swTitle = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSALERT); |
| 307 } else if (params[0].GetType() == VT_boolean) { | 310 } else if (params[0].GetType() == CJS_Value::VT_boolean) { |
| 308 FX_BOOL bGet = params[0].ToBool(); | 311 FX_BOOL bGet = params[0].ToBool(); |
| 309 if (bGet) | 312 if (bGet) |
| 310 swMsg = L"true"; | 313 swMsg = L"true"; |
| 311 else | 314 else |
| 312 swMsg = L"false"; | 315 swMsg = L"false"; |
| 313 | 316 |
| 314 swTitle = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSALERT); | 317 swTitle = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSALERT); |
| 315 } else { | 318 } else { |
| 316 swMsg = params[0].ToCFXWideString(); | 319 swMsg = params[0].ToCFXWideString(); |
| 317 swTitle = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSALERT); | 320 swTitle = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSALERT); |
| 318 } | 321 } |
| 319 } else { | 322 } else { |
| 320 if (params[0].GetType() == VT_boolean) { | 323 if (params[0].GetType() == CJS_Value::VT_boolean) { |
| 321 FX_BOOL bGet = params[0].ToBool(); | 324 FX_BOOL bGet = params[0].ToBool(); |
| 322 if (bGet) | 325 if (bGet) |
| 323 swMsg = L"true"; | 326 swMsg = L"true"; |
| 324 else | 327 else |
| 325 swMsg = L"false"; | 328 swMsg = L"false"; |
| 326 } else { | 329 } else { |
| 327 swMsg = params[0].ToCFXWideString(); | 330 swMsg = params[0].ToCFXWideString(); |
| 328 } | 331 } |
| 329 swTitle = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSALERT); | 332 swTitle = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSALERT); |
| 330 | 333 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 CJS_Timer* pTimer = new CJS_Timer(this, pApp); | 411 CJS_Timer* pTimer = new CJS_Timer(this, pApp); |
| 409 m_aTimer.Add(pTimer); | 412 m_aTimer.Add(pTimer); |
| 410 | 413 |
| 411 pTimer->SetType(0); | 414 pTimer->SetType(0); |
| 412 pTimer->SetRuntime(pRuntime); | 415 pTimer->SetRuntime(pRuntime); |
| 413 pTimer->SetJScript(script); | 416 pTimer->SetJScript(script); |
| 414 pTimer->SetTimeOut(0); | 417 pTimer->SetTimeOut(0); |
| 415 // pTimer->SetStartTime(GetTickCount()); | 418 // pTimer->SetStartTime(GetTickCount()); |
| 416 pTimer->SetJSTimer(dwInterval); | 419 pTimer->SetJSTimer(dwInterval); |
| 417 | 420 |
| 418 v8::Local<v8::Object> pRetObj = | 421 v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj( |
| 419 JS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext, | 422 pRuntime->GetIsolate(), pContext, |
| 420 JS_GetObjDefnID(pRuntime->GetIsolate(), L"TimerObj")); | 423 FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"TimerObj")); |
| 421 | 424 |
| 422 CJS_TimerObj* pJS_TimerObj = | 425 CJS_TimerObj* pJS_TimerObj = |
| 423 (CJS_TimerObj*)JS_GetPrivate(pRuntime->GetIsolate(), pRetObj); | 426 (CJS_TimerObj*)FXJS_GetPrivate(pRuntime->GetIsolate(), pRetObj); |
| 424 ASSERT(pJS_TimerObj != NULL); | 427 ASSERT(pJS_TimerObj != NULL); |
| 425 | 428 |
| 426 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); | 429 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); |
| 427 ASSERT(pTimerObj != NULL); | 430 ASSERT(pTimerObj != NULL); |
| 428 | 431 |
| 429 pTimerObj->SetTimer(pTimer); | 432 pTimerObj->SetTimer(pTimer); |
| 430 | 433 |
| 431 vRet = pRetObj; | 434 vRet = pRetObj; |
| 432 | 435 |
| 433 return TRUE; | 436 return TRUE; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 461 | 464 |
| 462 CJS_Timer* pTimer = new CJS_Timer(this, pApp); | 465 CJS_Timer* pTimer = new CJS_Timer(this, pApp); |
| 463 m_aTimer.Add(pTimer); | 466 m_aTimer.Add(pTimer); |
| 464 | 467 |
| 465 pTimer->SetType(1); | 468 pTimer->SetType(1); |
| 466 pTimer->SetRuntime(pRuntime); | 469 pTimer->SetRuntime(pRuntime); |
| 467 pTimer->SetJScript(script); | 470 pTimer->SetJScript(script); |
| 468 pTimer->SetTimeOut(dwTimeOut); | 471 pTimer->SetTimeOut(dwTimeOut); |
| 469 pTimer->SetJSTimer(dwTimeOut); | 472 pTimer->SetJSTimer(dwTimeOut); |
| 470 | 473 |
| 471 v8::Local<v8::Object> pRetObj = | 474 v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj( |
| 472 JS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext, | 475 pRuntime->GetIsolate(), pContext, |
| 473 JS_GetObjDefnID(pRuntime->GetIsolate(), L"TimerObj")); | 476 FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"TimerObj")); |
| 474 | 477 |
| 475 CJS_TimerObj* pJS_TimerObj = | 478 CJS_TimerObj* pJS_TimerObj = |
| 476 (CJS_TimerObj*)JS_GetPrivate(pRuntime->GetIsolate(), pRetObj); | 479 (CJS_TimerObj*)FXJS_GetPrivate(pRuntime->GetIsolate(), pRetObj); |
| 477 ASSERT(pJS_TimerObj != NULL); | 480 ASSERT(pJS_TimerObj != NULL); |
| 478 | 481 |
| 479 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); | 482 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); |
| 480 ASSERT(pTimerObj != NULL); | 483 ASSERT(pTimerObj != NULL); |
| 481 | 484 |
| 482 pTimerObj->SetTimer(pTimer); | 485 pTimerObj->SetTimer(pTimer); |
| 483 | 486 |
| 484 vRet = pRetObj; | 487 vRet = pRetObj; |
| 485 | 488 |
| 486 return TRUE; | 489 return TRUE; |
| 487 } | 490 } |
| 488 | 491 |
| 489 FX_BOOL app::clearTimeOut(IFXJS_Context* cc, | 492 FX_BOOL app::clearTimeOut(IFXJS_Context* cc, |
| 490 const CJS_Parameters& params, | 493 const CJS_Parameters& params, |
| 491 CJS_Value& vRet, | 494 CJS_Value& vRet, |
| 492 CFX_WideString& sError) { | 495 CFX_WideString& sError) { |
| 493 CJS_Context* pContext = (CJS_Context*)cc; | 496 CJS_Context* pContext = (CJS_Context*)cc; |
| 494 ASSERT(pContext != NULL); | 497 ASSERT(pContext != NULL); |
| 495 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 498 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 496 ASSERT(pRuntime != NULL); | 499 ASSERT(pRuntime != NULL); |
| 497 | 500 |
| 498 if (params.size() != 1) { | 501 if (params.size() != 1) { |
| 499 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAMERROR); | 502 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAMERROR); |
| 500 return FALSE; | 503 return FALSE; |
| 501 } | 504 } |
| 502 | 505 |
| 503 if (params[0].GetType() == VT_fxobject) { | 506 if (params[0].GetType() == CJS_Value::VT_fxobject) { |
| 504 v8::Local<v8::Object> pObj = params[0].ToV8Object(); | 507 v8::Local<v8::Object> pObj = params[0].ToV8Object(); |
| 505 { | 508 { |
| 506 if (JS_GetObjDefnID(pObj) == | 509 if (FXJS_GetObjDefnID(pObj) == |
| 507 JS_GetObjDefnID(pRuntime->GetIsolate(), L"TimerObj")) { | 510 FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"TimerObj")) { |
| 508 if (CJS_Object* pJSObj = params[0].ToCJSObject()) { | 511 if (CJS_Object* pJSObj = params[0].ToCJSObject()) { |
| 509 if (TimerObj* pTimerObj = (TimerObj*)pJSObj->GetEmbedObject()) { | 512 if (TimerObj* pTimerObj = (TimerObj*)pJSObj->GetEmbedObject()) { |
| 510 if (CJS_Timer* pTimer = pTimerObj->GetTimer()) { | 513 if (CJS_Timer* pTimer = pTimerObj->GetTimer()) { |
| 511 pTimer->KillJSTimer(); | 514 pTimer->KillJSTimer(); |
| 512 | 515 |
| 513 for (int i = 0, sz = m_aTimer.GetSize(); i < sz; i++) { | 516 for (int i = 0, sz = m_aTimer.GetSize(); i < sz; i++) { |
| 514 if (m_aTimer[i] == pTimer) { | 517 if (m_aTimer[i] == pTimer) { |
| 515 m_aTimer.RemoveAt(i); | 518 m_aTimer.RemoveAt(i); |
| 516 break; | 519 break; |
| 517 } | 520 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 536 CJS_Context* pContext = (CJS_Context*)cc; | 539 CJS_Context* pContext = (CJS_Context*)cc; |
| 537 ASSERT(pContext != NULL); | 540 ASSERT(pContext != NULL); |
| 538 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 541 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 539 ASSERT(pRuntime != NULL); | 542 ASSERT(pRuntime != NULL); |
| 540 | 543 |
| 541 if (params.size() != 1) { | 544 if (params.size() != 1) { |
| 542 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAMERROR); | 545 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAMERROR); |
| 543 return FALSE; | 546 return FALSE; |
| 544 } | 547 } |
| 545 | 548 |
| 546 if (params[0].GetType() == VT_fxobject) { | 549 if (params[0].GetType() == CJS_Value::VT_fxobject) { |
| 547 v8::Local<v8::Object> pObj = params[0].ToV8Object(); | 550 v8::Local<v8::Object> pObj = params[0].ToV8Object(); |
| 548 { | 551 { |
| 549 if (JS_GetObjDefnID(pObj) == | 552 if (FXJS_GetObjDefnID(pObj) == |
| 550 JS_GetObjDefnID(pRuntime->GetIsolate(), L"TimerObj")) { | 553 FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"TimerObj")) { |
| 551 if (CJS_Object* pJSObj = params[0].ToCJSObject()) { | 554 if (CJS_Object* pJSObj = params[0].ToCJSObject()) { |
| 552 if (TimerObj* pTimerObj = (TimerObj*)pJSObj->GetEmbedObject()) { | 555 if (TimerObj* pTimerObj = (TimerObj*)pJSObj->GetEmbedObject()) { |
| 553 if (CJS_Timer* pTimer = pTimerObj->GetTimer()) { | 556 if (CJS_Timer* pTimer = pTimerObj->GetTimer()) { |
| 554 pTimer->KillJSTimer(); | 557 pTimer->KillJSTimer(); |
| 555 | 558 |
| 556 for (int i = 0, sz = m_aTimer.GetSize(); i < sz; i++) { | 559 for (int i = 0, sz = m_aTimer.GetSize(); i < sz; i++) { |
| 557 if (m_aTimer[i] == pTimer) { | 560 if (m_aTimer[i] == pTimer) { |
| 558 m_aTimer.RemoveAt(i); | 561 m_aTimer.RemoveAt(i); |
| 559 break; | 562 break; |
| 560 } | 563 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 FX_BOOL bUI = TRUE; | 637 FX_BOOL bUI = TRUE; |
| 635 CFX_WideString cTo = L""; | 638 CFX_WideString cTo = L""; |
| 636 CFX_WideString cCc = L""; | 639 CFX_WideString cCc = L""; |
| 637 CFX_WideString cBcc = L""; | 640 CFX_WideString cBcc = L""; |
| 638 CFX_WideString cSubject = L""; | 641 CFX_WideString cSubject = L""; |
| 639 CFX_WideString cMsg = L""; | 642 CFX_WideString cMsg = L""; |
| 640 | 643 |
| 641 if (params.size() < 1) | 644 if (params.size() < 1) |
| 642 return FALSE; | 645 return FALSE; |
| 643 | 646 |
| 644 if (params[0].GetType() == VT_object) { | 647 if (params[0].GetType() == CJS_Value::VT_object) { |
| 645 v8::Local<v8::Object> pObj = params[0].ToV8Object(); | 648 v8::Local<v8::Object> pObj = params[0].ToV8Object(); |
| 646 | 649 |
| 647 v8::Local<v8::Value> pValue = JS_GetObjectElement(isolate, pObj, L"bUI"); | 650 v8::Local<v8::Value> pValue = FXJS_GetObjectElement(isolate, pObj, L"bUI"); |
| 648 bUI = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToBool(); | 651 bUI = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToBool(); |
| 649 | 652 |
| 650 pValue = JS_GetObjectElement(isolate, pObj, L"cTo"); | 653 pValue = FXJS_GetObjectElement(isolate, pObj, L"cTo"); |
| 651 cTo = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 654 cTo = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 652 | 655 |
| 653 pValue = JS_GetObjectElement(isolate, pObj, L"cCc"); | 656 pValue = FXJS_GetObjectElement(isolate, pObj, L"cCc"); |
| 654 cCc = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 657 cCc = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 655 | 658 |
| 656 pValue = JS_GetObjectElement(isolate, pObj, L"cBcc"); | 659 pValue = FXJS_GetObjectElement(isolate, pObj, L"cBcc"); |
| 657 cBcc = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 660 cBcc = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 658 | 661 |
| 659 pValue = JS_GetObjectElement(isolate, pObj, L"cSubject"); | 662 pValue = FXJS_GetObjectElement(isolate, pObj, L"cSubject"); |
| 660 cSubject = | 663 cSubject = |
| 661 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 664 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 662 | 665 |
| 663 pValue = JS_GetObjectElement(isolate, pObj, L"cMsg"); | 666 pValue = FXJS_GetObjectElement(isolate, pObj, L"cMsg"); |
| 664 cMsg = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 667 cMsg = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 665 } else { | 668 } else { |
| 666 if (params.size() < 2) | 669 if (params.size() < 2) |
| 667 return FALSE; | 670 return FALSE; |
| 668 | 671 |
| 669 bUI = params[0].ToBool(); | 672 bUI = params[0].ToBool(); |
| 670 cTo = params[1].ToCFXWideString(); | 673 cTo = params[1].ToCFXWideString(); |
| 671 | 674 |
| 672 if (params.size() >= 3) | 675 if (params.size() >= 3) |
| 673 cCc = params[2].ToCFXWideString(); | 676 cCc = params[2].ToCFXWideString(); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 CFX_WideString& sError) { | 775 CFX_WideString& sError) { |
| 773 CFX_WideString swQuestion = L""; | 776 CFX_WideString swQuestion = L""; |
| 774 CFX_WideString swLabel = L""; | 777 CFX_WideString swLabel = L""; |
| 775 CFX_WideString swTitle = L"PDF"; | 778 CFX_WideString swTitle = L"PDF"; |
| 776 CFX_WideString swDefault = L""; | 779 CFX_WideString swDefault = L""; |
| 777 bool bPassWord = false; | 780 bool bPassWord = false; |
| 778 | 781 |
| 779 v8::Isolate* isolate = GetIsolate(cc); | 782 v8::Isolate* isolate = GetIsolate(cc); |
| 780 | 783 |
| 781 int iLength = params.size(); | 784 int iLength = params.size(); |
| 782 if (iLength > 0 && params[0].GetType() == VT_object) { | 785 if (iLength > 0 && params[0].GetType() == CJS_Value::VT_object) { |
| 783 v8::Local<v8::Object> pObj = params[0].ToV8Object(); | 786 v8::Local<v8::Object> pObj = params[0].ToV8Object(); |
| 784 v8::Local<v8::Value> pValue = | 787 v8::Local<v8::Value> pValue = |
| 785 JS_GetObjectElement(isolate, pObj, L"cQuestion"); | 788 FXJS_GetObjectElement(isolate, pObj, L"cQuestion"); |
| 786 swQuestion = | 789 swQuestion = |
| 787 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 790 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 788 | 791 |
| 789 pValue = JS_GetObjectElement(isolate, pObj, L"cTitle"); | 792 pValue = FXJS_GetObjectElement(isolate, pObj, L"cTitle"); |
| 790 swTitle = | 793 swTitle = |
| 791 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 794 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 792 | 795 |
| 793 pValue = JS_GetObjectElement(isolate, pObj, L"cDefault"); | 796 pValue = FXJS_GetObjectElement(isolate, pObj, L"cDefault"); |
| 794 swDefault = | 797 swDefault = |
| 795 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 798 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 796 | 799 |
| 797 pValue = JS_GetObjectElement(isolate, pObj, L"cLabel"); | 800 pValue = FXJS_GetObjectElement(isolate, pObj, L"cLabel"); |
| 798 swLabel = | 801 swLabel = |
| 799 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 802 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 800 | 803 |
| 801 pValue = JS_GetObjectElement(isolate, pObj, L"bPassword"); | 804 pValue = FXJS_GetObjectElement(isolate, pObj, L"bPassword"); |
| 802 bPassWord = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToBool(); | 805 bPassWord = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToBool(); |
| 803 } else { | 806 } else { |
| 804 switch (iLength) { | 807 switch (iLength) { |
| 805 case 5: | 808 case 5: |
| 806 swLabel = params[4].ToCFXWideString(); | 809 swLabel = params[4].ToCFXWideString(); |
| 807 // FALLTHROUGH | 810 // FALLTHROUGH |
| 808 case 4: | 811 case 4: |
| 809 bPassWord = params[3].ToBool(); | 812 bPassWord = params[3].ToBool(); |
| 810 // FALLTHROUGH | 813 // FALLTHROUGH |
| 811 case 3: | 814 case 3: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 CFX_WideString& sError) { | 854 CFX_WideString& sError) { |
| 852 return FALSE; | 855 return FALSE; |
| 853 } | 856 } |
| 854 | 857 |
| 855 FX_BOOL app::execDialog(IFXJS_Context* cc, | 858 FX_BOOL app::execDialog(IFXJS_Context* cc, |
| 856 const CJS_Parameters& params, | 859 const CJS_Parameters& params, |
| 857 CJS_Value& vRet, | 860 CJS_Value& vRet, |
| 858 CFX_WideString& sError) { | 861 CFX_WideString& sError) { |
| 859 return TRUE; | 862 return TRUE; |
| 860 } | 863 } |
| OLD | NEW |