summaryrefslogtreecommitdiff
path: root/pdf/pdf_form.c
diff options
context:
space:
mode:
authorPaul Gardiner <paulg.artifex@glidos.net>2012-08-24 09:04:20 +0100
committerPaul Gardiner <paulg.artifex@glidos.net>2012-08-24 09:04:20 +0100
commit333d8c765d298b697ef8c29a1f8a192238b21b67 (patch)
tree4f59cc7e3d15bfb821e65b6e753b5a8aac017dea /pdf/pdf_form.c
parent46aa12efced7578b466b2c49bf8e2c512ebf0b49 (diff)
downloadmupdf-333d8c765d298b697ef8c29a1f8a192238b21b67.tar.xz
Forms: avoid javascript action execution when engine not available
This was necessary to avoid indirecting through a NULL pointer returned from pdf_js_get_event, but is a generally sensible restriction. Also separate the execution of the document-level javascript actions from the pdf_js contstructor, so that doc->js is set during those actions. Also add a missing const
Diffstat (limited to 'pdf/pdf_form.c')
-rw-r--r--pdf/pdf_form.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pdf/pdf_form.c b/pdf/pdf_form.c
index 18b45631..cb92956f 100644
--- a/pdf/pdf_form.c
+++ b/pdf/pdf_form.c
@@ -1558,7 +1558,7 @@ void pdf_update_appearance(pdf_document *doc, pdf_obj *obj)
case FZ_WIDGET_TYPE_TEXT:
{
pdf_obj *formatting = pdf_dict_getp(obj, "AA/F");
- if (formatting)
+ if (formatting && doc->js)
{
/* Apply formatting */
pdf_js_event e;
@@ -1863,7 +1863,7 @@ static void recalculate(pdf_document *doc)
{
pdf_obj *co = pdf_dict_getp(doc->trailer, "Root/AcroForm/CO");
- if (co)
+ if (co && doc->js)
{
int i, n = pdf_array_len(co);
@@ -1902,7 +1902,7 @@ int pdf_field_setValue(pdf_document *doc, pdf_obj *field, char *text)
{
pdf_obj *v = pdf_dict_getp(field, "AA/V");
- if (v)
+ if (v && doc->js)
{
pdf_js_event e;
@@ -2116,7 +2116,7 @@ static int run_keystroke(pdf_document *doc, pdf_obj *field, char **text)
{
pdf_obj *k = pdf_dict_getp(field, "AA/K");
- if (k)
+ if (k && doc->js)
{
pdf_js_event e;