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 "Document.h" | 9 #include "Document.h" |
10 #include "JS_Context.h" | 10 #include "JS_Context.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 } | 210 } |
211 | 211 |
212 #endif | 212 #endif |
213 vp << JS_NUM_VIEWERVERSION; | 213 vp << JS_NUM_VIEWERVERSION; |
214 return TRUE; | 214 return TRUE; |
215 } | 215 } |
216 | 216 |
217 FX_BOOL app::platform(IJS_Context* cc, | 217 FX_BOOL app::platform(IJS_Context* cc, |
218 CJS_PropValue& vp, | 218 CJS_PropValue& vp, |
219 CFX_WideString& sError) { | 219 CFX_WideString& sError) { |
220 if (vp.IsGetting()) { | 220 if (!vp.IsGetting()) |
221 return FALSE; | |
222 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | |
223 if (!pContext) | |
Tom Sepez
2015/11/30 17:17:32
Can these ever be NULL?
jun_fang
2015/12/01 10:53:30
pContext is passed from v8. It shouldn't be nullpt
| |
224 return FALSE; | |
225 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | |
226 if (!pRuntime) | |
jun_fang
2015/12/01 10:53:30
pRuntime shouldn't be nullptr either.
| |
227 return FALSE; | |
228 CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp(); | |
229 if (!pEnv) | |
jun_fang
2015/12/01 10:53:30
pEnv can be nullptr.
| |
230 return FALSE; | |
231 CFX_WideString platfrom = pEnv->FFI_GetPlatform(); | |
232 if (platfrom.IsEmpty()) | |
221 vp << JS_STR_PLATFORM; | 233 vp << JS_STR_PLATFORM; |
222 return TRUE; | 234 else |
223 } | 235 vp << platfrom; |
224 | 236 return TRUE; |
225 return FALSE; | |
226 } | 237 } |
227 | 238 |
228 FX_BOOL app::language(IJS_Context* cc, | 239 FX_BOOL app::language(IJS_Context* cc, |
229 CJS_PropValue& vp, | 240 CJS_PropValue& vp, |
230 CFX_WideString& sError) { | 241 CFX_WideString& sError) { |
231 if (vp.IsGetting()) { | 242 if (vp.IsGetting()) { |
232 vp << JS_STR_LANGUANGE; | 243 vp << JS_STR_LANGUANGE; |
233 return TRUE; | 244 return TRUE; |
234 } | 245 } |
235 | 246 |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
814 FX_BOOL app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { | 825 FX_BOOL app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { |
815 return FALSE; | 826 return FALSE; |
816 } | 827 } |
817 | 828 |
818 FX_BOOL app::execDialog(IJS_Context* cc, | 829 FX_BOOL app::execDialog(IJS_Context* cc, |
819 const std::vector<CJS_Value>& params, | 830 const std::vector<CJS_Value>& params, |
820 CJS_Value& vRet, | 831 CJS_Value& vRet, |
821 CFX_WideString& sError) { | 832 CFX_WideString& sError) { |
822 return TRUE; | 833 return TRUE; |
823 } | 834 } |
OLD | NEW |