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 "app.h" | 7 #include "app.h" |
8 | 8 |
9 #include "../../../third_party/base/nonstd_unique_ptr.h" | 9 #include "../../../third_party/base/nonstd_unique_ptr.h" |
10 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. | 10 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. |
11 #include "../../include/javascript/IJavaScript.h" | 11 #include "../../include/javascript/IJavaScript.h" |
12 #include "Document.h" | 12 #include "Document.h" |
13 #include "JS_Context.h" | 13 #include "JS_Context.h" |
14 #include "JS_Define.h" | 14 #include "JS_Define.h" |
15 #include "JS_EventHandler.h" | 15 #include "JS_EventHandler.h" |
16 #include "JS_Object.h" | 16 #include "JS_Object.h" |
17 #include "JS_Runtime.h" | 17 #include "JS_Runtime.h" |
18 #include "JS_Value.h" | 18 #include "JS_Value.h" |
19 #include "resource.h" | 19 #include "resource.h" |
20 | 20 |
21 static v8::Isolate* GetIsolate(IJS_Context* cc) { | |
22 CJS_Context* pContext = (CJS_Context*)cc; | |
23 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | |
24 return pRuntime->GetIsolate(); | |
25 } | |
26 | |
27 BEGIN_JS_STATIC_CONST(CJS_TimerObj) | 21 BEGIN_JS_STATIC_CONST(CJS_TimerObj) |
28 END_JS_STATIC_CONST() | 22 END_JS_STATIC_CONST() |
29 | 23 |
30 BEGIN_JS_STATIC_PROP(CJS_TimerObj) | 24 BEGIN_JS_STATIC_PROP(CJS_TimerObj) |
31 END_JS_STATIC_PROP() | 25 END_JS_STATIC_PROP() |
32 | 26 |
33 BEGIN_JS_STATIC_METHOD(CJS_TimerObj) | 27 BEGIN_JS_STATIC_METHOD(CJS_TimerObj) |
34 END_JS_STATIC_METHOD() | 28 END_JS_STATIC_METHOD() |
35 | 29 |
36 IMPLEMENT_JS_CLASS(CJS_TimerObj, TimerObj) | 30 IMPLEMENT_JS_CLASS(CJS_TimerObj, TimerObj) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 FX_BOOL app::activeDocs(IJS_Context* cc, | 107 FX_BOOL app::activeDocs(IJS_Context* cc, |
114 CJS_PropValue& vp, | 108 CJS_PropValue& vp, |
115 CFX_WideString& sError) { | 109 CFX_WideString& sError) { |
116 if (!vp.IsGetting()) | 110 if (!vp.IsGetting()) |
117 return FALSE; | 111 return FALSE; |
118 | 112 |
119 CJS_Context* pContext = (CJS_Context*)cc; | 113 CJS_Context* pContext = (CJS_Context*)cc; |
120 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); | 114 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); |
121 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 115 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
122 CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument(); | 116 CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument(); |
123 CJS_Array aDocs(pRuntime->GetIsolate()); | 117 CJS_Array aDocs(pRuntime); |
124 if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) { | 118 if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) { |
125 CJS_Document* pJSDocument = NULL; | 119 CJS_Document* pJSDocument = NULL; |
126 if (pDoc == pCurDoc) { | 120 if (pDoc == pCurDoc) { |
127 v8::Local<v8::Object> pObj = FXJS_GetThisObj(pRuntime->GetIsolate()); | 121 v8::Local<v8::Object> pObj = FXJS_GetThisObj(pRuntime->GetIsolate()); |
128 if (FXJS_GetObjDefnID(pObj) == CJS_Document::g_nObjDefnID) | 122 if (FXJS_GetObjDefnID(pObj) == CJS_Document::g_nObjDefnID) |
129 pJSDocument = | 123 pJSDocument = |
130 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); | 124 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); |
131 } else { | 125 } else { |
132 v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj( | 126 v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj( |
133 pRuntime->GetIsolate(), pContext, CJS_Document::g_nObjDefnID); | 127 pRuntime->GetIsolate(), pContext, CJS_Document::g_nObjDefnID); |
134 pJSDocument = | 128 pJSDocument = |
135 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); | 129 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); |
136 ASSERT(pJSDocument != NULL); | 130 ASSERT(pJSDocument != NULL); |
137 } | 131 } |
138 aDocs.SetElement(0, CJS_Value(pRuntime->GetIsolate(), pJSDocument)); | 132 aDocs.SetElement(0, CJS_Value(pRuntime, pJSDocument)); |
139 } | 133 } |
140 if (aDocs.GetLength() > 0) | 134 if (aDocs.GetLength() > 0) |
141 vp << aDocs; | 135 vp << aDocs; |
142 else | 136 else |
143 vp.SetNull(); | 137 vp.SetNull(); |
144 | 138 |
145 return TRUE; | 139 return TRUE; |
146 } | 140 } |
147 | 141 |
148 FX_BOOL app::calculate(IJS_Context* cc, | 142 FX_BOOL app::calculate(IJS_Context* cc, |
149 CJS_PropValue& vp, | 143 CJS_PropValue& vp, |
150 CFX_WideString& sError) { | 144 CFX_WideString& sError) { |
151 if (vp.IsSetting()) { | 145 if (vp.IsSetting()) { |
152 bool bVP; | 146 bool bVP; |
153 vp >> bVP; | 147 vp >> bVP; |
154 m_bCalculate = (FX_BOOL)bVP; | 148 m_bCalculate = (FX_BOOL)bVP; |
155 | 149 |
156 CJS_Context* pContext = (CJS_Context*)cc; | 150 CJS_Context* pContext = (CJS_Context*)cc; |
157 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); | 151 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); |
158 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 152 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
159 CJS_Array aDocs(pRuntime->GetIsolate()); | 153 CJS_Array aDocs(pRuntime); |
160 if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) | 154 if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) |
161 pDoc->GetInterForm()->EnableCalculate((FX_BOOL)m_bCalculate); | 155 pDoc->GetInterForm()->EnableCalculate((FX_BOOL)m_bCalculate); |
162 } else { | 156 } else { |
163 vp << (bool)m_bCalculate; | 157 vp << (bool)m_bCalculate; |
164 } | 158 } |
165 return TRUE; | 159 return TRUE; |
166 } | 160 } |
167 | 161 |
168 FX_BOOL app::formsVersion(IJS_Context* cc, | 162 FX_BOOL app::formsVersion(IJS_Context* cc, |
169 CJS_PropValue& vp, | 163 CJS_PropValue& vp, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 CFX_WideString& sError) { | 260 CFX_WideString& sError) { |
267 int iSize = params.size(); | 261 int iSize = params.size(); |
268 if (iSize < 1) | 262 if (iSize < 1) |
269 return FALSE; | 263 return FALSE; |
270 | 264 |
271 CFX_WideString swMsg = L""; | 265 CFX_WideString swMsg = L""; |
272 CFX_WideString swTitle = L""; | 266 CFX_WideString swTitle = L""; |
273 int iIcon = 0; | 267 int iIcon = 0; |
274 int iType = 0; | 268 int iType = 0; |
275 | 269 |
276 v8::Isolate* isolate = GetIsolate(cc); | 270 CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); |
| 271 v8::Isolate* isolate = pRuntime->GetIsolate(); |
277 | 272 |
278 if (iSize == 1) { | 273 if (iSize == 1) { |
279 if (params[0].GetType() == CJS_Value::VT_object) { | 274 if (params[0].GetType() == CJS_Value::VT_object) { |
280 v8::Local<v8::Object> pObj = params[0].ToV8Object(); | 275 v8::Local<v8::Object> pObj = params[0].ToV8Object(); |
281 { | 276 { |
282 v8::Local<v8::Value> pValue = | 277 v8::Local<v8::Value> pValue = |
283 FXJS_GetObjectElement(isolate, pObj, L"cMsg"); | 278 FXJS_GetObjectElement(isolate, pObj, L"cMsg"); |
284 swMsg = | 279 swMsg = CJS_Value(pRuntime, pValue, CJS_Value::VT_unknown) |
285 CJS_Value(isolate, pValue, CJS_Value::VT_unknown).ToCFXWideString(); | 280 .ToCFXWideString(); |
286 | 281 |
287 pValue = FXJS_GetObjectElement(isolate, pObj, L"cTitle"); | 282 pValue = FXJS_GetObjectElement(isolate, pObj, L"cTitle"); |
288 swTitle = | 283 swTitle = CJS_Value(pRuntime, pValue, CJS_Value::VT_unknown) |
289 CJS_Value(isolate, pValue, CJS_Value::VT_unknown).ToCFXWideString(); | 284 .ToCFXWideString(); |
290 | 285 |
291 pValue = FXJS_GetObjectElement(isolate, pObj, L"nIcon"); | 286 pValue = FXJS_GetObjectElement(isolate, pObj, L"nIcon"); |
292 iIcon = CJS_Value(isolate, pValue, CJS_Value::VT_unknown).ToInt(); | 287 iIcon = CJS_Value(pRuntime, pValue, CJS_Value::VT_unknown).ToInt(); |
293 | 288 |
294 pValue = FXJS_GetObjectElement(isolate, pObj, L"nType"); | 289 pValue = FXJS_GetObjectElement(isolate, pObj, L"nType"); |
295 iType = CJS_Value(isolate, pValue, CJS_Value::VT_unknown).ToInt(); | 290 iType = CJS_Value(pRuntime, pValue, CJS_Value::VT_unknown).ToInt(); |
296 } | 291 } |
297 | 292 |
298 if (swMsg == L"") { | 293 if (swMsg == L"") { |
299 CJS_Array carray(isolate); | 294 CJS_Array carray(pRuntime); |
300 if (params[0].ConvertToArray(carray)) { | 295 if (params[0].ConvertToArray(carray)) { |
301 int iLength = carray.GetLength(); | 296 int iLength = carray.GetLength(); |
302 CJS_Value* pValue = new CJS_Value(isolate); | 297 CJS_Value* pValue = new CJS_Value(pRuntime); |
303 for (int i = 0; i < iLength; ++i) { | 298 for (int i = 0; i < iLength; ++i) { |
304 carray.GetElement(i, *pValue); | 299 carray.GetElement(i, *pValue); |
305 swMsg += (*pValue).ToCFXWideString(); | 300 swMsg += (*pValue).ToCFXWideString(); |
306 if (i < iLength - 1) | 301 if (i < iLength - 1) |
307 swMsg += L", "; | 302 swMsg += L", "; |
308 } | 303 } |
309 | 304 |
310 delete pValue; | 305 delete pValue; |
311 } | 306 } |
312 } | 307 } |
(...skipping 27 matching lines...) Expand all Loading... |
340 for (int i = 1; i < iSize; i++) { | 335 for (int i = 1; i < iSize; i++) { |
341 if (i == 1) | 336 if (i == 1) |
342 iIcon = params[i].ToInt(); | 337 iIcon = params[i].ToInt(); |
343 if (i == 2) | 338 if (i == 2) |
344 iType = params[i].ToInt(); | 339 iType = params[i].ToInt(); |
345 if (i == 3) | 340 if (i == 3) |
346 swTitle = params[i].ToCFXWideString(); | 341 swTitle = params[i].ToCFXWideString(); |
347 } | 342 } |
348 } | 343 } |
349 | 344 |
350 CJS_Context* pContext = (CJS_Context*)cc; | |
351 ASSERT(pContext != NULL); | |
352 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | |
353 ASSERT(pRuntime != NULL); | |
354 pRuntime->BeginBlock(); | 345 pRuntime->BeginBlock(); |
355 vRet = MsgBox(pRuntime->GetReaderApp(), swMsg.c_str(), swTitle.c_str(), iType, | 346 vRet = MsgBox(pRuntime->GetReaderApp(), swMsg.c_str(), swTitle.c_str(), iType, |
356 iIcon); | 347 iIcon); |
357 pRuntime->EndBlock(); | 348 pRuntime->EndBlock(); |
358 | |
359 return TRUE; | 349 return TRUE; |
360 } | 350 } |
361 | 351 |
362 FX_BOOL app::beep(IJS_Context* cc, | 352 FX_BOOL app::beep(IJS_Context* cc, |
363 const CJS_Parameters& params, | 353 const CJS_Parameters& params, |
364 CJS_Value& vRet, | 354 CJS_Value& vRet, |
365 CFX_WideString& sError) { | 355 CFX_WideString& sError) { |
366 if (params.size() == 1) { | 356 if (params.size() == 1) { |
367 CJS_Context* pContext = (CJS_Context*)cc; | 357 CJS_Context* pContext = (CJS_Context*)cc; |
368 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 358 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 CJS_Value& vRet, | 585 CJS_Value& vRet, |
596 CFX_WideString& sError) { | 586 CFX_WideString& sError) { |
597 // Not supported. | 587 // Not supported. |
598 return TRUE; | 588 return TRUE; |
599 } | 589 } |
600 | 590 |
601 FX_BOOL app::mailMsg(IJS_Context* cc, | 591 FX_BOOL app::mailMsg(IJS_Context* cc, |
602 const CJS_Parameters& params, | 592 const CJS_Parameters& params, |
603 CJS_Value& vRet, | 593 CJS_Value& vRet, |
604 CFX_WideString& sError) { | 594 CFX_WideString& sError) { |
605 CJS_Context* pContext = (CJS_Context*)cc; | 595 if (params.size() < 1) |
606 v8::Isolate* isolate = GetIsolate(cc); | 596 return FALSE; |
607 | 597 |
608 FX_BOOL bUI = TRUE; | 598 FX_BOOL bUI = TRUE; |
609 CFX_WideString cTo = L""; | 599 CFX_WideString cTo = L""; |
610 CFX_WideString cCc = L""; | 600 CFX_WideString cCc = L""; |
611 CFX_WideString cBcc = L""; | 601 CFX_WideString cBcc = L""; |
612 CFX_WideString cSubject = L""; | 602 CFX_WideString cSubject = L""; |
613 CFX_WideString cMsg = L""; | 603 CFX_WideString cMsg = L""; |
614 | 604 |
615 if (params.size() < 1) | 605 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
616 return FALSE; | 606 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 607 v8::Isolate* isolate = pRuntime->GetIsolate(); |
617 | 608 |
618 if (params[0].GetType() == CJS_Value::VT_object) { | 609 if (params[0].GetType() == CJS_Value::VT_object) { |
619 v8::Local<v8::Object> pObj = params[0].ToV8Object(); | 610 v8::Local<v8::Object> pObj = params[0].ToV8Object(); |
620 | 611 |
621 v8::Local<v8::Value> pValue = FXJS_GetObjectElement(isolate, pObj, L"bUI"); | 612 v8::Local<v8::Value> pValue = FXJS_GetObjectElement(isolate, pObj, L"bUI"); |
622 bUI = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToBool(); | 613 bUI = CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToBool(); |
623 | 614 |
624 pValue = FXJS_GetObjectElement(isolate, pObj, L"cTo"); | 615 pValue = FXJS_GetObjectElement(isolate, pObj, L"cTo"); |
625 cTo = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 616 cTo = CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
626 | 617 |
627 pValue = FXJS_GetObjectElement(isolate, pObj, L"cCc"); | 618 pValue = FXJS_GetObjectElement(isolate, pObj, L"cCc"); |
628 cCc = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 619 cCc = CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
629 | 620 |
630 pValue = FXJS_GetObjectElement(isolate, pObj, L"cBcc"); | 621 pValue = FXJS_GetObjectElement(isolate, pObj, L"cBcc"); |
631 cBcc = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 622 cBcc = |
| 623 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
632 | 624 |
633 pValue = FXJS_GetObjectElement(isolate, pObj, L"cSubject"); | 625 pValue = FXJS_GetObjectElement(isolate, pObj, L"cSubject"); |
634 cSubject = | 626 cSubject = |
635 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 627 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
636 | 628 |
637 pValue = FXJS_GetObjectElement(isolate, pObj, L"cMsg"); | 629 pValue = FXJS_GetObjectElement(isolate, pObj, L"cMsg"); |
638 cMsg = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 630 cMsg = |
| 631 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
639 } else { | 632 } else { |
640 if (params.size() < 2) | 633 if (params.size() < 2) |
641 return FALSE; | 634 return FALSE; |
642 | 635 |
643 bUI = params[0].ToBool(); | 636 bUI = params[0].ToBool(); |
644 cTo = params[1].ToCFXWideString(); | 637 cTo = params[1].ToCFXWideString(); |
645 | 638 |
646 if (params.size() >= 3) | 639 if (params.size() >= 3) |
647 cCc = params[2].ToCFXWideString(); | 640 cCc = params[2].ToCFXWideString(); |
648 if (params.size() >= 4) | 641 if (params.size() >= 4) |
649 cBcc = params[3].ToCFXWideString(); | 642 cBcc = params[3].ToCFXWideString(); |
650 if (params.size() >= 5) | 643 if (params.size() >= 5) |
651 cSubject = params[4].ToCFXWideString(); | 644 cSubject = params[4].ToCFXWideString(); |
652 if (params.size() >= 6) | 645 if (params.size() >= 6) |
653 cMsg = params[5].ToCFXWideString(); | 646 cMsg = params[5].ToCFXWideString(); |
654 } | 647 } |
655 | 648 |
656 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | |
657 ASSERT(pRuntime != NULL); | |
658 | |
659 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); | |
660 ASSERT(pApp != NULL); | |
661 | |
662 pRuntime->BeginBlock(); | 649 pRuntime->BeginBlock(); |
663 pApp->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), | 650 pContext->GetReaderApp()->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), |
664 cBcc.c_str(), cMsg.c_str()); | 651 cSubject.c_str(), cCc.c_str(), |
| 652 cBcc.c_str(), cMsg.c_str()); |
665 pRuntime->EndBlock(); | 653 pRuntime->EndBlock(); |
666 | 654 |
667 return FALSE; | 655 return FALSE; |
668 } | 656 } |
669 | 657 |
670 FX_BOOL app::launchURL(IJS_Context* cc, | 658 FX_BOOL app::launchURL(IJS_Context* cc, |
671 const CJS_Parameters& params, | 659 const CJS_Parameters& params, |
672 CJS_Value& vRet, | 660 CJS_Value& vRet, |
673 CFX_WideString& sError) { | 661 CFX_WideString& sError) { |
674 // Unsafe, not supported. | 662 // Unsafe, not supported. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 FX_BOOL app::response(IJS_Context* cc, | 731 FX_BOOL app::response(IJS_Context* cc, |
744 const CJS_Parameters& params, | 732 const CJS_Parameters& params, |
745 CJS_Value& vRet, | 733 CJS_Value& vRet, |
746 CFX_WideString& sError) { | 734 CFX_WideString& sError) { |
747 CFX_WideString swQuestion = L""; | 735 CFX_WideString swQuestion = L""; |
748 CFX_WideString swLabel = L""; | 736 CFX_WideString swLabel = L""; |
749 CFX_WideString swTitle = L"PDF"; | 737 CFX_WideString swTitle = L"PDF"; |
750 CFX_WideString swDefault = L""; | 738 CFX_WideString swDefault = L""; |
751 bool bPassWord = false; | 739 bool bPassWord = false; |
752 | 740 |
753 v8::Isolate* isolate = GetIsolate(cc); | 741 CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); |
| 742 v8::Isolate* isolate = pRuntime->GetIsolate(); |
754 | 743 |
755 int iLength = params.size(); | 744 int iLength = params.size(); |
756 if (iLength > 0 && params[0].GetType() == CJS_Value::VT_object) { | 745 if (iLength > 0 && params[0].GetType() == CJS_Value::VT_object) { |
757 v8::Local<v8::Object> pObj = params[0].ToV8Object(); | 746 v8::Local<v8::Object> pObj = params[0].ToV8Object(); |
758 v8::Local<v8::Value> pValue = | 747 v8::Local<v8::Value> pValue = |
759 FXJS_GetObjectElement(isolate, pObj, L"cQuestion"); | 748 FXJS_GetObjectElement(isolate, pObj, L"cQuestion"); |
760 swQuestion = | 749 swQuestion = |
761 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 750 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
762 | 751 |
763 pValue = FXJS_GetObjectElement(isolate, pObj, L"cTitle"); | 752 pValue = FXJS_GetObjectElement(isolate, pObj, L"cTitle"); |
764 swTitle = | 753 swTitle = |
765 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 754 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
766 | 755 |
767 pValue = FXJS_GetObjectElement(isolate, pObj, L"cDefault"); | 756 pValue = FXJS_GetObjectElement(isolate, pObj, L"cDefault"); |
768 swDefault = | 757 swDefault = |
769 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 758 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
770 | 759 |
771 pValue = FXJS_GetObjectElement(isolate, pObj, L"cLabel"); | 760 pValue = FXJS_GetObjectElement(isolate, pObj, L"cLabel"); |
772 swLabel = | 761 swLabel = |
773 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 762 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
774 | 763 |
775 pValue = FXJS_GetObjectElement(isolate, pObj, L"bPassword"); | 764 pValue = FXJS_GetObjectElement(isolate, pObj, L"bPassword"); |
776 bPassWord = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToBool(); | 765 bPassWord = CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToBool(); |
777 } else { | 766 } else { |
778 switch (iLength) { | 767 switch (iLength) { |
779 case 5: | 768 case 5: |
780 swLabel = params[4].ToCFXWideString(); | 769 swLabel = params[4].ToCFXWideString(); |
781 // FALLTHROUGH | 770 // FALLTHROUGH |
782 case 4: | 771 case 4: |
783 bPassWord = params[3].ToBool(); | 772 bPassWord = params[3].ToBool(); |
784 // FALLTHROUGH | 773 // FALLTHROUGH |
785 case 3: | 774 case 3: |
786 swDefault = params[2].ToCFXWideString(); | 775 swDefault = params[2].ToCFXWideString(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 FX_BOOL app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { | 812 FX_BOOL app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { |
824 return FALSE; | 813 return FALSE; |
825 } | 814 } |
826 | 815 |
827 FX_BOOL app::execDialog(IJS_Context* cc, | 816 FX_BOOL app::execDialog(IJS_Context* cc, |
828 const CJS_Parameters& params, | 817 const CJS_Parameters& params, |
829 CJS_Value& vRet, | 818 CJS_Value& vRet, |
830 CFX_WideString& sError) { | 819 CFX_WideString& sError) { |
831 return TRUE; | 820 return TRUE; |
832 } | 821 } |
OLD | NEW |