-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: feature to disable pdf javascript (#176)
- Loading branch information
Showing
2 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
diff --git a/pdf/pdf_features.cc b/pdf/pdf_features.cc | ||
index e4dbc7d5b0834..973bc515cea96 100644 | ||
--- a/pdf/pdf_features.cc | ||
+++ b/pdf/pdf_features.cc | ||
@@ -13,6 +13,10 @@ namespace { | ||
bool g_is_oopif_pdf_policy_enabled = true; | ||
} // namespace | ||
|
||
+// Trivalent | ||
+BASE_FEATURE(kPdfJavaScript, "PdfJavaScript", | ||
+ base::FEATURE_ENABLED_BY_DEFAULT); | ||
+ | ||
BASE_FEATURE(kAccessiblePDFForm, | ||
"AccessiblePDFForm", | ||
base::FEATURE_DISABLED_BY_DEFAULT); | ||
diff --git a/pdf/pdf_features.h b/pdf/pdf_features.h | ||
index 23c38c6138328..cc2489e911a6c 100644 | ||
--- a/pdf/pdf_features.h | ||
+++ b/pdf/pdf_features.h | ||
@@ -15,6 +15,9 @@ static_assert(BUILDFLAG(ENABLE_PDF), "ENABLE_PDF not set to true"); | ||
|
||
namespace chrome_pdf::features { | ||
|
||
+// Trivalent | ||
+BASE_DECLARE_FEATURE(kPdfJavaScript); | ||
+ | ||
BASE_DECLARE_FEATURE(kAccessiblePDFForm); | ||
BASE_DECLARE_FEATURE(kPdfCr23); | ||
BASE_DECLARE_FEATURE(kPdfIncrementalLoading); | ||
diff --git a/pdf/pdfium/pdfium_form_filler.cc b/pdf/pdfium/pdfium_form_filler.cc | ||
index f319c45d075e2..d1b311d76d1d3 100644 | ||
--- a/pdf/pdfium/pdfium_form_filler.cc | ||
+++ b/pdf/pdfium/pdfium_form_filler.cc | ||
@@ -41,6 +41,8 @@ std::string WideStringToString(FPDF_WIDESTRING wide_string) { | ||
|
||
// static | ||
PDFiumFormFiller::ScriptOption PDFiumFormFiller::DefaultScriptOption() { | ||
+ if (!base::FeatureList::IsEnabled(features::kPdfJavaScript)) | ||
+ return PDFiumFormFiller::ScriptOption::kNoJavaScript; | ||
#if defined(PDF_ENABLE_XFA) | ||
if (base::FeatureList::IsEnabled(features::kPdfXfaSupport)) | ||
return PDFiumFormFiller::ScriptOption::kJavaScriptAndXFA; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters