summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2015-12-02 13:57:18 +0800
committerJun Fang <jun_fang@foxitsoftware.com>2015-12-02 13:57:18 +0800
commita0217b66d6fb4980bff16167093bc2a79f71bcec (patch)
treeb2b1fa57a8f5592aa72832905842540fb31e0dd2
parent487d1a90a0902de675261f27f8186c84440ca573 (diff)
downloadpdfium-a0217b66d6fb4980bff16167093bc2a79f71bcec.tar.xz
Fix the issue that no response from the call back function of FFI_GetPlatform()
BUG=pdfium:293 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1486583002 .
-rw-r--r--fpdfsdk/src/javascript/app.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp
index ab4c777d2b..f195ae70bb 100644
--- a/fpdfsdk/src/javascript/app.cpp
+++ b/fpdfsdk/src/javascript/app.cpp
@@ -217,12 +217,18 @@ 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;
+ CPDFDoc_Environment* pEnv =
+ static_cast<CJS_Context*>(cc)->GetJSRuntime()->GetReaderApp();
+ if (!pEnv)
+ 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,