From 714bf7821d2de6249d2779424c47027a981d5032 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 4 Jun 2018 14:01:27 +0000 Subject: [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 Commit-Queue: dsinclair --- fxjs/cfxjse_engine.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'fxjs') 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(); } -- cgit v1.2.3