summaryrefslogtreecommitdiff
path: root/fxjs/ijs_runtime.h
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs/ijs_runtime.h')
-rw-r--r--fxjs/ijs_runtime.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/fxjs/ijs_runtime.h b/fxjs/ijs_runtime.h
index a21aae86de..9f15abaee0 100644
--- a/fxjs/ijs_runtime.h
+++ b/fxjs/ijs_runtime.h
@@ -34,10 +34,26 @@ class IJS_Runtime {
JS_Error(int line, int column, const WideString& exception);
};
+ class ScopedEventContext {
+ public:
+ explicit ScopedEventContext(IJS_Runtime* pRuntime)
+ : m_pRuntime(pRuntime), m_pContext(pRuntime->NewEventContext()) {}
+
+ ~ScopedEventContext() { m_pRuntime->ReleaseEventContext(m_pContext); }
+
+ IJS_EventContext* Get() const { return m_pContext; }
+ IJS_EventContext* operator->() const { return m_pContext; }
+
+ private:
+ IJS_Runtime* m_pRuntime;
+ IJS_EventContext* m_pContext;
+ };
+
static void Initialize(unsigned int slot, void* isolate);
static void Destroy();
static std::unique_ptr<IJS_Runtime> Create(
CPDFSDK_FormFillEnvironment* pFormFillEnv);
+
virtual ~IJS_Runtime();
virtual CJS_Runtime* AsCJSRuntime() = 0;