summaryrefslogtreecommitdiff
path: root/fxjs/ijs_runtime.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-04-23 18:02:57 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-23 18:02:57 +0000
commit0784c7317e3aaa2c65d098cf2593b6b49986307d (patch)
treea264d06dcd9fd0d914324d5bd0a96430cc543b87 /fxjs/ijs_runtime.cpp
parent9f71afb882a9d1294f8a4392b8553e2c285f51c7 (diff)
downloadpdfium-0784c7317e3aaa2c65d098cf2593b6b49986307d.tar.xz
Disable JavaScript entirely if no JSPlatform passed by embedder.
Allows run-time selection of whether to permit JS inside PDF. Previously, this was a link-time decision only. This requires a little more caution before we decide that we have the CJS_Runtime, and not the CJS_RuntimeStub in a few casts. Adds a kDisableJavaScript option to the form fill embeddertests. Adds a --disable-javascript flag to the pdfium_test executable. Also adds a --disable-xfa flag while we're at it. Change-Id: I8d8ac95f6474459cadba9a60572fbb342e984646 Reviewed-on: https://pdfium-review.googlesource.com/31090 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/ijs_runtime.cpp')
-rw-r--r--fxjs/ijs_runtime.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/fxjs/ijs_runtime.cpp b/fxjs/ijs_runtime.cpp
index 03538cd7b5..79238bfe11 100644
--- a/fxjs/ijs_runtime.cpp
+++ b/fxjs/ijs_runtime.cpp
@@ -31,8 +31,10 @@ void IJS_Runtime::Destroy() {
std::unique_ptr<IJS_Runtime> IJS_Runtime::Create(
CPDFSDK_FormFillEnvironment* pFormFillEnv) {
#ifdef PDF_ENABLE_V8
- return pdfium::MakeUnique<CJS_Runtime>(pFormFillEnv);
-#else
- return pdfium::MakeUnique<CJS_RuntimeStub>(pFormFillEnv);
+ if (pFormFillEnv->IsJSPlatformPresent())
+ return pdfium::MakeUnique<CJS_Runtime>(pFormFillEnv);
#endif
+ return pdfium::MakeUnique<CJS_RuntimeStub>(pFormFillEnv);
}
+
+IJS_Runtime::~IJS_Runtime() = default;