From bfa2a97ca9f5026ceb8e8c2ce23cfc3c3e8b38a1 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 24 Jul 2017 11:38:31 -0700 Subject: Observe Annot destruction in CPDFSDK_PageView::DeleteAnnot Run test XFA-Only, since that's where the issue occurs, and the textual output is different for non-xfa. Fix a few lifetime issue in pdfium_test.cc unearthed by this test (doc must outlive pages now held in formfill info). Bug: 735912 Change-Id: Icc9e6a967c32ece67d897117896c973bb16a1515 Reviewed-on: https://pdfium-review.googlesource.com/8510 Commit-Queue: Tom Sepez Reviewed-by: dsinclair --- testing/resources/javascript/bug_735912.in | 115 +++++++++++++++++++++ .../resources/javascript/bug_735912_expected.txt | 2 + 2 files changed, 117 insertions(+) create mode 100644 testing/resources/javascript/bug_735912.in create mode 100644 testing/resources/javascript/bug_735912_expected.txt (limited to 'testing/resources/javascript') diff --git a/testing/resources/javascript/bug_735912.in b/testing/resources/javascript/bug_735912.in new file mode 100644 index 0000000000..7f42d1b7c2 --- /dev/null +++ b/testing/resources/javascript/bug_735912.in @@ -0,0 +1,115 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R + /AcroForm 4 0 R + /OpenAction 30 0 R +>> +endobj +{{object 2 0}} << + /Type /Pages + /Count 1 + /Kids [ + 3 0 R + ] +>> +endobj +% Page number 0. +{{object 3 0}} << + /Type /Page + /Parent 2 0 R + /Annots [ + 8 0 R + ] + /AA << /C 36 0 R >> +>> +endobj +% Forms +{{object 4 0}} << + /XFA [ + (xdp:xdp) 43 0 R + (form) 49 0 R + () 50 0 R + ] + /Fields [ + 8 0 R + ] +>> +endobj +% Fields +{{object 8 0}} << + /FT /Tx + /T (MyField) + /Type /Annot + /Subtype /Widget + /Rect [100 300 500 400] + /AA << /Bl 34 0 R >> +>> +endobj +% JS Action +{{object 30 0}} << + /Type /Action + /S /JavaScript + /JS 31 0 R +>> +endobj +% JS program to exexute +{{object 31 0}} << +>> +stream +this.getField("MyField").setFocus(); +app.alert("focused"); +endstream +endobj +% Lost Focus AAction MyField +{{object 34 0}} << + /Type /Action + /S /JavaScript + /JS 35 0 R +>> +endobj +% JS program to exexute +{{object 35 0}} << +>> +stream +this.removeField("MyField"); +app.alert("removed"); +endstream +endobj +% Closing Page 0 +{{object 36 0}} << + /Type /Action + /S /JavaScript + /JS 37 0 R +>> +endobj +% JS program to exexute +{{object 37 0}} << +>> +stream +this.removeField("MyField"); +endstream +endobj +{{object 43 0}} << +>>stream + + +endstream +endobj +{{object 49 0}} << +>>stream + + +endstream +endobj +{{object 50 0}} << +>>stream + +endstream +endobj +{{xref}} +trailer << + /Root 1 0 R +>> +{{startxref}} +%%EOF diff --git a/testing/resources/javascript/bug_735912_expected.txt b/testing/resources/javascript/bug_735912_expected.txt new file mode 100644 index 0000000000..7d0f42f517 --- /dev/null +++ b/testing/resources/javascript/bug_735912_expected.txt @@ -0,0 +1,2 @@ +Alert: removed +Alert: focused -- cgit v1.2.3