Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Unified Diff: fpdfsdk/src/javascript/app.cpp

Issue 1486583002: Fix the issue that no response from the call back function of FFI_GetPlatform() (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/app.cpp
diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp
index d18e0322abff79c17035657eb85f9a354cc11913..3f1a3b7648079be629f5150d9bb7be0411ba926c 100644
--- a/fpdfsdk/src/javascript/app.cpp
+++ b/fpdfsdk/src/javascript/app.cpp
@@ -217,12 +217,23 @@ FX_BOOL app::viewerVersion(IJS_Context* cc,
FX_BOOL app::platform(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- if (vp.IsGetting()) {
+ if (!vp.IsGetting())
+ return FALSE;
+ CJS_Context* pContext = static_cast<CJS_Context*>(cc);
+ 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
+ return FALSE;
+ CJS_Runtime* pRuntime = pContext->GetJSRuntime();
+ if (!pRuntime)
jun_fang 2015/12/01 10:53:30 pRuntime shouldn't be nullptr either.
+ return FALSE;
+ CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp();
+ if (!pEnv)
jun_fang 2015/12/01 10:53:30 pEnv can be nullptr.
+ return FALSE;
+ CFX_WideString platfrom = pEnv->FFI_GetPlatform();
+ if (platfrom.IsEmpty())
vp << JS_STR_PLATFORM;
- return TRUE;
- }
-
- return FALSE;
+ else
+ vp << platfrom;
+ return TRUE;
}
FX_BOOL app::language(IJS_Context* cc,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698