summaryrefslogtreecommitdiff
path: root/fxjs
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs')
-rw-r--r--fxjs/cfxjse_formcalc_context_embeddertest.cpp14
-rw-r--r--fxjs/xfa/cjx_eventpseudomodel.cpp7
2 files changed, 21 insertions, 0 deletions
diff --git a/fxjs/cfxjse_formcalc_context_embeddertest.cpp b/fxjs/cfxjse_formcalc_context_embeddertest.cpp
index a32f988d06..8d1bb36b3d 100644
--- a/fxjs/cfxjse_formcalc_context_embeddertest.cpp
+++ b/fxjs/cfxjse_formcalc_context_embeddertest.cpp
@@ -1486,3 +1486,17 @@ TEST_F(CFXJSE_FormCalcContextEmbedderTest, SetXFAEventChange) {
EXPECT_TRUE(Execute(test));
EXPECT_EQ(L"changed", context->GetEventParam()->m_wsChange);
}
+
+TEST_F(CFXJSE_FormCalcContextEmbedderTest, SetXFAEventFullTextFails) {
+ ASSERT_TRUE(OpenDocument("simple_xfa.pdf"));
+
+ CXFA_EventParam params;
+ params.m_wsFullText = L"Original Full Text";
+
+ CFXJSE_Engine* context = GetScriptContext();
+ context->SetEventParam(params);
+
+ const char test[] = {"xfa.event.fullText = \"Changed Full Text\""};
+ EXPECT_TRUE(Execute(test));
+ EXPECT_EQ(L"Original Full Text", context->GetEventParam()->m_wsFullText);
+}
diff --git a/fxjs/xfa/cjx_eventpseudomodel.cpp b/fxjs/xfa/cjx_eventpseudomodel.cpp
index e652acb3e2..a6a876d81b 100644
--- a/fxjs/xfa/cjx_eventpseudomodel.cpp
+++ b/fxjs/xfa/cjx_eventpseudomodel.cpp
@@ -192,6 +192,13 @@ CJS_Return CJX_EventPseudoModel::reset(
void CJX_EventPseudoModel::Property(CFXJSE_Value* pValue,
XFA_Event dwFlag,
bool bSetting) {
+ // Only the cancelAction, selStart, selEnd and change properties are writable.
+ if (bSetting && dwFlag != XFA_Event::CancelAction &&
+ dwFlag != XFA_Event::SelectionStart &&
+ dwFlag != XFA_Event::SelectionEnd && dwFlag != XFA_Event::Change) {
+ return;
+ }
+
CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
if (!pScriptContext)
return;