summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fxjs/cfxjse_engine.cpp14
-rw-r--r--xfa/fxfa/parser/cxfa_value.cpp18
2 files changed, 26 insertions, 6 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();
}
diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp
index ecb380f9c8..24bd338fe2 100644
--- a/xfa/fxfa/parser/cxfa_value.cpp
+++ b/xfa/fxfa/parser/cxfa_value.cpp
@@ -69,36 +69,42 @@ WideString CXFA_Value::GetChildValueContent() const {
CXFA_Arc* CXFA_Value::GetArcIfExists() const {
CXFA_Node* node = GetFirstChild();
- ASSERT(!node || node->GetElementType() == XFA_Element::Arc);
+ if (!node || node->GetElementType() != XFA_Element::Arc)
+ return nullptr;
return static_cast<CXFA_Arc*>(node);
}
CXFA_Line* CXFA_Value::GetLineIfExists() const {
CXFA_Node* node = GetFirstChild();
- ASSERT(!node || node->GetElementType() == XFA_Element::Line);
+ if (!node || node->GetElementType() != XFA_Element::Line)
+ return nullptr;
return static_cast<CXFA_Line*>(node);
}
CXFA_Rectangle* CXFA_Value::GetRectangleIfExists() const {
CXFA_Node* node = GetFirstChild();
- ASSERT(!node || node->GetElementType() == XFA_Element::Rectangle);
+ if (!node || node->GetElementType() != XFA_Element::Rectangle)
+ return nullptr;
return static_cast<CXFA_Rectangle*>(node);
}
CXFA_Text* CXFA_Value::GetTextIfExists() const {
CXFA_Node* node = GetFirstChild();
- ASSERT(!node || node->GetElementType() == XFA_Element::Text);
+ if (!node || node->GetElementType() != XFA_Element::Text)
+ return nullptr;
return static_cast<CXFA_Text*>(node);
}
CXFA_ExData* CXFA_Value::GetExDataIfExists() const {
CXFA_Node* node = GetFirstChild();
- ASSERT(!node || node->GetElementType() == XFA_Element::ExData);
+ if (!node || node->GetElementType() != XFA_Element::ExData)
+ return nullptr;
return static_cast<CXFA_ExData*>(node);
}
CXFA_Image* CXFA_Value::GetImageIfExists() const {
CXFA_Node* node = GetFirstChild();
- ASSERT(!node || node->GetElementType() == XFA_Element::Image);
+ if (!node || node->GetElementType() != XFA_Element::Image)
+ return nullptr;
return static_cast<CXFA_Image*>(node);
}