summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/app.cpp
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2015-12-02 13:20:03 +0800
committerJun Fang <jun_fang@foxitsoftware.com>2015-12-02 13:20:03 +0800
commit487d1a90a0902de675261f27f8186c84440ca573 (patch)
tree651f856249e7a2b4b2b4c3bcaa160537bc663da7 /fpdfsdk/src/javascript/app.cpp
parent7d1578a9ac083bf186dc3297885bfc56fdb78540 (diff)
downloadpdfium-487d1a90a0902de675261f27f8186c84440ca573.tar.xz
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 .
Diffstat (limited to 'fpdfsdk/src/javascript/app.cpp')
-rw-r--r--fpdfsdk/src/javascript/app.cpp15
1 files changed, 11 insertions, 4 deletions
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<CJS_Context*>(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