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/fm2js/xfa_fm2jscontext.cpp | |
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/fm2js/xfa_fm2jscontext.cpp')
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 30 |
1 files changed, 14 insertions, 16 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; } |