summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_engine.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-06-04 14:01:27 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-04 14:01:27 +0000
commit714bf7821d2de6249d2779424c47027a981d5032 (patch)
tree860b3365aff4723ba1a2ed85e7621eb508240e9e /fxjs/cfxjse_engine.cpp
parent38cb7263a0923dd5613da24b18d3d7ef052ff5e3 (diff)
downloadpdfium-714bf7821d2de6249d2779424c47027a981d5032.tar.xz
[xfa] Get properties from the non-xfa global if possible
When script variables are used the methods are set on the non-xfa global object. This CL updates the NormalPropertyGetter to check the non-xfa global object for methods which allows the variables methods to be found. Bug: pdfium:1097 Change-Id: I13d9d49ad654cad776883aef74de6250de5e756b Reviewed-on: https://pdfium-review.googlesource.com/33433 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@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 6c8830923f..e894d51de4 100644
--- a/fxjs/cfxjse_engine.cpp
+++ b/fxjs/cfxjse_engine.cpp
@@ -216,6 +216,7 @@ void CFXJSE_Engine::GlobalPropertyGetter(CFXJSE_Value* pObject,
CXFA_Document* pDoc = pOriginalObject->GetDocument();
CFXJSE_Engine* lpScriptContext = pDoc->GetScriptContext();
WideString wsPropName = WideString::FromUTF8(szPropName);
+
if (lpScriptContext->GetType() == CXFA_Script::Type::Formcalc) {
if (szPropName == kFormCalcRuntime) {
lpScriptContext->m_FM2JSContext->GlobalPropertyGetter(pValue);
@@ -339,7 +340,20 @@ void CFXJSE_Engine::NormalPropertyGetter(CFXJSE_Value* pOriginalValue,
return;
}
}
+
+ CXFA_FFNotify* pNotify = pObject->GetDocument()->GetNotify();
+ if (!pNotify) {
+ pReturnValue->SetUndefined();
+ return;
+ }
+
+ CXFA_FFDoc* hDoc = pNotify->GetHDOC();
+ if (hDoc->GetDocEnvironment()->GetPropertyFromNonXFAGlobalObject(
+ hDoc, szPropName, pReturnValue)) {
+ return;
+ }
}
+
if (!bRet)
pReturnValue->SetUndefined();
}