From 487d1a90a0902de675261f27f8186c84440ca573 Mon Sep 17 00:00:00 2001 From: Jun Fang Date: Wed, 2 Dec 2015 13:20:03 +0800 Subject: Fix an issue that no response from the call back function of FFI_GetLanguage() BUG=pdfium:295 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1482253002 . --- fpdfsdk/src/javascript/app.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'fpdfsdk/src/javascript') diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp index 009e03b002..ab4c777d2b 100644 --- a/fpdfsdk/src/javascript/app.cpp +++ b/fpdfsdk/src/javascript/app.cpp @@ -228,12 +228,19 @@ FX_BOOL app::platform(IJS_Context* cc, FX_BOOL app::language(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 language = pEnv->FFI_GetLanguage(); + if (language.IsEmpty()) vp << JS_STR_LANGUANGE; - return TRUE; - } + else + vp << language; - return FALSE; + return TRUE; } // creates a new fdf object that contains no data -- cgit v1.2.3