summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fm2js
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/fm2js')
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jscontext.cpp30
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jscontext.h3
-rw-r--r--xfa/fxfa/fm2js/xfa_program.h2
3 files changed, 15 insertions, 20 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;