From e1e7bd037538c6b31537fc0e3e01c508dab68132 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 8 Aug 2016 13:03:16 -0700 Subject: 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 --- fpdfsdk/javascript/app.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'fpdfsdk/javascript/app.cpp') 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; } -- cgit v1.2.3