summaryrefslogtreecommitdiff
path: root/fxjs/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs/xfa')
-rw-r--r--fxjs/xfa/cjx_object.cpp20
-rw-r--r--fxjs/xfa/cjx_object.h2
2 files changed, 8 insertions, 14 deletions
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index 23e754d4b7..8684212ce2 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -178,9 +178,8 @@ CJS_Return CJX_Object::RunMethod(
}
void CJX_Object::ThrowTooManyOccurancesException(const WideString& obj) const {
- ThrowException(
- L"The element [%ls] has violated its allowable number of occurrences.",
- obj.c_str());
+ ThrowException(L"The element [" + obj +
+ L"] has violated its allowable number of occurrences.");
}
void CJX_Object::ThrowInvalidPropertyException() const {
@@ -193,22 +192,17 @@ void CJX_Object::ThrowIndexOutOfBoundsException() const {
void CJX_Object::ThrowParamCountMismatchException(
const WideString& method) const {
- ThrowException(L"Incorrect number of parameters calling method '%ls'.",
- method.c_str());
+ ThrowException(L"Incorrect number of parameters calling method '" + method +
+ L"'.");
}
void CJX_Object::ThrowArgumentMismatchException() const {
ThrowException(L"Argument mismatch in property or function argument.");
}
-void CJX_Object::ThrowException(const wchar_t* str, ...) const {
- va_list arg_ptr;
- va_start(arg_ptr, str);
- WideString wsMessage = WideString::FormatV(str, arg_ptr);
- va_end(arg_ptr);
-
- ASSERT(!wsMessage.IsEmpty());
- FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringView());
+void CJX_Object::ThrowException(const WideString& str) const {
+ ASSERT(!str.IsEmpty());
+ FXJSE_ThrowMessage(str.UTF8Encode().AsStringView());
}
bool CJX_Object::HasAttribute(XFA_Attribute eAttr) {
diff --git a/fxjs/xfa/cjx_object.h b/fxjs/xfa/cjx_object.h
index c9042b5049..4116f378ca 100644
--- a/fxjs/xfa/cjx_object.h
+++ b/fxjs/xfa/cjx_object.h
@@ -222,7 +222,7 @@ class CJX_Object {
void DefineMethods(pdfium::span<const CJX_MethodSpec> methods);
void MoveBufferMapData(CXFA_Object* pSrcModule, CXFA_Object* pDstModule);
void SetMapModuleString(void* pKey, const WideStringView& wsValue);
- void ThrowException(const wchar_t* str, ...) const;
+ void ThrowException(const WideString& str) const;
private:
void Script_Boolean_DefaultValue(CFXJSE_Value* pValue,