diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-04-23 18:02:57 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-23 18:02:57 +0000 |
commit | 0784c7317e3aaa2c65d098cf2593b6b49986307d (patch) | |
tree | a264d06dcd9fd0d914324d5bd0a96430cc543b87 /fpdfsdk/fpdf_formfill_embeddertest.cpp | |
parent | 9f71afb882a9d1294f8a4392b8553e2c285f51c7 (diff) | |
download | pdfium-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 'fpdfsdk/fpdf_formfill_embeddertest.cpp')
-rw-r--r-- | fpdfsdk/fpdf_formfill_embeddertest.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_formfill_embeddertest.cpp b/fpdfsdk/fpdf_formfill_embeddertest.cpp index 09e0c200d3..cedb96c0ca 100644 --- a/fpdfsdk/fpdf_formfill_embeddertest.cpp +++ b/fpdfsdk/fpdf_formfill_embeddertest.cpp @@ -380,6 +380,36 @@ TEST_F(FPDFFormFillEmbeddertest, BUG_514690) { } #ifdef PDF_ENABLE_V8 +TEST_F(FPDFFormFillEmbeddertest, DisableJavaScript) { + // Test that timers and intervals can't fire without JS. + EmbedderTestTimerHandlingDelegate delegate; + SetDelegate(&delegate); + + EXPECT_TRUE(OpenDocumentWithoutJavaScript("bug_551248.pdf")); + FPDF_PAGE page = LoadPage(0); + EXPECT_TRUE(page); + DoOpenActions(); + + const auto& alerts = delegate.GetAlerts(); + EXPECT_EQ(0U, alerts.size()); + + delegate.AdvanceTime(1000); + EXPECT_EQ(0U, alerts.size()); // nothing fired. + delegate.AdvanceTime(1000); + EXPECT_EQ(0U, alerts.size()); // nothing fired. + delegate.AdvanceTime(1000); + EXPECT_EQ(0U, alerts.size()); // nothing fired. + delegate.AdvanceTime(1000); + EXPECT_EQ(0U, alerts.size()); // nothing fired. + delegate.AdvanceTime(1000); + EXPECT_EQ(0U, alerts.size()); // nothing fired. + delegate.AdvanceTime(1000); + EXPECT_EQ(0U, alerts.size()); // nothing fired. + delegate.AdvanceTime(1000); + EXPECT_EQ(0U, alerts.size()); // nothing fired. + UnloadPage(page); +} + TEST_F(FPDFFormFillEmbeddertest, BUG_551248) { // Test that timers fire once and intervals fire repeatedly. EmbedderTestTimerHandlingDelegate delegate; |