diff options
author | Lei Zhang <thestig@chromium.org> | 2017-05-10 13:38:20 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-10 20:51:35 +0000 |
commit | 6f62ccd50ff85ba6a60ddf47993745739854cd8f (patch) | |
tree | 31ccdd4107b9e20939f92179f7a4f8a4d2d025d4 /xfa/fxfa | |
parent | 5b590337e0778b49dd7092af4a283ed0f9c5a2e9 (diff) | |
download | pdfium-6f62ccd50ff85ba6a60ddf47993745739854cd8f.tar.xz |
Check CXFA_FM2JSContext::Translate() return value.
Remove not useful error parameter.
Change-Id: I6f49a51a47c9d7f45e75a585679e15f0414aac26
Reviewed-on: https://pdfium-review.googlesource.com/5254
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 30 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.h | 3 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_program.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_scriptcontext.cpp | 5 |
4 files changed, 16 insertions, 24 deletions
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 172c234aca..8879b94373 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -2778,10 +2778,13 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, } CFX_WideTextBuf wsJavaScriptBuf; - CFX_WideString wsError; - CXFA_FM2JSContext::Translate( - CFX_WideString::FromUTF8(utf8ScriptString.AsStringC()).AsStringC(), - wsJavaScriptBuf, wsError); + if (CXFA_FM2JSContext::Translate( + CFX_WideString::FromUTF8(utf8ScriptString.AsStringC()).AsStringC(), + &wsJavaScriptBuf)) { + pContext->ThrowCompilerErrorException(); + return; + } + std::unique_ptr<CFXJSE_Context> pNewContext( CFXJSE_Context::Create(pIsolate, nullptr, nullptr)); @@ -5430,10 +5433,8 @@ void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis, CFX_WideString scriptString = CFX_WideString::FromUTF8(argString.AsStringC()); CFX_WideTextBuf wsJavaScriptBuf; - CFX_WideString wsError; - CXFA_FM2JSContext::Translate(scriptString.AsStringC(), wsJavaScriptBuf, - wsError); - if (!wsError.IsEmpty()) { + if (CXFA_FM2JSContext::Translate(scriptString.AsStringC(), + &wsJavaScriptBuf)) { pContext->ThrowCompilerErrorException(); return; } @@ -6112,20 +6113,17 @@ CFX_ByteString CXFA_FM2JSContext::ValueToUTF8String(CFXJSE_Value* arg) { // static. int32_t CXFA_FM2JSContext::Translate(const CFX_WideStringC& wsFormcalc, - CFX_WideTextBuf& wsJavascript, - CFX_WideString& wsError) { + CFX_WideTextBuf* wsJavascript) { if (wsFormcalc.IsEmpty()) { - wsJavascript.Clear(); - wsError.clear(); + wsJavascript->Clear(); return 0; } CXFA_FMProgram program(wsFormcalc); int32_t status = program.ParseProgram(); - if (status) { - wsError = program.GetError().message; + if (status) return status; - } - program.TranslateProgram(wsJavascript); + + program.TranslateProgram(*wsJavascript); return 0; } diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.h b/xfa/fxfa/fm2js/xfa_fm2jscontext.h index 33f739f1cc..bde185d28c 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.h +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.h @@ -428,8 +428,7 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { bool* ret); static int32_t Translate(const CFX_WideStringC& wsFormcalc, - CFX_WideTextBuf& wsJavascript, - CFX_WideString& wsError); + CFX_WideTextBuf* wsJavascript); void GlobalPropertyGetter(CFXJSE_Value* pValue); diff --git a/xfa/fxfa/fm2js/xfa_program.h b/xfa/fxfa/fm2js/xfa_program.h index 7a2dade6fd..a00a5037da 100644 --- a/xfa/fxfa/fm2js/xfa_program.h +++ b/xfa/fxfa/fm2js/xfa_program.h @@ -20,8 +20,6 @@ class CXFA_FMProgram { int32_t ParseProgram(); int32_t TranslateProgram(CFX_WideTextBuf& wsJavaScript); - const CXFA_FMErrorInfo& GetError() const { return m_pErrorInfo; } - private: CXFA_FMErrorInfo m_pErrorInfo; CXFA_FMParse m_parse; diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp index e7697f5fab..a3aed388be 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp +++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp @@ -153,10 +153,7 @@ bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, m_pIsolate, m_JsContext.get(), m_pDocument); } CFX_WideTextBuf wsJavaScript; - CFX_WideString wsErrorInfo; - int32_t iFlags = - CXFA_FM2JSContext::Translate(wsScript, wsJavaScript, wsErrorInfo); - if (iFlags) { + if (CXFA_FM2JSContext::Translate(wsScript, &wsJavaScript)) { hRetValue->SetUndefined(); return false; } |