summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2014-08-13 11:03:19 -0700
committerBo Xu <bo_xu@foxitsoftware.com>2014-08-13 11:03:19 -0700
commitd4e406e254b5a60e58ff2fcc12b59bef7e436e74 (patch)
tree4e00632c4ba0efc86d4adce4cb774f5fe4adb943 /fpdfsdk/src/javascript
parentd38a35ec7416a884de964014691777110093a931 (diff)
downloadpdfium-d4e406e254b5a60e58ff2fcc12b59bef7e436e74.tar.xz
Remove try/catch block
BUG=pdfium:28 R=thakis@chromium.org Review URL: https://codereview.chromium.org/472563002
Diffstat (limited to 'fpdfsdk/src/javascript')
-rw-r--r--fpdfsdk/src/javascript/JS_Context.cpp43
1 files changed, 17 insertions, 26 deletions
diff --git a/fpdfsdk/src/javascript/JS_Context.cpp b/fpdfsdk/src/javascript/JS_Context.cpp
index e34ffb51ba..a83e1e057d 100644
--- a/fpdfsdk/src/javascript/JS_Context.cpp
+++ b/fpdfsdk/src/javascript/JS_Context.cpp
@@ -68,41 +68,32 @@ FX_BOOL CJS_Context::DoJob(int nMode, const CFX_WideString& script, CFX_WideStri
FXJSErr error ={NULL,NULL, 0};
int nRet = 0;
- try
- {
- if (script.GetLength() > 0)
+ if (script.GetLength() > 0)
+ {
+ if (nMode == 0)
{
- if (nMode == 0)
- {
- nRet = JS_Execute(*m_pRuntime, this, script, script.GetLength(), &error);
- }
- else
- {
- nRet = JS_Parse(*m_pRuntime, this, script, script.GetLength(), &error);
- }
+ nRet = JS_Execute(*m_pRuntime, this, script, script.GetLength(), &error);
}
-
- if (nRet < 0)
+ else
{
- CFX_WideString sLine;
- sLine.Format((FX_LPCWSTR)L"[ Line: %05d { %s } ] : %s",error.linnum-1,error.srcline,error.message);
+ nRet = JS_Parse(*m_pRuntime, this, script, script.GetLength(), &error);
+ }
+ }
+
+ if (nRet < 0)
+ {
+ CFX_WideString sLine;
+ sLine.Format((FX_LPCWSTR)L"[ Line: %05d { %s } ] : %s",error.linnum-1,error.srcline,error.message);
// TRACE(L"/* -------------- JS Error -------------- */\n");
// TRACE(sLine);
// TRACE(L"\n");
- //CFX_ByteString sTemp = CFX_ByteString::FromUnicode(error.message);
- info += sLine;
- }
- else
- {
- info = JSGetStringFromID(this, IDS_STRING_RUN);
- }
-
+ //CFX_ByteString sTemp = CFX_ByteString::FromUnicode(error.message);
+ info += sLine;
}
- catch (...)
+ else
{
- info = JSGetStringFromID(this, IDS_STRING_UNHANDLED);
- nRet = -1;
+ info = JSGetStringFromID(this, IDS_STRING_RUN);
}
m_pRuntime->RemoveEventInLoop(m_pEventHandler->TargetName(), m_pEventHandler->EventType());