summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_engine.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-05-25 15:05:04 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-25 15:05:04 +0000
commit08d9f6e3f0a68bae9eedb015458071e1481d28f4 (patch)
treeec942925c6cb9c8bb6fd98e16db3c7c5df1f6920 /fxjs/cfxjse_engine.cpp
parentbe0f656a8e61336cbe0089904c9bfb6e23521bce (diff)
downloadpdfium-08d9f6e3f0a68bae9eedb015458071e1481d28f4.tar.xz
[xfa] Allow accessing the event changed parameter from JS.
This CL updates the CFXJSE_Engine code to access the defined properties of a class if we fail to find the property in any other way. This fixes up an issue where we were unable to read the 'change' property of the CJX_EventPseudoModel because we could not find the 'change' property. Bug: 1066 Change-Id: I4ad205bc527beeca1c3e24a36cdde0c21287d9fb Reviewed-on: https://pdfium-review.googlesource.com/32930 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fxjs/cfxjse_engine.cpp')
-rw-r--r--fxjs/cfxjse_engine.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp
index f0c522f018..ff2bcc4618 100644
--- a/fxjs/cfxjse_engine.cpp
+++ b/fxjs/cfxjse_engine.cpp
@@ -325,6 +325,19 @@ void CFXJSE_Engine::NormalPropertyGetter(CFXJSE_Value* pOriginalValue,
if (pScriptObject) {
bRet = lpScriptContext->QueryVariableValue(ToNode(pScriptObject),
szPropName, pReturnValue, true);
+
+ if (!bRet) {
+ WideString wsPropName = WideString::FromUTF8(szPropName);
+ const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo =
+ XFA_GetScriptAttributeByName(pObject->GetElementType(),
+ wsPropName.AsStringView());
+ if (lpAttributeInfo) {
+ CJX_Object* jsObject = pObject->JSObject();
+ (jsObject->*(lpAttributeInfo->callback))(pReturnValue, false,
+ lpAttributeInfo->attribute);
+ return;
+ }
+ }
}
if (!bRet)
pReturnValue->SetUndefined();
@@ -510,6 +523,7 @@ bool CFXJSE_Engine::QueryVariableValue(CXFA_Node* pScriptNode,
pObject->SetObjectOwnProperty(szPropName, pValue);
return true;
}
+
if (pObject->HasObjectOwnProperty(szPropName, false)) {
pObject->GetObjectProperty(szPropName, hVariableValue.get());
if (hVariableValue->IsFunction())