| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fxfa/parser/xfa_script_imp.h" | 7 #include "xfa/fxfa/parser/xfa_script_imp.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
| 10 #include "xfa/fxfa/app/xfa_ffnotify.h" | 10 #include "xfa/fxfa/app/xfa_ffnotify.h" |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 FX_BOOL CXFA_ScriptContext::IsStrictScopeInJavaScript() { | 417 FX_BOOL CXFA_ScriptContext::IsStrictScopeInJavaScript() { |
| 418 return m_pDocument->HasFlag(XFA_DOCFLAG_StrictScoping); | 418 return m_pDocument->HasFlag(XFA_DOCFLAG_StrictScoping); |
| 419 } | 419 } |
| 420 XFA_SCRIPTLANGTYPE CXFA_ScriptContext::GetType() { | 420 XFA_SCRIPTLANGTYPE CXFA_ScriptContext::GetType() { |
| 421 return m_eScriptType; | 421 return m_eScriptType; |
| 422 } | 422 } |
| 423 void CXFA_ScriptContext::DefineJsContext() { | 423 void CXFA_ScriptContext::DefineJsContext() { |
| 424 m_pJsContext = FXJSE_Context_Create(m_pIsolate, &GlobalClassDescriptor, | 424 m_pJsContext = FXJSE_Context_Create(m_pIsolate, &GlobalClassDescriptor, |
| 425 m_pDocument->GetRoot()); | 425 m_pDocument->GetRoot()); |
| 426 RemoveBuiltInObjs(m_pJsContext); | 426 RemoveBuiltInObjs(m_pJsContext); |
| 427 FXJSE_Context_EnableCompatibleMode( | 427 FXJSE_Context_EnableCompatibleMode(m_pJsContext); |
| 428 m_pJsContext, FXJSE_COMPATIBLEMODEFLAG_CONSTRUCTOREXTRAMETHODS); | |
| 429 } | 428 } |
| 430 CFXJSE_Context* CXFA_ScriptContext::CreateVariablesContext( | 429 CFXJSE_Context* CXFA_ScriptContext::CreateVariablesContext( |
| 431 CXFA_Node* pScriptNode, | 430 CXFA_Node* pScriptNode, |
| 432 CXFA_Node* pSubform) { | 431 CXFA_Node* pSubform) { |
| 433 if (!pScriptNode || !pSubform) | 432 if (!pScriptNode || !pSubform) |
| 434 return nullptr; | 433 return nullptr; |
| 435 | 434 |
| 436 CFXJSE_Context* pVariablesContext = | 435 CFXJSE_Context* pVariablesContext = |
| 437 FXJSE_Context_Create(m_pIsolate, &VariablesClassDescriptor, | 436 FXJSE_Context_Create(m_pIsolate, &VariablesClassDescriptor, |
| 438 new CXFA_ThisProxy(pSubform, pScriptNode)); | 437 new CXFA_ThisProxy(pSubform, pScriptNode)); |
| 439 RemoveBuiltInObjs(pVariablesContext); | 438 RemoveBuiltInObjs(pVariablesContext); |
| 440 FXJSE_Context_EnableCompatibleMode( | 439 FXJSE_Context_EnableCompatibleMode(pVariablesContext); |
| 441 pVariablesContext, FXJSE_COMPATIBLEMODEFLAG_CONSTRUCTOREXTRAMETHODS); | |
| 442 m_mapVariableToContext.SetAt(pScriptNode, pVariablesContext); | 440 m_mapVariableToContext.SetAt(pScriptNode, pVariablesContext); |
| 443 return pVariablesContext; | 441 return pVariablesContext; |
| 444 } | 442 } |
| 445 CXFA_Object* CXFA_ScriptContext::GetVariablesThis(CXFA_Object* pObject, | 443 CXFA_Object* CXFA_ScriptContext::GetVariablesThis(CXFA_Object* pObject, |
| 446 FX_BOOL bScriptNode) { | 444 FX_BOOL bScriptNode) { |
| 447 if (pObject->GetObjectType() != XFA_OBJECTTYPE_VariablesThis) | 445 if (pObject->GetObjectType() != XFA_OBJECTTYPE_VariablesThis) |
| 448 return pObject; | 446 return pObject; |
| 449 | 447 |
| 450 CXFA_ThisProxy* pProxy = static_cast<CXFA_ThisProxy*>(pObject); | 448 CXFA_ThisProxy* pProxy = static_cast<CXFA_ThisProxy*>(pObject); |
| 451 return bScriptNode ? pProxy->GetScriptNode() : pProxy->GetThisNode(); | 449 return bScriptNode ? pProxy->GetScriptNode() : pProxy->GetThisNode(); |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 } | 762 } |
| 765 } | 763 } |
| 766 void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) { | 764 void CXFA_ScriptContext::AddNodesOfRunScript(CXFA_Node* pNode) { |
| 767 if (!m_pScriptNodeArray) { | 765 if (!m_pScriptNodeArray) { |
| 768 return; | 766 return; |
| 769 } | 767 } |
| 770 if (m_pScriptNodeArray->Find(pNode) == -1) { | 768 if (m_pScriptNodeArray->Find(pNode) == -1) { |
| 771 m_pScriptNodeArray->Add(pNode); | 769 m_pScriptNodeArray->Add(pNode); |
| 772 } | 770 } |
| 773 } | 771 } |
| OLD | NEW |