summaryrefslogtreecommitdiff
path: root/fxjs/cjs_runtimestub.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-04-18 22:48:22 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-18 22:48:22 +0000
commita1fe73272892b668bd5928a836ecc6303c81e2fd (patch)
tree959f9576d3cfe49ad48f7a765bec64d7a954d3ff /fxjs/cjs_runtimestub.h
parentfbecb9a5150d2c5391581933c8089e7249292171 (diff)
downloadpdfium-a1fe73272892b668bd5928a836ecc6303c81e2fd.tar.xz
Always build JS Runtime stubs even if V8 present.
Prerequisite for switching V8 off at run-time. Change-Id: I4b9f867185758350f5de3f57e771f63020df6e65 Reviewed-on: https://pdfium-review.googlesource.com/30994 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cjs_runtimestub.h')
-rw-r--r--fxjs/cjs_runtimestub.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/fxjs/cjs_runtimestub.h b/fxjs/cjs_runtimestub.h
new file mode 100644
index 0000000000..ecf3b4eb8a
--- /dev/null
+++ b/fxjs/cjs_runtimestub.h
@@ -0,0 +1,42 @@
+// Copyright 2018 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXJS_CJS_RUNTIMESTUB_H_
+#define FXJS_CJS_RUNTIMESTUB_H_
+
+#include <memory>
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/unowned_ptr.h"
+#include "fxjs/ijs_runtime.h"
+
+class CPDFSDK_FormFillEnvironment;
+class IJS_EventContext;
+
+class CJS_RuntimeStub final : public IJS_Runtime {
+ public:
+ explicit CJS_RuntimeStub(CPDFSDK_FormFillEnvironment* pFormFillEnv);
+ ~CJS_RuntimeStub() override;
+
+ IJS_EventContext* NewEventContext() override;
+ void ReleaseEventContext(IJS_EventContext* pContext) override;
+ CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override;
+
+#ifdef PDF_ENABLE_XFA
+ bool GetValueByNameFromGlobalObject(const ByteStringView&,
+ CFXJSE_Value*) override;
+ bool SetValueByNameInGlobalObject(const ByteStringView&,
+ CFXJSE_Value*) override;
+#endif // PDF_ENABLE_XFA
+
+ int ExecuteScript(const WideString& script, WideString* info) override;
+
+ protected:
+ UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
+ std::unique_ptr<IJS_EventContext> m_pContext;
+};
+
+#endif // FXJS_CJS_RUNTIMESTUB_H_