From a85e5ca5f2dfadcf9f3812a8ef039d1f206833a4 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 1 Nov 2017 16:06:07 +0000 Subject: Split JS methods out of CXFA_Object This CL moves the javascript code from CXFA_Object to CJX_Object. The Script_* methods are proxied to CJX_Object. The ownership of the CJX_ object was removed from CXFA_Node and moved up to CXFA_Object. Change-Id: I58d286e6bb0151aa88d4f673bc7729987417bde6 Reviewed-on: https://pdfium-review.googlesource.com/17310 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- xfa/fxfa/parser/cscript_datawindow.cpp | 5 +- xfa/fxfa/parser/cscript_eventpseudomodel.cpp | 5 +- xfa/fxfa/parser/cscript_hostpseudomodel.cpp | 68 ++-- xfa/fxfa/parser/cscript_hostpseudomodel.h | 5 - xfa/fxfa/parser/cscript_layoutpseudomodel.cpp | 24 +- xfa/fxfa/parser/cscript_layoutpseudomodel.h | 1 - xfa/fxfa/parser/cscript_logpseudomodel.cpp | 5 +- xfa/fxfa/parser/cscript_signaturepseudomodel.cpp | 13 +- xfa/fxfa/parser/cxfa_node.cpp | 469 +++++++++-------------- xfa/fxfa/parser/cxfa_node.h | 15 +- xfa/fxfa/parser/cxfa_nodelist.cpp | 23 +- xfa/fxfa/parser/cxfa_object.cpp | 42 +- xfa/fxfa/parser/cxfa_object.h | 23 +- xfa/fxfa/parser/cxfa_thisproxy.cpp | 12 +- 14 files changed, 286 insertions(+), 424 deletions(-) (limited to 'xfa/fxfa/parser') diff --git a/xfa/fxfa/parser/cscript_datawindow.cpp b/xfa/fxfa/parser/cscript_datawindow.cpp index c5b09d155b..80b31f7ca9 100644 --- a/xfa/fxfa/parser/cscript_datawindow.cpp +++ b/xfa/fxfa/parser/cscript_datawindow.cpp @@ -7,6 +7,8 @@ #include "xfa/fxfa/parser/cscript_datawindow.h" #include "fxjs/cfxjse_arguments.h" +#include "fxjs/cjx_object.h" +#include "third_party/base/ptr_util.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/xfa_utils.h" @@ -15,7 +17,8 @@ CScript_DataWindow::CScript_DataWindow(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_ObjectType::Object, XFA_Element::DataWindow, - WideStringView(L"dataWindow")) {} + WideStringView(L"dataWindow"), + pdfium::MakeUnique(this)) {} CScript_DataWindow::~CScript_DataWindow() {} diff --git a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp index 1f20f291e6..633ee9b7d2 100644 --- a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp @@ -8,6 +8,8 @@ #include "fxjs/cfxjse_arguments.h" #include "fxjs/cfxjse_engine.h" +#include "fxjs/cjx_object.h" +#include "third_party/base/ptr_util.h" #include "xfa/fxfa/cxfa_eventparam.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/cxfa_ffwidgethandler.h" @@ -47,7 +49,8 @@ CScript_EventPseudoModel::CScript_EventPseudoModel(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_ObjectType::Object, XFA_Element::EventPseudoModel, - WideStringView(L"eventPseudoModel")) {} + WideStringView(L"eventPseudoModel"), + pdfium::MakeUnique(this)) {} CScript_EventPseudoModel::~CScript_EventPseudoModel() {} diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp index c074e0ed2e..75227cfe79 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp @@ -10,6 +10,8 @@ #include "fxjs/cfxjse_arguments.h" #include "fxjs/cfxjse_engine.h" +#include "fxjs/cjx_object.h" +#include "third_party/base/ptr_util.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" @@ -30,7 +32,8 @@ CScript_HostPseudoModel::CScript_HostPseudoModel(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_ObjectType::Object, XFA_Element::HostPseudoModel, - WideStringView(L"hostPseudoModel")) {} + WideStringView(L"hostPseudoModel"), + pdfium::MakeUnique(this)) {} CScript_HostPseudoModel::~CScript_HostPseudoModel() {} @@ -41,7 +44,7 @@ void CScript_HostPseudoModel::AppType(CFXJSE_Value* pValue, if (!pNotify) return; if (bSetting) { - ThrowInvalidPropertyException(); + JSObject()->ThrowInvalidPropertyException(); return; } pValue->SetString("Exchange"); @@ -85,7 +88,7 @@ void CScript_HostPseudoModel::Language(CFXJSE_Value* pValue, if (!pNotify) return; if (bSetting) { - ThrowSetLanguageException(); + JSObject()->ThrowException(L"Unable to set language value."); return; } pValue->SetString( @@ -101,7 +104,7 @@ void CScript_HostPseudoModel::NumPages(CFXJSE_Value* pValue, } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { - ThrowSetNumPagesException(); + JSObject()->ThrowException(L"Unable to set numPages value."); return; } pValue->SetInteger(pNotify->GetDocEnvironment()->CountPages(hDoc)); @@ -114,7 +117,7 @@ void CScript_HostPseudoModel::Platform(CFXJSE_Value* pValue, if (!pNotify) return; if (bSetting) { - ThrowSetPlatformException(); + JSObject()->ThrowException(L"Unable to set platform value."); return; } pValue->SetString( @@ -168,7 +171,7 @@ void CScript_HostPseudoModel::Variation(CFXJSE_Value* pValue, if (!pNotify) return; if (bSetting) { - ThrowSetVariationException(); + JSObject()->ThrowException(L"Unable to set variation value."); return; } pValue->SetString("Full"); @@ -182,7 +185,7 @@ void CScript_HostPseudoModel::Version(CFXJSE_Value* pValue, return; } if (bSetting) { - ThrowSetVersionException(); + JSObject()->ThrowException(L"Unable to set version value."); return; } pValue->SetString("11"); @@ -196,7 +199,7 @@ void CScript_HostPseudoModel::Name(CFXJSE_Value* pValue, return; } if (bSetting) { - ThrowInvalidPropertyException(); + JSObject()->ThrowInvalidPropertyException(); return; } pValue->SetString( @@ -209,7 +212,7 @@ void CScript_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) { } int32_t iLength = pArguments->GetLength(); if (iLength != 1) { - ThrowParamCountMismatchException(L"gotoURL"); + JSObject()->ThrowParamCountMismatchException(L"gotoURL"); return; } CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); @@ -231,7 +234,7 @@ void CScript_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) { } int32_t iLength = pArguments->GetLength(); if (iLength != 1) { - ThrowParamCountMismatchException(L"openList"); + JSObject()->ThrowParamCountMismatchException(L"openList"); return; } CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); @@ -278,7 +281,7 @@ void CScript_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) { void CScript_HostPseudoModel::Response(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 4) { - ThrowParamCountMismatchException(L"response"); + JSObject()->ThrowParamCountMismatchException(L"response"); return; } CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); @@ -315,6 +318,7 @@ void CScript_HostPseudoModel::DocumentInBatch(CFXJSE_Arguments* pArguments) { if (CFXJSE_Value* pValue = pArguments->GetReturnValue()) pValue->SetInteger(0); } + static int32_t XFA_FilterName(const WideStringView& wsExpression, int32_t nStart, WideString& wsFilter) { @@ -339,10 +343,11 @@ static int32_t XFA_FilterName(const WideStringView& wsExpression, wsFilter.TrimRight(); return nStart; } + void CScript_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 1) { - ThrowParamCountMismatchException(L"resetData"); + JSObject()->ThrowParamCountMismatchException(L"resetData"); return; } CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); @@ -387,13 +392,14 @@ void CScript_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) { pNotify->ResetData(); } } + void CScript_HostPseudoModel::Beep(CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 1) { - ThrowParamCountMismatchException(L"beep"); + JSObject()->ThrowParamCountMismatchException(L"beep"); return; } CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); @@ -406,13 +412,14 @@ void CScript_HostPseudoModel::Beep(CFXJSE_Arguments* pArguments) { } pNotify->GetAppProvider()->Beep(dwType); } + void CScript_HostPseudoModel::SetFocus(CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } int32_t iLength = pArguments->GetLength(); if (iLength != 1) { - ThrowParamCountMismatchException(L"setFocus"); + JSObject()->ThrowParamCountMismatchException(L"setFocus"); return; } CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); @@ -465,7 +472,7 @@ void CScript_HostPseudoModel::MessageBox(CFXJSE_Arguments* pArguments) { } int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 4) { - ThrowParamCountMismatchException(L"messageBox"); + JSObject()->ThrowParamCountMismatchException(L"messageBox"); return; } CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); @@ -504,6 +511,7 @@ void CScript_HostPseudoModel::MessageBox(CFXJSE_Arguments* pArguments) { if (pValue) pValue->SetInteger(iValue); } + bool CScript_HostPseudoModel::ValidateArgsForMsg(CFXJSE_Arguments* pArguments, int32_t iArgIndex, WideString& wsValue) { @@ -517,7 +525,7 @@ bool CScript_HostPseudoModel::ValidateArgsForMsg(CFXJSE_Arguments* pArguments, } std::unique_ptr pValueArg(pArguments->GetValue(iArgIndex)); if (!pValueArg->IsString() && bIsJsType) { - ThrowArgumentMismatchException(); + JSObject()->ThrowArgumentMismatchException(); return false; } if (pValueArg->IsNull()) { @@ -527,18 +535,20 @@ bool CScript_HostPseudoModel::ValidateArgsForMsg(CFXJSE_Arguments* pArguments, } return true; } + void CScript_HostPseudoModel::DocumentCountInBatch( CFXJSE_Arguments* pArguments) { if (CFXJSE_Value* pValue = pArguments->GetReturnValue()) pValue->SetInteger(0); } + void CScript_HostPseudoModel::Print(CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } int32_t iLength = pArguments->GetLength(); if (iLength != 8) { - ThrowParamCountMismatchException(L"print"); + JSObject()->ThrowParamCountMismatchException(L"print"); return; } CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); @@ -604,7 +614,7 @@ void CScript_HostPseudoModel::Print(CFXJSE_Arguments* pArguments) { void CScript_HostPseudoModel::ImportData(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 1) { - ThrowParamCountMismatchException(L"importData"); + JSObject()->ThrowParamCountMismatchException(L"importData"); return; } // Not implemented. @@ -613,7 +623,7 @@ void CScript_HostPseudoModel::ImportData(CFXJSE_Arguments* pArguments) { void CScript_HostPseudoModel::ExportData(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 2) { - ThrowParamCountMismatchException(L"exportData"); + JSObject()->ThrowParamCountMismatchException(L"exportData"); return; } CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); @@ -678,23 +688,3 @@ void CScript_HostPseudoModel::CurrentDateTime(CFXJSE_Arguments* pArguments) { if (pValue) pValue->SetString(wsDataTime.UTF8Encode().AsStringView()); } - -void CScript_HostPseudoModel::ThrowSetLanguageException() const { - ThrowException(L"Unable to set language value."); -} - -void CScript_HostPseudoModel::ThrowSetNumPagesException() const { - ThrowException(L"Unable to set numPages value."); -} - -void CScript_HostPseudoModel::ThrowSetPlatformException() const { - ThrowException(L"Unable to set platform value."); -} - -void CScript_HostPseudoModel::ThrowSetVariationException() const { - ThrowException(L"Unable to set variation value."); -} - -void CScript_HostPseudoModel::ThrowSetVersionException() const { - ThrowException(L"Unable to set version value."); -} diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.h b/xfa/fxfa/parser/cscript_hostpseudomodel.h index 4ec92dd73a..de07b1cd45 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.h +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.h @@ -55,11 +55,6 @@ class CScript_HostPseudoModel : public CXFA_Object { bool ValidateArgsForMsg(CFXJSE_Arguments* pArguments, int32_t iArgIndex, WideString& wsValue); - void ThrowSetLanguageException() const; - void ThrowSetNumPagesException() const; - void ThrowSetPlatformException() const; - void ThrowSetVariationException() const; - void ThrowSetVersionException() const; }; #endif // XFA_FXFA_PARSER_CSCRIPT_HOSTPSEUDOMODEL_H_ diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp index 574b62644a..4c7d7f2006 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp @@ -10,6 +10,8 @@ #include "fxjs/cfxjse_arguments.h" #include "fxjs/cfxjse_engine.h" +#include "fxjs/cjx_object.h" +#include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_arraynodelist.h" @@ -28,7 +30,8 @@ CScript_LayoutPseudoModel::CScript_LayoutPseudoModel(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_ObjectType::Object, XFA_Element::LayoutPseudoModel, - WideStringView(L"layoutPseudoModel")) {} + WideStringView(L"layoutPseudoModel"), + pdfium::MakeUnique(this)) {} CScript_LayoutPseudoModel::~CScript_LayoutPseudoModel() {} @@ -40,7 +43,7 @@ void CScript_LayoutPseudoModel::Ready(CFXJSE_Value* pValue, return; } if (bSetting) { - ThrowSetReadyException(); + JSObject()->ThrowException(L"Unable to set ready value."); return; } int32_t iStatus = pNotify->GetLayoutStatus(); @@ -66,7 +69,7 @@ void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments, methodName = L"y"; break; } - ThrowParamCountMismatchException(methodName); + JSObject()->ThrowParamCountMismatchException(methodName); return; } CXFA_Node* pNode = static_cast(pArguments->GetObject(0)); @@ -170,7 +173,7 @@ void CScript_LayoutPseudoModel::PageCount(CFXJSE_Arguments* pArguments) { void CScript_LayoutPseudoModel::PageSpan(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength != 1) { - ThrowParamCountMismatchException(L"pageSpan"); + JSObject()->ThrowParamCountMismatchException(L"pageSpan"); return; } CXFA_Node* pNode = nullptr; @@ -334,7 +337,7 @@ std::vector CScript_LayoutPseudoModel::GetObjArray( void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 3) { - ThrowParamCountMismatchException(L"pageContent"); + JSObject()->ThrowParamCountMismatchException(L"pageContent"); return; } int32_t iIndex = 0; @@ -398,7 +401,7 @@ void CScript_LayoutPseudoModel::AbsPageSpan(CFXJSE_Arguments* pArguments) { void CScript_LayoutPseudoModel::AbsPageInBatch(CFXJSE_Arguments* pArguments) { if (pArguments->GetLength() != 1) { - ThrowParamCountMismatchException(L"absPageInBatch"); + JSObject()->ThrowParamCountMismatchException(L"absPageInBatch"); return; } @@ -407,7 +410,7 @@ void CScript_LayoutPseudoModel::AbsPageInBatch(CFXJSE_Arguments* pArguments) { void CScript_LayoutPseudoModel::SheetInBatch(CFXJSE_Arguments* pArguments) { if (pArguments->GetLength() != 1) { - ThrowParamCountMismatchException(L"sheetInBatch"); + JSObject()->ThrowParamCountMismatchException(L"sheetInBatch"); return; } @@ -433,7 +436,8 @@ void CScript_LayoutPseudoModel::PageInternals(CFXJSE_Arguments* pArguments, bool bAbsPage) { int32_t iLength = pArguments->GetLength(); if (iLength != 1) { - ThrowParamCountMismatchException(bAbsPage ? L"absPage" : L"page"); + JSObject()->ThrowParamCountMismatchException(bAbsPage ? L"absPage" + : L"page"); return; } @@ -454,7 +458,3 @@ void CScript_LayoutPseudoModel::PageInternals(CFXJSE_Arguments* pArguments, int32_t iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); pValue->SetInteger(bAbsPage ? iPage : iPage + 1); } - -void CScript_LayoutPseudoModel::ThrowSetReadyException() const { - ThrowException(L"Unable to set ready value."); -} diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.h b/xfa/fxfa/parser/cscript_layoutpseudomodel.h index 539fcce4ca..c38871ab95 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.h +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.h @@ -57,7 +57,6 @@ class CScript_LayoutPseudoModel : public CXFA_Object { bool bOnPageArea); void PageInternals(CFXJSE_Arguments* pArguments, bool bAbsPage); - void ThrowSetReadyException() const; }; #endif // XFA_FXFA_PARSER_CSCRIPT_LAYOUTPSEUDOMODEL_H_ diff --git a/xfa/fxfa/parser/cscript_logpseudomodel.cpp b/xfa/fxfa/parser/cscript_logpseudomodel.cpp index f0747f4a12..2c99972042 100644 --- a/xfa/fxfa/parser/cscript_logpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_logpseudomodel.cpp @@ -7,6 +7,8 @@ #include "xfa/fxfa/parser/cscript_logpseudomodel.h" #include "fxjs/cfxjse_arguments.h" +#include "fxjs/cjx_object.h" +#include "third_party/base/ptr_util.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/xfa_utils.h" @@ -15,7 +17,8 @@ CScript_LogPseudoModel::CScript_LogPseudoModel(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_ObjectType::Object, XFA_Element::LogPseudoModel, - WideStringView(L"logPseudoModel")) {} + WideStringView(L"logPseudoModel"), + pdfium::MakeUnique(this)) {} CScript_LogPseudoModel::~CScript_LogPseudoModel() {} diff --git a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp index ff98953590..c08c166ec4 100644 --- a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp @@ -8,6 +8,8 @@ #include "fxjs/cfxjse_arguments.h" #include "fxjs/cfxjse_engine.h" +#include "fxjs/cjx_object.h" +#include "third_party/base/ptr_util.h" #include "xfa/fxfa/cxfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" @@ -18,14 +20,15 @@ CScript_SignaturePseudoModel::CScript_SignaturePseudoModel( : CXFA_Object(pDocument, XFA_ObjectType::Object, XFA_Element::SignaturePseudoModel, - WideStringView(L"signaturePseudoModel")) {} + WideStringView(L"signaturePseudoModel"), + pdfium::MakeUnique(this)) {} CScript_SignaturePseudoModel::~CScript_SignaturePseudoModel() {} void CScript_SignaturePseudoModel::Verify(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 4) { - ThrowParamCountMismatchException(L"verify"); + JSObject()->ThrowParamCountMismatchException(L"verify"); return; } @@ -37,7 +40,7 @@ void CScript_SignaturePseudoModel::Verify(CFXJSE_Arguments* pArguments) { void CScript_SignaturePseudoModel::Sign(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 3 || iLength > 7) { - ThrowParamCountMismatchException(L"sign"); + JSObject()->ThrowParamCountMismatchException(L"sign"); return; } @@ -48,7 +51,7 @@ void CScript_SignaturePseudoModel::Sign(CFXJSE_Arguments* pArguments) { void CScript_SignaturePseudoModel::Enumerate(CFXJSE_Arguments* pArguments) { if (pArguments->GetLength() != 0) { - ThrowParamCountMismatchException(L"enumerate"); + JSObject()->ThrowParamCountMismatchException(L"enumerate"); return; } return; @@ -57,7 +60,7 @@ void CScript_SignaturePseudoModel::Enumerate(CFXJSE_Arguments* pArguments) { void CScript_SignaturePseudoModel::Clear(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 2) { - ThrowParamCountMismatchException(L"clear"); + JSObject()->ThrowParamCountMismatchException(L"clear"); return; } diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index a33a5c21ac..6b3859e0d2 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -148,7 +148,11 @@ CXFA_Node::CXFA_Node(CXFA_Document* pDoc, XFA_ObjectType oType, XFA_Element eType, const WideStringView& elementName) - : CXFA_Object(pDoc, oType, eType, elementName), + : CXFA_Object(pDoc, + oType, + eType, + elementName, + pdfium::MakeUnique(this)), m_pNext(nullptr), m_pChild(nullptr), m_pLastChild(nullptr), @@ -157,8 +161,7 @@ CXFA_Node::CXFA_Node(CXFA_Document* pDoc, m_ePacket(ePacket), m_uNodeFlags(XFA_NodeFlag_None), m_dwNameHash(0), - m_pAuxNode(nullptr), - m_JSNode(this) { + m_pAuxNode(nullptr) { ASSERT(m_pDocument); } @@ -180,15 +183,15 @@ CXFA_Node* CXFA_Node::Clone(bool bRecursive) { if (!pClone) return nullptr; - m_JSNode.MergeAllData(pClone); + JSNode()->MergeAllData(pClone); pClone->UpdateNameHash(); if (IsNeedSavingXMLNode()) { std::unique_ptr pCloneXML; if (IsAttributeInXML()) { WideString wsName; - m_JSNode.GetAttribute(XFA_ATTRIBUTE_Name, wsName, false); + JSNode()->GetAttribute(XFA_ATTRIBUTE_Name, wsName, false); auto pCloneXMLElement = pdfium::MakeUnique(wsName); - WideStringView wsValue = m_JSNode.GetCData(XFA_ATTRIBUTE_Value); + WideStringView wsValue = JSNode()->GetCData(XFA_ATTRIBUTE_Value); if (!wsValue.IsEmpty()) { pCloneXMLElement->SetTextData(WideString(wsValue)); } @@ -371,18 +374,19 @@ void CXFA_Node::SetTemplateNode(CXFA_Node* pTemplateNode) { CXFA_Node* CXFA_Node::GetBindData() { ASSERT(GetPacketID() == XFA_XDPPACKET_Form); - return static_cast(m_JSNode.GetObject(XFA_ATTRIBUTE_BindingNode)); + return static_cast( + JSNode()->GetObject(XFA_ATTRIBUTE_BindingNode)); } std::vector CXFA_Node::GetBindItems() { if (BindsFormItems()) { void* pBinding = nullptr; - m_JSNode.TryObject(XFA_ATTRIBUTE_BindingNode, pBinding); + JSNode()->TryObject(XFA_ATTRIBUTE_BindingNode, pBinding); return *static_cast*>(pBinding); } std::vector result; CXFA_Node* pFormNode = - static_cast(m_JSNode.GetObject(XFA_ATTRIBUTE_BindingNode)); + static_cast(JSNode()->GetObject(XFA_ATTRIBUTE_BindingNode)); if (pFormNode) result.push_back(pFormNode); return result; @@ -392,24 +396,24 @@ int32_t CXFA_Node::AddBindItem(CXFA_Node* pFormNode) { ASSERT(pFormNode); if (BindsFormItems()) { void* pBinding = nullptr; - m_JSNode.TryObject(XFA_ATTRIBUTE_BindingNode, pBinding); + JSNode()->TryObject(XFA_ATTRIBUTE_BindingNode, pBinding); auto* pItems = static_cast*>(pBinding); if (!pdfium::ContainsValue(*pItems, pFormNode)) pItems->push_back(pFormNode); return pdfium::CollectionSize(*pItems); } CXFA_Node* pOldFormItem = - static_cast(m_JSNode.GetObject(XFA_ATTRIBUTE_BindingNode)); + static_cast(JSNode()->GetObject(XFA_ATTRIBUTE_BindingNode)); if (!pOldFormItem) { - m_JSNode.SetObject(XFA_ATTRIBUTE_BindingNode, pFormNode); + JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, pFormNode); return 1; } if (pOldFormItem == pFormNode) return 1; std::vector* pItems = new std::vector; - m_JSNode.SetObject(XFA_ATTRIBUTE_BindingNode, pItems, - &deleteBindItemCallBack); + JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, pItems, + &deleteBindItemCallBack); pItems->push_back(pOldFormItem); pItems->push_back(pFormNode); m_uNodeFlags |= XFA_NodeFlag_BindFormItems; @@ -419,15 +423,15 @@ int32_t CXFA_Node::AddBindItem(CXFA_Node* pFormNode) { int32_t CXFA_Node::RemoveBindItem(CXFA_Node* pFormNode) { if (BindsFormItems()) { void* pBinding = nullptr; - m_JSNode.TryObject(XFA_ATTRIBUTE_BindingNode, pBinding); + JSNode()->TryObject(XFA_ATTRIBUTE_BindingNode, pBinding); auto* pItems = static_cast*>(pBinding); auto iter = std::find(pItems->begin(), pItems->end(), pFormNode); if (iter != pItems->end()) { *iter = pItems->back(); pItems->pop_back(); if (pItems->size() == 1) { - m_JSNode.SetObject(XFA_ATTRIBUTE_BindingNode, - (*pItems)[0]); // Invalidates pItems. + JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, + (*pItems)[0]); // Invalidates pItems. m_uNodeFlags &= ~XFA_NodeFlag_BindFormItems; return 1; } @@ -435,21 +439,21 @@ int32_t CXFA_Node::RemoveBindItem(CXFA_Node* pFormNode) { return pdfium::CollectionSize(*pItems); } CXFA_Node* pOldFormItem = - static_cast(m_JSNode.GetObject(XFA_ATTRIBUTE_BindingNode)); + static_cast(JSNode()->GetObject(XFA_ATTRIBUTE_BindingNode)); if (pOldFormItem != pFormNode) return pOldFormItem ? 1 : 0; - m_JSNode.SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); + JSNode()->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); return 0; } bool CXFA_Node::HasBindItem() { return GetPacketID() == XFA_XDPPACKET_Datasets && - m_JSNode.GetObject(XFA_ATTRIBUTE_BindingNode); + JSNode()->GetObject(XFA_ATTRIBUTE_BindingNode); } CXFA_WidgetData* CXFA_Node::GetWidgetData() { - return (CXFA_WidgetData*)m_JSNode.GetObject(XFA_ATTRIBUTE_WidgetData); + return (CXFA_WidgetData*)JSNode()->GetObject(XFA_ATTRIBUTE_WidgetData); } CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() { @@ -546,7 +550,7 @@ bool CXFA_Node::GetLocaleName(WideString& wsLocaleName) { XFA_ATTRIBUTEENUM CXFA_Node::GetIntact() { CXFA_Node* pKeep = GetFirstChildByClass(XFA_Element::Keep); - XFA_ATTRIBUTEENUM eLayoutType = m_JSNode.GetEnum(XFA_ATTRIBUTE_Layout); + XFA_ATTRIBUTEENUM eLayoutType = JSNode()->GetEnum(XFA_ATTRIBUTE_Layout); if (pKeep) { XFA_ATTRIBUTEENUM eIntact; if (pKeep->JSNode()->TryEnum(XFA_ATTRIBUTE_Intact, eIntact, false)) { @@ -607,7 +611,7 @@ XFA_ATTRIBUTEENUM CXFA_Node::GetIntact() { XFA_VERSION version = m_pDocument->GetCurVersionMode(); if (eParLayout == XFA_ATTRIBUTEENUM_Tb && version < XFA_VERSION_208) { CXFA_Measurement measureH; - if (m_JSNode.TryMeasure(XFA_ATTRIBUTE_H, measureH, false)) + if (JSNode()->TryMeasure(XFA_ATTRIBUTE_H, measureH, false)) return XFA_ATTRIBUTEENUM_ContentArea; } return XFA_ATTRIBUTEENUM_None; @@ -633,830 +637,734 @@ void CXFA_Node::SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode) { m_pAuxNode = pDataDescriptionNode; } -int32_t CXFA_Node::Subform_and_SubformSet_InstanceIndex() { - int32_t index = 0; - for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; - pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { - if ((pNode->GetElementType() == XFA_Element::Subform) || - (pNode->GetElementType() == XFA_Element::SubformSet)) { - index++; - } else { - break; - } - } - return index; -} - -int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { - CXFA_Occur nodeOccur(GetOccurNode()); - int32_t iMax = nodeOccur.GetMax(); - int32_t iMin = nodeOccur.GetMin(); - if (iDesired < iMin) { - ThrowTooManyOccurancesException(L"min"); - return 1; - } - if ((iMax >= 0) && (iDesired > iMax)) { - ThrowTooManyOccurancesException(L"max"); - return 2; - } - int32_t iCount = GetCount(this); - if (iDesired == iCount) { - return 0; - } - if (iDesired < iCount) { - WideStringView wsInstManagerName = m_JSNode.GetCData(XFA_ATTRIBUTE_Name); - WideString wsInstanceName = WideString( - wsInstManagerName.IsEmpty() - ? wsInstManagerName - : wsInstManagerName.Right(wsInstManagerName.GetLength() - 1)); - uint32_t dInstanceNameHash = - FX_HashCode_GetW(wsInstanceName.AsStringView(), false); - CXFA_Node* pPrevSibling = - (iDesired == 0) ? this : GetItem(this, iDesired - 1); - while (iCount > iDesired) { - CXFA_Node* pRemoveInstance = - pPrevSibling->GetNodeItem(XFA_NODEITEM_NextSibling); - if (pRemoveInstance->GetElementType() != XFA_Element::Subform && - pRemoveInstance->GetElementType() != XFA_Element::SubformSet) { - continue; - } - if (pRemoveInstance->GetElementType() == XFA_Element::InstanceManager) { - NOTREACHED(); - break; - } - if (pRemoveInstance->GetNameHash() == dInstanceNameHash) { - RemoveItem(this, pRemoveInstance); - iCount--; - } - } - } else if (iDesired > iCount) { - while (iCount < iDesired) { - CXFA_Node* pNewInstance = CreateInstance(this, true); - InsertItem(this, pNewInstance, iCount, iCount, false); - iCount++; - CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); - if (!pNotify) { - return 0; - } - pNotify->RunNodeInitialize(pNewInstance); - } - } - CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); - if (pLayoutPro) { - pLayoutPro->AddChangedContainer( - ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form))); - } - return 0; -} - -int32_t CXFA_Node::InstanceManager_MoveInstance(int32_t iTo, int32_t iFrom) { - int32_t iCount = GetCount(this); - if (iFrom > iCount || iTo > iCount - 1) { - ThrowIndexOutOfBoundsException(); - return 1; - } - if (iFrom < 0 || iTo < 0 || iFrom == iTo) { - return 0; - } - CXFA_Node* pMoveInstance = GetItem(this, iFrom); - RemoveItem(this, pMoveInstance, false); - InsertItem(this, pMoveInstance, iTo, iCount - 1, true); - CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); - if (pLayoutPro) { - pLayoutPro->AddChangedContainer( - ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form))); - } - return 0; -} - void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_TreeClass_ResolveNode(pArguments); + JSNode()->Script_TreeClass_ResolveNode(pArguments); } void CXFA_Node::Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_TreeClass_ResolveNodes(pArguments); + JSNode()->Script_TreeClass_ResolveNodes(pArguments); } void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue, WideString wsExpression, uint32_t dwFlag, CXFA_Node* refNode) { - m_JSNode.Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag, refNode); + JSNode()->Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag, refNode); } void CXFA_Node::Script_TreeClass_All(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_TreeClass_All(pValue, bSetting, eAttribute); + JSNode()->Script_TreeClass_All(pValue, bSetting, eAttribute); } void CXFA_Node::Script_TreeClass_Nodes(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_TreeClass_Nodes(pValue, bSetting, eAttribute); + JSNode()->Script_TreeClass_Nodes(pValue, bSetting, eAttribute); } void CXFA_Node::Script_TreeClass_ClassAll(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_TreeClass_ClassAll(pValue, bSetting, eAttribute); + JSNode()->Script_TreeClass_ClassAll(pValue, bSetting, eAttribute); } void CXFA_Node::Script_TreeClass_Parent(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_TreeClass_Parent(pValue, bSetting, eAttribute); + JSNode()->Script_TreeClass_Parent(pValue, bSetting, eAttribute); } void CXFA_Node::Script_TreeClass_Index(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_TreeClass_Index(pValue, bSetting, eAttribute); + JSNode()->Script_TreeClass_Index(pValue, bSetting, eAttribute); } void CXFA_Node::Script_TreeClass_ClassIndex(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_TreeClass_ClassIndex(pValue, bSetting, eAttribute); + JSNode()->Script_TreeClass_ClassIndex(pValue, bSetting, eAttribute); } void CXFA_Node::Script_TreeClass_SomExpression(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_TreeClass_SomExpression(pValue, bSetting, eAttribute); + JSNode()->Script_TreeClass_SomExpression(pValue, bSetting, eAttribute); } void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_NodeClass_ApplyXSL(pArguments); + JSNode()->Script_NodeClass_ApplyXSL(pArguments); } void CXFA_Node::Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_NodeClass_AssignNode(pArguments); + JSNode()->Script_NodeClass_AssignNode(pArguments); } void CXFA_Node::Script_NodeClass_Clone(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_NodeClass_Clone(pArguments); + JSNode()->Script_NodeClass_Clone(pArguments); } void CXFA_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_NodeClass_GetAttribute(pArguments); + JSNode()->Script_NodeClass_GetAttribute(pArguments); } void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_NodeClass_GetElement(pArguments); + JSNode()->Script_NodeClass_GetElement(pArguments); } void CXFA_Node::Script_NodeClass_IsPropertySpecified( CFXJSE_Arguments* pArguments) { - m_JSNode.Script_NodeClass_IsPropertySpecified(pArguments); + JSNode()->Script_NodeClass_IsPropertySpecified(pArguments); } void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_NodeClass_LoadXML(pArguments); + JSNode()->Script_NodeClass_LoadXML(pArguments); } void CXFA_Node::Script_NodeClass_SaveFilteredXML(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_NodeClass_SaveFilteredXML(pArguments); + JSNode()->Script_NodeClass_SaveFilteredXML(pArguments); } void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_NodeClass_SaveXML(pArguments); + JSNode()->Script_NodeClass_SaveXML(pArguments); } void CXFA_Node::Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_NodeClass_SetAttribute(pArguments); + JSNode()->Script_NodeClass_SetAttribute(pArguments); } void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_NodeClass_SetElement(pArguments); + JSNode()->Script_NodeClass_SetElement(pArguments); } void CXFA_Node::Script_NodeClass_Ns(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_NodeClass_Ns(pValue, bSetting, eAttribute); + JSNode()->Script_NodeClass_Ns(pValue, bSetting, eAttribute); } void CXFA_Node::Script_NodeClass_Model(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_NodeClass_Model(pValue, bSetting, eAttribute); + JSNode()->Script_NodeClass_Model(pValue, bSetting, eAttribute); } void CXFA_Node::Script_NodeClass_IsContainer(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_NodeClass_IsContainer(pValue, bSetting, eAttribute); + JSNode()->Script_NodeClass_IsContainer(pValue, bSetting, eAttribute); } void CXFA_Node::Script_NodeClass_IsNull(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_NodeClass_IsNull(pValue, bSetting, eAttribute); + JSNode()->Script_NodeClass_IsNull(pValue, bSetting, eAttribute); } void CXFA_Node::Script_NodeClass_OneOfChild(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_NodeClass_OneOfChild(pValue, bSetting, eAttribute); + JSNode()->Script_NodeClass_OneOfChild(pValue, bSetting, eAttribute); } void CXFA_Node::Script_ContainerClass_GetDelta(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_ContainerClass_GetDelta(pArguments); + JSNode()->Script_ContainerClass_GetDelta(pArguments); } void CXFA_Node::Script_ContainerClass_GetDeltas(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_ContainerClass_GetDeltas(pArguments); + JSNode()->Script_ContainerClass_GetDeltas(pArguments); } void CXFA_Node::Script_ModelClass_ClearErrorList(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_ModelClass_ClearErrorList(pArguments); + JSNode()->Script_ModelClass_ClearErrorList(pArguments); } void CXFA_Node::Script_ModelClass_CreateNode(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_ModelClass_CreateNode(pArguments); + JSNode()->Script_ModelClass_CreateNode(pArguments); } void CXFA_Node::Script_ModelClass_IsCompatibleNS(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_ModelClass_IsCompatibleNS(pArguments); + JSNode()->Script_ModelClass_IsCompatibleNS(pArguments); } void CXFA_Node::Script_ModelClass_Context(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_ModelClass_Context(pValue, bSetting, eAttribute); + JSNode()->Script_ModelClass_Context(pValue, bSetting, eAttribute); } void CXFA_Node::Script_ModelClass_AliasNode(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_ModelClass_AliasNode(pValue, bSetting, eAttribute); + JSNode()->Script_ModelClass_AliasNode(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Attribute_Integer(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Attribute_Integer(pValue, bSetting, eAttribute); + JSNode()->Script_Attribute_Integer(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Attribute_IntegerRead(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Attribute_IntegerRead(pValue, bSetting, eAttribute); + JSNode()->Script_Attribute_IntegerRead(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Attribute_BOOL(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Attribute_BOOL(pValue, bSetting, eAttribute); + JSNode()->Script_Attribute_BOOL(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Attribute_BOOLRead(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Attribute_BOOLRead(pValue, bSetting, eAttribute); + JSNode()->Script_Attribute_BOOLRead(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( XFA_ATTRIBUTE eAttribute, bool bScriptModify) { - m_JSNode.Script_Attribute_SendAttributeChangeMessage(eAttribute, - bScriptModify); + JSNode()->Script_Attribute_SendAttributeChangeMessage(eAttribute, + bScriptModify); } void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Attribute_String(pValue, bSetting, eAttribute); + JSNode()->Script_Attribute_String(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Attribute_StringRead(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Attribute_StringRead(pValue, bSetting, eAttribute); + JSNode()->Script_Attribute_StringRead(pValue, bSetting, eAttribute); } void CXFA_Node::Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_WsdlConnection_Execute(pArguments); + JSNode()->Script_WsdlConnection_Execute(pArguments); } void CXFA_Node::Script_Delta_Restore(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Delta_Restore(pArguments); + JSNode()->Script_Delta_Restore(pArguments); } void CXFA_Node::Script_Delta_CurrentValue(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Delta_CurrentValue(pValue, bSetting, eAttribute); + JSNode()->Script_Delta_CurrentValue(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Delta_SavedValue(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Delta_SavedValue(pValue, bSetting, eAttribute); + JSNode()->Script_Delta_SavedValue(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Delta_Target(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Delta_Target(pValue, bSetting, eAttribute); + JSNode()->Script_Delta_Target(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Som_Message(CFXJSE_Value* pValue, bool bSetting, XFA_SOM_MESSAGETYPE iMessageType) { - m_JSNode.Script_Som_Message(pValue, bSetting, iMessageType); + JSNode()->Script_Som_Message(pValue, bSetting, iMessageType); } void CXFA_Node::Script_Som_ValidationMessage(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Som_ValidationMessage(pValue, bSetting, eAttribute); + JSNode()->Script_Som_ValidationMessage(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Field_Length(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Field_Length(pValue, bSetting, eAttribute); + JSNode()->Script_Field_Length(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Som_DefaultValue(pValue, bSetting, eAttribute); + JSNode()->Script_Som_DefaultValue(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Som_DefaultValue_Read(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Som_DefaultValue_Read(pValue, bSetting, eAttribute); + JSNode()->Script_Som_DefaultValue_Read(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Boolean_Value(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Boolean_Value(pValue, bSetting, eAttribute); + JSNode()->Script_Boolean_Value(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Som_BorderColor(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Som_BorderColor(pValue, bSetting, eAttribute); + JSNode()->Script_Som_BorderColor(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Som_BorderWidth(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Som_BorderWidth(pValue, bSetting, eAttribute); + JSNode()->Script_Som_BorderWidth(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Som_FillColor(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Som_FillColor(pValue, bSetting, eAttribute); + JSNode()->Script_Som_FillColor(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Som_DataNode(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Som_DataNode(pValue, bSetting, eAttribute); + JSNode()->Script_Som_DataNode(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Draw_DefaultValue(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Draw_DefaultValue(pValue, bSetting, eAttribute); + JSNode()->Script_Draw_DefaultValue(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Field_DefaultValue(pValue, bSetting, eAttribute); + JSNode()->Script_Field_DefaultValue(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Field_EditValue(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Field_EditValue(pValue, bSetting, eAttribute); + JSNode()->Script_Field_EditValue(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Som_FontColor(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Som_FontColor(pValue, bSetting, eAttribute); + JSNode()->Script_Som_FontColor(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Field_FormatMessage(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Field_FormatMessage(pValue, bSetting, eAttribute); + JSNode()->Script_Field_FormatMessage(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Field_FormattedValue(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Field_FormattedValue(pValue, bSetting, eAttribute); + JSNode()->Script_Field_FormattedValue(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Som_Mandatory(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Som_Mandatory(pValue, bSetting, eAttribute); + JSNode()->Script_Som_Mandatory(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Som_MandatoryMessage(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Som_MandatoryMessage(pValue, bSetting, eAttribute); + JSNode()->Script_Som_MandatoryMessage(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Field_ParentSubform(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Field_ParentSubform(pValue, bSetting, eAttribute); + JSNode()->Script_Field_ParentSubform(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Field_SelectedIndex(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Field_SelectedIndex(pValue, bSetting, eAttribute); + JSNode()->Script_Field_SelectedIndex(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Field_ClearItems(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Field_ClearItems(pArguments); + JSNode()->Script_Field_ClearItems(pArguments); } void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Field_ExecEvent(pArguments); + JSNode()->Script_Field_ExecEvent(pArguments); } void CXFA_Node::Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Field_ExecInitialize(pArguments); + JSNode()->Script_Field_ExecInitialize(pArguments); } void CXFA_Node::Script_Field_DeleteItem(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Field_DeleteItem(pArguments); + JSNode()->Script_Field_DeleteItem(pArguments); } void CXFA_Node::Script_Field_GetSaveItem(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Field_GetSaveItem(pArguments); + JSNode()->Script_Field_GetSaveItem(pArguments); } void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Field_BoundItem(pArguments); + JSNode()->Script_Field_BoundItem(pArguments); } void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Field_GetItemState(pArguments); + JSNode()->Script_Field_GetItemState(pArguments); } void CXFA_Node::Script_Field_ExecCalculate(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Field_ExecCalculate(pArguments); + JSNode()->Script_Field_ExecCalculate(pArguments); } void CXFA_Node::Script_Field_SetItems(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Field_SetItems(pArguments); + JSNode()->Script_Field_SetItems(pArguments); } void CXFA_Node::Script_Field_GetDisplayItem(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Field_GetDisplayItem(pArguments); + JSNode()->Script_Field_GetDisplayItem(pArguments); } void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Field_SetItemState(pArguments); + JSNode()->Script_Field_SetItemState(pArguments); } void CXFA_Node::Script_Field_AddItem(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Field_AddItem(pArguments); + JSNode()->Script_Field_AddItem(pArguments); } void CXFA_Node::Script_Field_ExecValidate(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Field_ExecValidate(pArguments); + JSNode()->Script_Field_ExecValidate(pArguments); } void CXFA_Node::Script_ExclGroup_ErrorText(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_ExclGroup_ErrorText(pValue, bSetting, eAttribute); + JSNode()->Script_ExclGroup_ErrorText(pValue, bSetting, eAttribute); } void CXFA_Node::Script_ExclGroup_DefaultAndRawValue(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_ExclGroup_DefaultAndRawValue(pValue, bSetting, eAttribute); + JSNode()->Script_ExclGroup_DefaultAndRawValue(pValue, bSetting, eAttribute); } void CXFA_Node::Script_ExclGroup_Transient(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_ExclGroup_Transient(pValue, bSetting, eAttribute); + JSNode()->Script_ExclGroup_Transient(pValue, bSetting, eAttribute); } void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_ExclGroup_ExecEvent(pArguments); + JSNode()->Script_ExclGroup_ExecEvent(pArguments); } void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_ExclGroup_SelectedMember(pArguments); + JSNode()->Script_ExclGroup_SelectedMember(pArguments); } void CXFA_Node::Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_ExclGroup_ExecInitialize(pArguments); + JSNode()->Script_ExclGroup_ExecInitialize(pArguments); } void CXFA_Node::Script_ExclGroup_ExecCalculate(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_ExclGroup_ExecCalculate(pArguments); + JSNode()->Script_ExclGroup_ExecCalculate(pArguments); } void CXFA_Node::Script_ExclGroup_ExecValidate(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_ExclGroup_ExecValidate(pArguments); + JSNode()->Script_ExclGroup_ExecValidate(pArguments); } void CXFA_Node::Script_Som_InstanceIndex(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Som_InstanceIndex(pValue, bSetting, eAttribute); + JSNode()->Script_Som_InstanceIndex(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Subform_InstanceManager(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Subform_InstanceManager(pValue, bSetting, eAttribute); + JSNode()->Script_Subform_InstanceManager(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Subform_Locale(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Subform_Locale(pValue, bSetting, eAttribute); + JSNode()->Script_Subform_Locale(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Subform_ExecEvent(pArguments); + JSNode()->Script_Subform_ExecEvent(pArguments); } void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Subform_ExecInitialize(pArguments); + JSNode()->Script_Subform_ExecInitialize(pArguments); } void CXFA_Node::Script_Subform_ExecCalculate(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Subform_ExecInitialize(pArguments); + JSNode()->Script_Subform_ExecInitialize(pArguments); } void CXFA_Node::Script_Subform_ExecValidate(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Subform_ExecValidate(pArguments); + JSNode()->Script_Subform_ExecValidate(pArguments); } void CXFA_Node::Script_Subform_GetInvalidObjects(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Subform_GetInvalidObjects(pArguments); + JSNode()->Script_Subform_GetInvalidObjects(pArguments); } void CXFA_Node::Script_Template_FormNodes(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Template_FormNodes(pArguments); + JSNode()->Script_Template_FormNodes(pArguments); } void CXFA_Node::Script_Template_Remerge(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Template_Remerge(pArguments); + JSNode()->Script_Template_Remerge(pArguments); } void CXFA_Node::Script_Template_ExecInitialize(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Template_ExecInitialize(pArguments); + JSNode()->Script_Template_ExecInitialize(pArguments); } void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Template_CreateNode(pArguments); + JSNode()->Script_Template_CreateNode(pArguments); } void CXFA_Node::Script_Template_Recalculate(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Template_Recalculate(pArguments); + JSNode()->Script_Template_Recalculate(pArguments); } void CXFA_Node::Script_Template_ExecCalculate(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Template_ExecCalculate(pArguments); + JSNode()->Script_Template_ExecCalculate(pArguments); } void CXFA_Node::Script_Template_ExecValidate(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Template_ExecValidate(pArguments); + JSNode()->Script_Template_ExecValidate(pArguments); } void CXFA_Node::Script_Manifest_Evaluate(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Manifest_Evaluate(pArguments); + JSNode()->Script_Manifest_Evaluate(pArguments); } void CXFA_Node::Script_InstanceManager_Max(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_InstanceManager_Max(pValue, bSetting, eAttribute); + JSNode()->Script_InstanceManager_Max(pValue, bSetting, eAttribute); } void CXFA_Node::Script_InstanceManager_Min(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_InstanceManager_Min(pValue, bSetting, eAttribute); + JSNode()->Script_InstanceManager_Min(pValue, bSetting, eAttribute); } void CXFA_Node::Script_InstanceManager_Count(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_InstanceManager_Count(pValue, bSetting, eAttribute); + JSNode()->Script_InstanceManager_Count(pValue, bSetting, eAttribute); } void CXFA_Node::Script_InstanceManager_MoveInstance( CFXJSE_Arguments* pArguments) { - m_JSNode.Script_InstanceManager_MoveInstance(pArguments); + JSNode()->Script_InstanceManager_MoveInstance(pArguments); } void CXFA_Node::Script_InstanceManager_RemoveInstance( CFXJSE_Arguments* pArguments) { - m_JSNode.Script_InstanceManager_RemoveInstance(pArguments); + JSNode()->Script_InstanceManager_RemoveInstance(pArguments); } void CXFA_Node::Script_InstanceManager_SetInstances( CFXJSE_Arguments* pArguments) { - m_JSNode.Script_InstanceManager_SetInstances(pArguments); + JSNode()->Script_InstanceManager_SetInstances(pArguments); } void CXFA_Node::Script_InstanceManager_AddInstance( CFXJSE_Arguments* pArguments) { - m_JSNode.Script_InstanceManager_AddInstance(pArguments); + JSNode()->Script_InstanceManager_AddInstance(pArguments); } void CXFA_Node::Script_InstanceManager_InsertInstance( CFXJSE_Arguments* pArguments) { - m_JSNode.Script_InstanceManager_InsertInstance(pArguments); + JSNode()->Script_InstanceManager_InsertInstance(pArguments); } void CXFA_Node::Script_Occur_Max(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Occur_Max(pValue, bSetting, eAttribute); + JSNode()->Script_Occur_Max(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Occur_Min(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Occur_Min(pValue, bSetting, eAttribute); + JSNode()->Script_Occur_Min(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Desc_Metadata(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Desc_Metadata(pArguments); + JSNode()->Script_Desc_Metadata(pArguments); } void CXFA_Node::Script_Form_FormNodes(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Form_FormNodes(pArguments); + JSNode()->Script_Form_FormNodes(pArguments); } void CXFA_Node::Script_Form_Remerge(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Form_Remerge(pArguments); + JSNode()->Script_Form_Remerge(pArguments); } void CXFA_Node::Script_Form_ExecInitialize(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Form_ExecInitialize(pArguments); + JSNode()->Script_Form_ExecInitialize(pArguments); } void CXFA_Node::Script_Form_Recalculate(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Form_Recalculate(pArguments); + JSNode()->Script_Form_Recalculate(pArguments); } void CXFA_Node::Script_Form_ExecCalculate(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Form_ExecCalculate(pArguments); + JSNode()->Script_Form_ExecCalculate(pArguments); } void CXFA_Node::Script_Form_ExecValidate(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Form_ExecValidate(pArguments); + JSNode()->Script_Form_ExecValidate(pArguments); } void CXFA_Node::Script_Form_Checksum(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Form_Checksum(pValue, bSetting, eAttribute); + JSNode()->Script_Form_Checksum(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Packet_GetAttribute(pArguments); + JSNode()->Script_Packet_GetAttribute(pArguments); } void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Packet_SetAttribute(pArguments); + JSNode()->Script_Packet_SetAttribute(pArguments); } void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Packet_RemoveAttribute(pArguments); + JSNode()->Script_Packet_RemoveAttribute(pArguments); } void CXFA_Node::Script_Packet_Content(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Packet_Content(pValue, bSetting, eAttribute); + JSNode()->Script_Packet_Content(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Source_Next(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_Next(pArguments); + JSNode()->Script_Source_Next(pArguments); } void CXFA_Node::Script_Source_CancelBatch(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_CancelBatch(pArguments); + JSNode()->Script_Source_CancelBatch(pArguments); } void CXFA_Node::Script_Source_First(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_First(pArguments); + JSNode()->Script_Source_First(pArguments); } void CXFA_Node::Script_Source_UpdateBatch(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_UpdateBatch(pArguments); + JSNode()->Script_Source_UpdateBatch(pArguments); } void CXFA_Node::Script_Source_Previous(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_Previous(pArguments); + JSNode()->Script_Source_Previous(pArguments); } void CXFA_Node::Script_Source_IsBOF(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_IsBOF(pArguments); + JSNode()->Script_Source_IsBOF(pArguments); } void CXFA_Node::Script_Source_IsEOF(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_IsEOF(pArguments); + JSNode()->Script_Source_IsEOF(pArguments); } void CXFA_Node::Script_Source_Cancel(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_Cancel(pArguments); + JSNode()->Script_Source_Cancel(pArguments); } void CXFA_Node::Script_Source_Update(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_Update(pArguments); + JSNode()->Script_Source_Update(pArguments); } void CXFA_Node::Script_Source_Open(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_Open(pArguments); + JSNode()->Script_Source_Open(pArguments); } void CXFA_Node::Script_Source_Delete(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_Delete(pArguments); + JSNode()->Script_Source_Delete(pArguments); } void CXFA_Node::Script_Source_AddNew(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_AddNew(pArguments); + JSNode()->Script_Source_AddNew(pArguments); } void CXFA_Node::Script_Source_Requery(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_Requery(pArguments); + JSNode()->Script_Source_Requery(pArguments); } void CXFA_Node::Script_Source_Resync(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_Resync(pArguments); + JSNode()->Script_Source_Resync(pArguments); } void CXFA_Node::Script_Source_Close(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_Close(pArguments); + JSNode()->Script_Source_Close(pArguments); } void CXFA_Node::Script_Source_Last(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_Last(pArguments); + JSNode()->Script_Source_Last(pArguments); } void CXFA_Node::Script_Source_HasDataChanged(CFXJSE_Arguments* pArguments) { - m_JSNode.Script_Source_HasDataChanged(pArguments); + JSNode()->Script_Source_HasDataChanged(pArguments); } void CXFA_Node::Script_Source_Db(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Source_Db(pValue, bSetting, eAttribute); + JSNode()->Script_Source_Db(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Xfa_This(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Xfa_This(pValue, bSetting, eAttribute); + JSNode()->Script_Xfa_This(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Handler_Version(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Handler_Version(pValue, bSetting, eAttribute); + JSNode()->Script_Handler_Version(pValue, bSetting, eAttribute); } void CXFA_Node::Script_SubmitFormat_Mode(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_SubmitFormat_Mode(pValue, bSetting, eAttribute); + JSNode()->Script_SubmitFormat_Mode(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Extras_Type(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Extras_Type(pValue, bSetting, eAttribute); + JSNode()->Script_Extras_Type(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Script_Stateless(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Script_Stateless(pValue, bSetting, eAttribute); + JSNode()->Script_Script_Stateless(pValue, bSetting, eAttribute); } void CXFA_Node::Script_Encrypt_Format(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - m_JSNode.Script_Encrypt_Format(pValue, bSetting, eAttribute); + JSNode()->Script_Encrypt_Format(pValue, bSetting, eAttribute); } CXFA_Node* CXFA_Node::GetModelNode() { @@ -1673,7 +1581,7 @@ bool CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) { WideString wsName; pNode->JSNode()->GetAttribute(XFA_ATTRIBUTE_Name, wsName, false); CFX_XMLElement* pNewXMLElement = new CFX_XMLElement(wsName); - WideStringView wsValue = m_JSNode.GetCData(XFA_ATTRIBUTE_Value); + WideStringView wsValue = JSNode()->GetCData(XFA_ATTRIBUTE_Value); if (!wsValue.IsEmpty()) { pNewXMLElement->SetTextData(WideString(wsValue)); } @@ -1776,7 +1684,7 @@ CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() { break; } if (eType == XFA_Element::InstanceManager) { - WideStringView wsName = m_JSNode.GetCData(XFA_ATTRIBUTE_Name); + WideStringView wsName = JSNode()->GetCData(XFA_ATTRIBUTE_Name); WideStringView wsInstName = pNode->JSNode()->GetCData(XFA_ATTRIBUTE_Name); if (wsInstName.GetLength() > 0 && wsInstName[0] == '_' && @@ -1817,7 +1725,8 @@ void CXFA_Node::ClearFlag(uint32_t dwFlag) { } bool CXFA_Node::IsAttributeInXML() { - return m_JSNode.GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData; + return JSNode()->GetEnum(XFA_ATTRIBUTE_Contains) == + XFA_ATTRIBUTEENUM_MetaData; } void CXFA_Node::OnRemoved(bool bNotify) { @@ -1851,17 +1760,17 @@ void CXFA_Node::UpdateNameHash() { XFA_GetNotsureAttribute(GetElementType(), XFA_ATTRIBUTE_Name); WideStringView wsName; if (!pNotsure || pNotsure->eType == XFA_ATTRIBUTETYPE_Cdata) { - wsName = m_JSNode.GetCData(XFA_ATTRIBUTE_Name); + wsName = JSNode()->GetCData(XFA_ATTRIBUTE_Name); m_dwNameHash = FX_HashCode_GetW(wsName, false); } else if (pNotsure->eType == XFA_ATTRIBUTETYPE_Enum) { - wsName = GetAttributeEnumByID(m_JSNode.GetEnum(XFA_ATTRIBUTE_Name))->pName; + wsName = GetAttributeEnumByID(JSNode()->GetEnum(XFA_ATTRIBUTE_Name))->pName; m_dwNameHash = FX_HashCode_GetW(wsName, false); } } CFX_XMLNode* CXFA_Node::CreateXMLMappingNode() { if (!m_pXMLNode) { - WideString wsTag(m_JSNode.GetCData(XFA_ATTRIBUTE_Name)); + WideString wsTag(JSNode()->GetCData(XFA_ATTRIBUTE_Name)); m_pXMLNode = new CFX_XMLElement(wsTag); SetFlag(XFA_NodeFlag_OwnXMLNode, false); } @@ -1873,18 +1782,6 @@ bool CXFA_Node::IsNeedSavingXMLNode() { GetElementType() == XFA_Element::Xfa); } -void CXFA_Node::ThrowMissingPropertyException(const WideString& obj, - const WideString& prop) const { - ThrowException(L"'%s' doesn't have property '%s'.", obj.c_str(), - prop.c_str()); -} - -void CXFA_Node::ThrowTooManyOccurancesException(const WideString& obj) const { - ThrowException( - L"The element [%s] has violated its allowable number of occurrences.", - obj.c_str()); -} - CXFA_Node* CXFA_Node::GetItem(CXFA_Node* pInstMgrNode, int32_t iIndex) { ASSERT(pInstMgrNode); int32_t iCount = 0; diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h index 6151d738a2..02326d933a 100644 --- a/xfa/fxfa/parser/cxfa_node.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -53,8 +53,10 @@ class CXFA_Node : public CXFA_Object { void SetFlag(uint32_t dwFlag, bool bNotify); void ClearFlag(uint32_t dwFlag); - CJX_Node* JSNode() { return &m_JSNode; } - const CJX_Node* JSNode() const { return &m_JSNode; } + CJX_Node* JSNode() { return static_cast(JSObject()); } + const CJX_Node* JSNode() const { + return static_cast(JSObject()); + } CXFA_Node* GetParent() { return m_pParent; } CXFA_Node* GetChildNode() { return m_pChild; } @@ -141,10 +143,6 @@ class CXFA_Node : public CXFA_Object { CXFA_Node* GetOccurNode(); - int32_t Subform_and_SubformSet_InstanceIndex(); - int32_t InstanceManager_SetInstances(int32_t iCount); - int32_t InstanceManager_MoveInstance(int32_t iTo, int32_t iFrom); - void OnChanged(XFA_ATTRIBUTE eAttr, bool bNotify, bool bScriptModify); void OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify); @@ -429,10 +427,6 @@ class CXFA_Node : public CXFA_Object { bool bSetting, XFA_ATTRIBUTE eAttribute); - void ThrowMissingPropertyException(const WideString& obj, - const WideString& prop) const; - void ThrowTooManyOccurancesException(const WideString& obj) const; - private: friend class CXFA_Document; @@ -456,7 +450,6 @@ class CXFA_Node : public CXFA_Object { uint16_t m_uNodeFlags; uint32_t m_dwNameHash; CXFA_Node* m_pAuxNode; - CJX_Node m_JSNode; }; #endif // XFA_FXFA_PARSER_CXFA_NODE_H_ diff --git a/xfa/fxfa/parser/cxfa_nodelist.cpp b/xfa/fxfa/parser/cxfa_nodelist.cpp index cbee420870..4c5e5435c2 100644 --- a/xfa/fxfa/parser/cxfa_nodelist.cpp +++ b/xfa/fxfa/parser/cxfa_nodelist.cpp @@ -17,7 +17,8 @@ CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_ObjectType::NodeList, XFA_Element::NodeList, - WideStringView(L"nodeList")) { + WideStringView(L"nodeList"), + pdfium::MakeUnique(this)) { m_pDocument->GetScriptContext()->AddToCacheList( std::unique_ptr(this)); } @@ -38,13 +39,13 @@ CXFA_Node* CXFA_NodeList::NamedItem(const WideStringView& wsName) { void CXFA_NodeList::Script_ListClass_Append(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc != 1) { - ThrowParamCountMismatchException(L"append"); + JSObject()->ThrowParamCountMismatchException(L"append"); return; } CXFA_Node* pNode = static_cast(pArguments->GetObject(0)); if (!pNode) { - ThrowArgumentMismatchException(); + JSObject()->ThrowArgumentMismatchException(); return; } Append(pNode); @@ -53,14 +54,14 @@ void CXFA_NodeList::Script_ListClass_Append(CFXJSE_Arguments* pArguments) { void CXFA_NodeList::Script_ListClass_Insert(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc != 2) { - ThrowParamCountMismatchException(L"insert"); + JSObject()->ThrowParamCountMismatchException(L"insert"); return; } CXFA_Node* pNewNode = static_cast(pArguments->GetObject(0)); CXFA_Node* pBeforeNode = static_cast(pArguments->GetObject(1)); if (!pNewNode) { - ThrowArgumentMismatchException(); + JSObject()->ThrowArgumentMismatchException(); return; } Insert(pNewNode, pBeforeNode); @@ -69,13 +70,13 @@ void CXFA_NodeList::Script_ListClass_Insert(CFXJSE_Arguments* pArguments) { void CXFA_NodeList::Script_ListClass_Remove(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc != 1) { - ThrowParamCountMismatchException(L"remove"); + JSObject()->ThrowParamCountMismatchException(L"remove"); return; } CXFA_Node* pNode = static_cast(pArguments->GetObject(0)); if (!pNode) { - ThrowArgumentMismatchException(); + JSObject()->ThrowArgumentMismatchException(); return; } Remove(pNode); @@ -84,13 +85,13 @@ void CXFA_NodeList::Script_ListClass_Remove(CFXJSE_Arguments* pArguments) { void CXFA_NodeList::Script_ListClass_Item(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc != 1) { - ThrowParamCountMismatchException(L"item"); + JSObject()->ThrowParamCountMismatchException(L"item"); return; } int32_t iIndex = pArguments->GetInt32(0); if (iIndex < 0 || iIndex >= GetLength()) { - ThrowIndexOutOfBoundsException(); + JSObject()->ThrowIndexOutOfBoundsException(); return; } pArguments->GetReturnValue()->Assign( @@ -101,7 +102,7 @@ void CXFA_NodeList::Script_TreelistClass_NamedItem( CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc != 1) { - ThrowParamCountMismatchException(L"namedItem"); + JSObject()->ThrowParamCountMismatchException(L"namedItem"); return; } @@ -119,7 +120,7 @@ void CXFA_NodeList::Script_ListClass_Length(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { if (bSetting) { - ThrowInvalidPropertyException(); + JSObject()->ThrowInvalidPropertyException(); return; } pValue->SetInteger(GetLength()); diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp index c23420446a..d9deaaac9a 100644 --- a/xfa/fxfa/parser/cxfa_object.cpp +++ b/xfa/fxfa/parser/cxfa_object.cpp @@ -6,6 +6,8 @@ #include "xfa/fxfa/parser/cxfa_object.h" +#include + #include "core/fxcrt/fx_extension.h" #include "fxjs/cfxjse_value.h" #include "xfa/fxfa/cxfa_ffnotify.h" @@ -16,52 +18,22 @@ CXFA_Object::CXFA_Object(CXFA_Document* pDocument, XFA_ObjectType objectType, XFA_Element elementType, - const WideStringView& elementName) + const WideStringView& elementName, + std::unique_ptr jsObject) : CFXJSE_HostObject(kXFA), m_pDocument(pDocument), m_objectType(objectType), m_elementType(elementType), m_elementNameHash(FX_HashCode_GetW(elementName, false)), - m_elementName(elementName) {} + m_elementName(elementName), + m_pJSObject(std::move(jsObject)) {} CXFA_Object::~CXFA_Object() {} void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { - if (bSetting) { - ThrowInvalidPropertyException(); - return; - } - pValue->SetString(FX_UTF8Encode(GetClassName()).AsStringView()); -} - -void CXFA_Object::ThrowInvalidPropertyException() const { - ThrowException(L"Invalid property set operation."); -} - -void CXFA_Object::ThrowIndexOutOfBoundsException() const { - ThrowException(L"Index value is out of bounds."); -} - -void CXFA_Object::ThrowParamCountMismatchException( - const WideString& method) const { - ThrowException(L"Incorrect number of parameters calling method '%.16s'.", - method.c_str()); -} - -void CXFA_Object::ThrowArgumentMismatchException() const { - ThrowException(L"Argument mismatch in property or function argument."); -} - -void CXFA_Object::ThrowException(const wchar_t* str, ...) const { - WideString wsMessage; - va_list arg_ptr; - va_start(arg_ptr, str); - wsMessage.FormatV(str, arg_ptr); - va_end(arg_ptr); - ASSERT(!wsMessage.IsEmpty()); - FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringView()); + JSObject()->Script_ObjectClass_ClassName(pValue, bSetting, eAttribute); } CXFA_Node* CXFA_Object::AsNode() { diff --git a/xfa/fxfa/parser/cxfa_object.h b/xfa/fxfa/parser/cxfa_object.h index 3e305008b7..cec3346e8b 100644 --- a/xfa/fxfa/parser/cxfa_object.h +++ b/xfa/fxfa/parser/cxfa_object.h @@ -7,6 +7,8 @@ #ifndef XFA_FXFA_PARSER_CXFA_OBJECT_H_ #define XFA_FXFA_PARSER_CXFA_OBJECT_H_ +#include + #include "core/fxcrt/fx_string.h" #include "fxjs/fxjse.h" #include "xfa/fxfa/fxfa_basic.h" @@ -26,16 +28,13 @@ enum class XFA_ObjectType { }; class CFXJSE_Value; +class CJX_Object; class CXFA_Document; class CXFA_Node; class CXFA_NodeList; class CXFA_Object : public CFXJSE_HostObject { public: - CXFA_Object(CXFA_Document* pDocument, - XFA_ObjectType objectType, - XFA_Element eType, - const WideStringView& elementName); ~CXFA_Object() override; CXFA_Document* GetDocument() const { return m_pDocument.Get(); } @@ -70,6 +69,9 @@ class CXFA_Object : public CFXJSE_HostObject { const CXFA_Node* AsNode() const; const CXFA_NodeList* AsNodeList() const; + CJX_Object* JSObject() { return m_pJSObject.get(); } + const CJX_Object* JSObject() const { return m_pJSObject.get(); } + XFA_Element GetElementType() const { return m_elementType; } WideStringView GetClassName() const { return m_elementName; } uint32_t GetClassHashCode() const { return m_elementNameHash; } @@ -78,13 +80,12 @@ class CXFA_Object : public CFXJSE_HostObject { bool bSetting, XFA_ATTRIBUTE eAttribute); - void ThrowInvalidPropertyException() const; - void ThrowArgumentMismatchException() const; - void ThrowIndexOutOfBoundsException() const; - void ThrowParamCountMismatchException(const WideString& method) const; - protected: - void ThrowException(const wchar_t* str, ...) const; + CXFA_Object(CXFA_Document* pDocument, + XFA_ObjectType objectType, + XFA_Element eType, + const WideStringView& elementName, + std::unique_ptr jsObject); UnownedPtr const m_pDocument; const XFA_ObjectType m_objectType; @@ -92,6 +93,8 @@ class CXFA_Object : public CFXJSE_HostObject { const uint32_t m_elementNameHash; const WideStringView m_elementName; + + std::unique_ptr m_pJSObject; }; CXFA_Node* ToNode(CXFA_Object* pObj); diff --git a/xfa/fxfa/parser/cxfa_thisproxy.cpp b/xfa/fxfa/parser/cxfa_thisproxy.cpp index 55e676ecdc..6b84913afb 100644 --- a/xfa/fxfa/parser/cxfa_thisproxy.cpp +++ b/xfa/fxfa/parser/cxfa_thisproxy.cpp @@ -6,17 +6,17 @@ #include "xfa/fxfa/parser/cxfa_thisproxy.h" +#include "fxjs/cjx_object.h" +#include "third_party/base/ptr_util.h" #include "xfa/fxfa/parser/cxfa_node.h" CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) : CXFA_Object(pThisNode->GetDocument(), XFA_ObjectType::VariablesThis, XFA_Element::Unknown, - WideStringView()), - m_pThisNode(nullptr), - m_pScriptNode(nullptr) { - m_pThisNode = pThisNode; - m_pScriptNode = pScriptNode; -} + WideStringView(), + pdfium::MakeUnique(this)), + m_pThisNode(pThisNode), + m_pScriptNode(pScriptNode) {} CXFA_ThisProxy::~CXFA_ThisProxy() {} -- cgit v1.2.3