From a0217b66d6fb4980bff16167093bc2a79f71bcec Mon Sep 17 00:00:00 2001 From: Jun Fang Date: Wed, 2 Dec 2015 13:57:18 +0800 Subject: 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 . --- fpdfsdk/src/javascript/app.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'fpdfsdk/src') 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(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, -- cgit v1.2.3