From e9f7db9dbb2c5b9d1953c6643e1c38f82130f98b Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 5 Jun 2018 18:24:12 +0000 Subject: [xfa] Make the event context available when calling back in XFA When calling into the XFA JS engine with a request for a non-XFA JS call which accesses the EventContext we would get a crash in XFA as we never set the context. This CL changes the XFA code to accept the CJS_Runtime instead of the CFXJS_Engine and then calls NewEventContext before executing JS scripts. This will correctly setup the event context as needed for any JS callbacks. Bug: pdfium:1003 Change-Id: Icf202252b2e6e56afdf0d1766a32a893935a2fd3 Reviewed-on: https://pdfium-review.googlesource.com/33930 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- fxjs/cfxjse_engine.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fxjs/cfxjse_engine.h') diff --git a/fxjs/cfxjse_engine.h b/fxjs/cfxjse_engine.h index dc05f0ddf8..62de0614c4 100644 --- a/fxjs/cfxjse_engine.h +++ b/fxjs/cfxjse_engine.h @@ -23,7 +23,7 @@ #define XFA_RESOLVENODE_TagName 0x0002 class CFXJSE_ResolveProcessor; -class CFXJS_Engine; +class CJS_Runtime; class CXFA_List; class CFXJSE_Engine : public CFX_V8 { @@ -52,7 +52,7 @@ class CFXJSE_Engine : public CFX_V8 { const ByteStringView& szPropName, bool bQueryIn); - CFXJSE_Engine(CXFA_Document* pDocument, CFXJS_Engine* fxjs_engine); + CFXJSE_Engine(CXFA_Document* pDocument, CJS_Runtime* fxjs_runtime); ~CFXJSE_Engine() override; void SetEventParam(CXFA_EventParam* param) { m_eventParam = param; } @@ -107,7 +107,7 @@ class CFXJSE_Engine : public CFX_V8 { bool bGetter); bool RunVariablesScript(CXFA_Node* pScriptNode); - UnownedPtr const m_pSubordinateEngine; + UnownedPtr const m_pSubordinateRuntime; UnownedPtr const m_pDocument; std::unique_ptr m_JsContext; CFXJSE_Class* m_pJsClass; -- cgit v1.2.3