summaryrefslogtreecommitdiff
path: root/testing/resources/javascript
AgeCommit message (Collapse)Author
2018-06-07Convert resolve_nodes.pdf into 3 test casesRyan Harrison
There are 3 elements in the PDF that can be interacted with that cause testable output. This CL creates test cases for each of these elements. 2 of them work correctly, and a new bug, pdfium:1106, has been filed for the third. BUG=pdfium:1020 Change-Id: I524911d03927a0eeeee1d1479e1a855f90269e8e Reviewed-on: https://pdfium-review.googlesource.com/34370 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-15Use {{streamlen}} macro in testing/resources/javascript/*.inTom Sepez
Change-Id: I1d2a91619a1c944b6fdca00b2f9c5bb338326986 Reviewed-on: https://pdfium-review.googlesource.com/32572 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-15Use {{trailer}} macro in testing/resources/javascript/*.inTom Sepez
Also format the trailer in a cleaner multi-line format. Change-Id: If145834b56f8678f97247b346cc0cfd4d367c501 Reviewed-on: https://pdfium-review.googlesource.com/32571 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-15Test app.beep() in standalone PDFium.Tom Sepez
Precursor to testing app.beep() in chrome's browser tests. Change-Id: I09ef497bd6a8094e389783b144fa04c9230cbe3d Reviewed-on: https://pdfium-review.googlesource.com/32550 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-01-29Roll V8 to ee5d9a0c.Lei Zhang
Update test expectations after V8 enabled --harmony-function-tostring by default. https://chromium.googlesource.com/v8/v8/+log/0c287882..ee5d9a0c TBR=dsinclair@chromium.org Change-Id: I4eabc6b2ed854153dcbfb75f527e209f57e86a2a Reviewed-on: https://pdfium-review.googlesource.com/24110 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-08-31Implement FORM_OnFocus() API.Lei Zhang
Given a point, if there is an annotation at the point, give if focus if it is not focus already. If there is no annotation at the point, then remove the focus from the focused annotation. BUG=chromium:754594 Change-Id: Iec3070472bbbfbad9d86e517f25da560f82efd4e Reviewed-on: https://pdfium-review.googlesource.com/12530 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-24Observe Annot destruction in CPDFSDK_PageView::DeleteAnnotTom Sepez
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 <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-17More tightly validate format strings in util.cpp.chromium/3160Tom Sepez
Re-work the previous fix to be even more particular about the input. Bug: chromium:740166 Change-Id: I6bea3b6a6dd320a83f830b07afd52951be7d1b63 Reviewed-on: https://pdfium-review.googlesource.com/7691 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-13Fix invalid write for util.printfDan Sinclair
This CL fixes and invalid WRITE triggered by calling util.printf. We need to verify that the integer format will be less then 260 characters. Bug: chromium:740166 Change-Id: I1c9047101780582da5f39088568727e2c8b4c2d2 Reviewed-on: https://pdfium-review.googlesource.com/7630 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-06-16Avoid a crash inside wcsftime() on Windows.chromium/3135chromium/3134chromium/3133Lei Zhang
BUG=chromium:733245 Change-Id: Ic9347e2cc245831c0b71fac1d531c33c5646ab3f Reviewed-on: https://pdfium-review.googlesource.com/6671 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-15Add array_buffer JS test.Tom Sepez
JS Array Buffers are the first candidate to be allocated from PartitionAlloc when it becomes available, so add test first. Presently, we will return as large an array buffer as the system can handle; this is generally a bad idea so limit them to 256MB and test that we handle failure. Change-Id: I205745a7938d69eb32ac883b90824f2f9e584ec7 Reviewed-on: https://pdfium-review.googlesource.com/3065 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-02-27Fix uninitialized memory read in CJS_Object::GetEmbedObject()Tom Sepez
The expected way to create native PDFium objects for JS is via the NewFxDynamicObject() call in C++, but that doesn't mean that the corresponding constructors won't be called from JS. In that case, the internal fields will be uninitialized, and subsequent method calls may try to use them. Add a constructor callback for all PDFium objects that nulls out these fields (shame that v8 doesn't do this by default, but probably saves some cycles). Then ensure that we check for this possibility in all the places it might turn up. Conversely, if we've just gotten a successful return from NewFxDynamicObject(), we know the CJS_Object/EmbedObj are good, so avoid checking there. BUG=695826 Change-Id: Iadad644c4af937def967ddc83daac1dad7544d69 Reviewed-on: https://pdfium-review.googlesource.com/2839 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-01-12Custom toString() methods may delete annots.tsepez
In this case, we observe the destruction of the object, but have unfortunately saved a pointer to it in a local variable. BUG=679643 Review-Url: https://codereview.chromium.org/2628233002
2017-01-11Annotation deleted while retrieving it in JStsepez
Widgets as returned from GetWidgets() can pop out of existence unexpectedly, so always return observed pointers. This extends the same pattern used elsewhere in the file to all occurrences. BUG=679642 Review-Url: https://codereview.chromium.org/2624933002
2016-10-18Add a test case for bug 494057.thestig
The expectation is set incorrectly to allow the test to pass. BUG=chromium:494057 Review-Url: https://codereview.chromium.org/2430583002
2016-08-26Add support to Document::getAnnots methodtonikitoo
Although notably, the parameters handling support is not complete, CL intends to be the first step towards a more complete implementation of this API. TEST=testing/resources/javascript/bug_492_1.in BUG=pdfium:492 Review-Url: https://codereview.chromium.org/2281273002
2016-08-19Stub out Document::syncAnnotScan method.chromium/2834tonikitoo
The PDF specification [1] says: " syncAnnotScan guarantees that all annotations will be scanned by the time this method returns. (..) Normally a background task runs that examine every page and looks for annotations during idle times. " The statement details specifically how Acrobat implements this method. Although, neither the method itself nor the background scanner task are implemented in PDFium (as of today, Ago/2016), not having ::syncAnnotScan at least stubbed out can be considered harmfull since its absence makes JS acrobat scripts silently fail when it has a call to it. Given that, and following a stub-out pattern present in other methods including ::addAnnot and ::addField, CL provides a stubbed out implementation of Document::syncAnnotScan. [1] http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/js_api_reference.pdf BUG=pdfium:492 Review-Url: https://codereview.chromium.org/2265553002
2016-08-18Add initial Document::getAnnot supportchromium/2833tonikitoo
CL implements the first step in order to support Annotations manipulation in PDFium: Document::getAnnot. The method takes two arguments, an integer (page number) and a string (annotation name). When called, it iterates over the annotations on the given page number, searching for the one whose name matches the string in the second parameter. If found, then an Annot instance (see Annot.cpp/g added by this CL), is bound to a Javascript object and returned. With the use cases described in bug [1] as an initial test case, CL adds support to the following Annotation object properties: - hidden - name - type Idea is to keep evolving the implementation with more methods and properties in follow up CLs. [1] https://bugs.chromium.org/p/pdfium/issues/detail?id=492 BUG=pdfium:492 Review-Url: https://codereview.chromium.org/2260663002
2016-08-10Make Document's 'info' property readonlytonikitoo
As per the PDF specification in [1], page 103, the 'info' property of the Document object is readonly. [1] http://partners.adobe.com/public/developer/en/acrobat/sdk/5186AcroJS.pdf Review-Url: https://codereview.chromium.org/2235883003
2016-08-08Add support to Document::gotoNamedDest method.tonikitoo
Patch implements the Document's API gotoNamedDest, which is part of the PDF specification [1], page 129, with the following (short) description: "Use this method to go to a named destination within the PDF document". [1] http://partners.adobe.com/public/developer/en/acrobat/sdk/5186AcroJS.pdf "Named destination" is a common concept in the PDF world. It can be used together with PDF's Links, Annotations, Bookmarks and OpenActions, as well as an action per se, in case "this.gotoNamedDest" is called directly. Note that the implementation makes use of the existing hook CPDFDoc_Environment::FFI_DoGoToAction, which ends up calling out the embedder to actually handle it. In case of Chromium, for instance, it calls PDFiumEngine::Form_DoGoToAction which only handles for now the "page" property of the "destination". Other properties, including zoom level, and scroll position are ignored for the moment. BUG=pdfium:492 Review-Url: https://codereview.chromium.org/2221823003
2016-08-08Add support to Document::URL property getter.tonikitoo
As per the PDF specification at [1] " This property specifies the document's URL. ". IE/Acrobat supports it, and getting it implemented would be one step forward in order to support Acrobat JS script as the one in [2]. [1] http://partners.adobe.com/public/developer/en/acrobat/sdk/5186AcroJS.pdf [2] https://bugs.chromium.org/p/pdfium/issues/detail?id=492 BUG=492 Review-Url: https://codereview.chromium.org/2219183002
2016-03-29Add test for util.byteToChar() and fix error msg.tsepez
Review URL: https://codereview.chromium.org/1838543002
2016-03-28Added test for util.printx() and make it match spec.tsepez
R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1837543002
2016-03-25util.printd() replaces specified date with current date.tsepez
Added test case. Several bugs going on here: JS_LocalTime() ignoring argument and returning current time and not factoring in the time zone adjustment. Use of FXSYS_floor() silently casts result to float, losing precision required to extract minutes and seconds. Pre-existing wcsftime escapes not stripped. BUG=pdfium:413 Review URL: https://codereview.chromium.org/1833053002
2016-03-03Add JS tests for global const equality.Tom Sepez
Add these tests before fixing bug 419. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1761923002 .
2016-02-01Merge to XFA: Use JS_ExpandKeywordParams() in app.response()Tom Sepez
Original Review URL: https://codereview.chromium.org/1654523002 . (cherry picked from commit 3859258ebe9e81e1f766b57e7f78c786ae4ed495) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1658753002 .
2016-02-01Merge to XFA: Add Test for field.getArray() sort-order.Tom Sepez
Review URL: https://codereview.chromium.org/1650623004 . (cherry picked from commit 56d618ac9b4c82a9a350f21bbc6ec2ec6a95c8b0) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1657533004 .
2016-01-29Merge to XFA: Fix botched "CC:" parameter passing in JS_DocmailForm().Tom Sepez
Original Review URL: https://codereview.chromium.org/1645413002 . (cherry picked from commit 6902db5cbaf0afb8f2cb4df325e1a4e7d6acd53f) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1648793006 .
2016-01-29Merge to XFA: Fix behaviour of app.alert() with a single object argument.Tom Sepez
Original Review URL: https://codereview.chromium.org/1641693003 . (cherry picked from commit 66519af52b61ca158044651d0507d47efb364f87) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1639253008 .
2016-01-20Merge to XFA: Bugs in CJS_PublicMethods::ParseNumber().Tom Sepez
Original Review URL: https://codereview.chromium.org/1586203006 . (cherry picked from commit f13d510cf267c27f4c123494de67670ec201cedc) BUG=pdfium:361 R=ochang@chromium.org TBR=ochang@chromium.org Review URL: https://codereview.chromium.org/1603173004 .
2016-01-15Merge to XFA: Make the bug 361 test case work in Acrobat.Lei Zhang
BUG=pdfium:361 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1586983005 . (cherry picked from commit a943a2516e5483012e0fbef7e8fafbed1b22ed95) Review URL: https://codereview.chromium.org/1582413007 .
2016-01-14Merge to XFA: Additional test cases for bug_361Tom Sepez
Original Review URL: https://codereview.chromium.org/1582383002 . (cherry picked from commit 1a82d5c28be2ebdb7524a7249e43026546d0ebf0) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1590053002 .
2016-01-13Merge to XFA: test cast for bug_361Tom Sepez
Original Review URL: https://codereview.chromium.org/1588733003 . (cherry picked from commit 15367cbbb7b8bea2549212b3c9c1f01727c6ccb5) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1584563005 .
2015-10-28XFA: Update document_methods javascript test.Tom Sepez
TBR=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1430663003 .
2015-09-30Merge to XFA: Add signatures to FXJS_V8.Tom Sepez
(cherry picked from commit 158e335717efba9dce3aa6f6d1e31ed884e1f59e) Original Review URL: https://codereview.chromium.org/1353193004 . TBR=jochen@chromium.org, krasin@google.com Review URL: https://codereview.chromium.org/1376343002 .
2015-09-28Merge to XFA: Introduce kPerIsolateDataIndex and tidy JS_Define.hTom Sepez
(cherry picked from commit d6d9dc6b9a45368abdf43477592ee9f6cdb6102e) (cherry picked from commit cfff2f65aaec70247d020188bc68a0dc4fb34c3e) Original Review URL: https://codereview.chromium.org/1372963003 . Original Review URL: https://codereview.chromium.org/1367813003 . TBR=jochen@chromium.org Review URL: https://codereview.chromium.org/1370133007 .
2015-09-11Merge to XFA: Fix strings, ..., void return types for Consts.h.Tom Sepez
(cherry picked from commit f9e40aec10263f9445d69598657f42550294d653) Orignal Review URL: https://codereview.chromium.org/1342433002 . R=thestig@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1338003004 .
2015-09-08Merge to XFA: Beef up app_props.in and tidy app.cpp.Tom Sepez
Small manual edit in fpdfsdk/src/javascript/app.cpp (cherry picked from commit b830fbc03a6d12d8b5be50e85499c281a4c5da7f) Original Review URL: https://codereview.chromium.org/1317393003 . R=thestig@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1302423008 .
2015-09-08Merge to XFA: Change the JS app.viewerType() return value to "pdfium"Lei Zhang
BUG=pdfium:181 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1331633002 . (cherry picked from commit 4bc64cabc561d5df211ed02dc75c85e41fa91312) Review URL: https://codereview.chromium.org/1327523007 .
2015-08-31Merge to XFA: Fix two issues shown by bug 489995Tom Sepez
(cherry picked from commit 6e369c2ebb4769a42736b32154c0de12b73df45d) Original Review URL: https://codereview.chromium.org/1327473002 . BUG=489995 R=thestig@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1325743002 .
2015-07-24Merge to XFA: document.delay and document.external are boolean properties.Tom Sepez
(cherry picked from commit aafeff816e22c1333c17d8a0eb4fe8927c28142d) Original Review URL: https://codereview.chromium.org/1242263010 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1244023004 .
2015-04-23Merge to XFA: Remove unused nParamNum values from JS method tables.Tom Sepez
Original Review URL: https://codereview.chromium.org/1084183008 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1105813002
2015-03-02Merge to XFA: Return error information from pdfium to JS.Tom Sepez
Cherry-pick from b720d0a14601f1496ef15297bc46d401f5a2a890 + Manually resolve merge conflicts + Fix more IWYU to fix compile. Original Review URL: https://codereview.chromium.org/963193003 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/971013002
2015-02-19Merge to XFA: Add test for PDF's JS "global".Tom Sepez
Original Review URL: https://codereview.chromium.org/943783002 TBR=jam@chromium.org Review URL: https://codereview.chromium.org/941133003
2015-02-13Merge to XFA: Run javascript/pixel tests via automated script.Tom Sepez
This pulls in: 7435e8e Run pixel tests via automated script. 83c87e5 run_javascript_tests.py: Be more flexible about directory layout. 5898509 Test top-level Document JS properties. 9f93baf Create run_javascript_tests.py TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/923293002
2015-02-10Merge to XFA: Add JavaScript test for constants in Consts.cpp.Tom Sepez
Original Review URL: https://codereview.chromium.org/908023003 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/908233002
2015-02-06Merge to XFA: First JavaScript testing implementation.Tom Sepez
Original Review URL: https://codereview.chromium.org/872103003 TBR=jam@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/901403004