summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/app.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-08-08 13:03:16 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-08 13:03:16 -0700
commite1e7bd037538c6b31537fc0e3e01c508dab68132 (patch)
tree96ef5d14b8c889ab3a59a259f6ef585cef0e57eb /fpdfsdk/javascript/app.cpp
parente3ff76b11ac6fcd0d0196ef83946d2321ab8e9bf (diff)
downloadpdfium-e1e7bd037538c6b31537fc0e3e01c508dab68132.tar.xz
Remove MsgBox()/Alert() from CJS_EmbedObj.
They're only related to the |app| object, not all embed's. Alert() itself unused. Review-Url: https://codereview.chromium.org/2224073002
Diffstat (limited to 'fpdfsdk/javascript/app.cpp')
-rw-r--r--fpdfsdk/javascript/app.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp
index 755652d219..50afd9a6c4 100644
--- a/fpdfsdk/javascript/app.cpp
+++ b/fpdfsdk/javascript/app.cpp
@@ -403,6 +403,12 @@ FX_BOOL app::alert(IJS_Context* cc,
return FALSE;
}
+ CPDFDoc_Environment* pApp = pRuntime->GetReaderApp();
+ if (!pApp) {
+ vRet = 0;
+ return TRUE;
+ }
+
CFX_WideString swMsg;
if (newParams[0].GetType() == CJS_Value::VT_object) {
CJS_Array carray;
@@ -438,8 +444,10 @@ FX_BOOL app::alert(IJS_Context* cc,
swTitle = JSGetStringFromID(pContext, IDS_STRING_JSALERT);
pRuntime->BeginBlock();
- vRet = MsgBox(pRuntime->GetReaderApp(), swMsg.c_str(), swTitle.c_str(), iType,
- iIcon);
+ if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument())
+ pDoc->KillFocusAnnot();
+
+ vRet = pApp->JS_appAlert(swMsg.c_str(), swTitle.c_str(), iType, iIcon);
pRuntime->EndBlock();
return TRUE;
}