Commit Graph

411 Commits

Author SHA1 Message Date
Yury Delendik
0a700fa29d Updates Jasmine version. 2016-03-29 09:34:13 -05:00
Yury Delendik
a8e5912cb1 Moves shared/global to display/global 2016-03-23 19:24:37 -05:00
Yury Delendik
bda5e6235e Removes global PDFJS usage from the src/core/. 2016-03-23 19:24:37 -05:00
Manas
f6d28ca323 Refactors CMapFactory.create to make it async 2016-03-21 23:08:19 +05:30
Yury Delendik
22341c0761 Merge pull request #6879 from yurydelendik/streams
Makes PDF data reading Streams API friendly.
2016-03-01 09:10:52 -06:00
Jonas Jenwald
41efb92d3a Merge pull request #6988 from timvandermeij/fileattachment-annotation
Implement support for FileAttachment annotations
2016-02-24 12:58:06 +01:00
Tim van der Meij
0351c7eff4 Move the getFileName helper function to the core
This is required to be able to use it in the annotation display code,
where we now apply it to sanitize the filename of the FileAttachment
annotation. The PDF file from https://bugzilla.mozilla.org/show_bug.cgi?id=1230933 has shown that some PDF generators include the path of the file rather than the filename, which causes filenames with weird initial characters. PDF viewers handle this differently (for example Foxit Reader just replaces forward slashes with spaces), but we think it's better to only show the filename as intended.

Additionally we add unit tests for the `getFilenameFromUrl` helper
function.
2016-02-23 22:49:53 +01:00
Tim van der Meij
10902fd882 Implement unit and reference testing for FileAttachment annotations 2016-02-23 22:49:53 +01:00
Yury Delendik
0d591719d9 Makes PDF data reading Streams API friendly. 2016-02-18 13:17:53 -06:00
Jonas Jenwald
7cf9de2c17 [api-minor] Change getOutline to actually return the RGB color of outline items
Currently the `C` entry in an outline item is returned as is, which is neither particularly useful nor what the API documentation claims.

This patch also adds unit-tests for both the color handling, and the `F` entry (bold/italic flags).
2016-02-15 13:41:22 +01:00
Jonas Jenwald
98db068079 Reduce the overall indentation level in Catalog_readDocumentOutline, by using early returns, in order to improve readability 2016-02-14 11:38:43 +01:00
Tim van der Meij
5bcf4c1895 Destroy workers when they are no longer needed in the unit tests 2016-01-29 12:23:17 +01:00
Jonas Jenwald
1140a34f5c [api-minor] Change getPageLabels to always return the pageLabels, even if they are identical to standard page numbering 2016-01-27 13:36:03 +01:00
Jonas Jenwald
85cf90643f [api-minor] Add support for PageLabels in the API 2016-01-19 22:49:04 +01:00
Jonas Jenwald
0030a82dc3 [api-minor] Add support for URLs in the document outline
Re: issue 5089.
(Note that since there are other outline features that we currently don't support, e.g. bold/italic text and custom colours, I thus think we can keep the referenced issue open.)
2016-01-19 21:36:27 +01:00
Tim van der Meij
4399d01169 Merge pull request #6834 from Snuffleupagus/issue-6832
Strip `null` (\x00) characters from the URLs in LinkAnnotations (issue 6832)
2016-01-05 23:59:25 +01:00
Brendan Dahl
eb7c36beb6 Add validation for callsubr and callgsubr for type 2 charstrings. 2016-01-05 09:54:25 -08:00
Jonas Jenwald
97c10e9c08 Strip null (\x00) characters from the URLs in LinkAnnotations (issue 6832)
Apparently some PDF files can have annotations with `URI` entries ending with `null` characters, thus breaking the links.
To handle this edge-case of bad PDFs, this patch moves the already existing utility function from `ui_utils.js` into `util.js`, in order to fix those URLs.

Fixes 6832.
2016-01-04 21:55:20 +01:00
Yury Delendik
85e95d34ed Use RequireJS in the viewer, examples and tests. 2015-12-29 09:20:52 -06:00
Yury Delendik
6b60c8f4db Adds UMD headers to core, display and shared files. 2015-12-15 13:24:39 -06:00
Tim van der Meij
91274d6d2d Rename annotation_helper.js to annotation_layer.js 2015-12-02 23:30:28 +01:00
Jonas Jenwald
995e1a45b8 Ensure that Lexer_getName does not fail if a Name contains in invalid usage of the NUMBER SIGN (#) (issue 6692)
*This is a regression from PR 3424.*

The PDF file in the referenced issue is using `Type3` fonts. In one of those, the `/CharProcs` dictionary contains an entry with the name `/#`. Before the changes to `Lexer_getName` in PR 3424, we were allowing certain invalid `Name` patterns containing the NUMBER SIGN (#).

It's unfortunate that this has been broken for close to two and a half years before the bug surfaced, but it should at least indicate that this is not a widespread issue.

Fixes 6692.
2015-11-28 11:59:09 +01:00
Tim van der Meij
5fcd779812 Merge pull request #6209 from Rob--W/parallel-rendering
Fix font rendering when rendering multiple PDFs in parallel
2015-11-25 22:51:15 +01:00
Jonas Jenwald
6dfe53b976 [api-minor] Add a parameter to PDFPageProxy_getTextContent that enables replacing of all whitespace with standard spaces in the textLayer (issue 6612)
This patch goes a bit further than issue 6612 requires, and replaces all kinds of whitespace with standard spaces.

When testing this locally, it actually seemed to slightly improve two existing test-cases (`tracemonkey-text` and `taro-text`).

Fixes 6612.
2015-11-25 17:28:40 +01:00
Rob Wu
07f2a43943 Add tests for parallel rendering 2015-11-25 17:22:51 +01:00
Yury Delendik
09772e1e15 Creates PDFWorker, separates fetchDocument from transport. 2015-11-24 13:27:22 -06:00
Jonas Jenwald
b05652ca97 [api-minor] Let getAnnotations fetch all annotations by default, unless an intent is specified
Currently `getAnnotations` will *only* fetch annotations that are either `viewable` or `printable`. This is "hidden" inside the `core.js` file, meaning that API consumers might be confused as to why they are not recieving *all* the annotations present for a page.

I thus think that the API should, by default, return *all* available annotations unless specifically told otherwise. In e.g. the default viewer, we obviously only want to display annotations that are `viewable`, hence this patch adds an `intent` parameter to `getAnnotations` that makes it possible to decide if only `viewable` or `printable` annotations should be fetched.
2015-11-22 15:51:37 +01:00
Tim van der Meij
0991c06395 Refactor annotation flags code
This patch makes it possible to set and get all possible flags that the PDF specification defines. Even though we do not support all possible annotation types and not all possible annotation flags yet, this general framework makes it easy to access all flags for each annotation such that annotation type implementations can use this information.

We add constants for all possible annotation flags such that we do not need to hardcode the flags in the code anymore. The `isViewable()` and `isPrintable()` methods are now easier to read. Additionally, unit tests have been added to ensure correct behavior.

This is another part of #5218.
2015-11-22 01:06:37 +01:00
Yury Delendik
56ccaea99b Move text layer building logic into src/display/text_layer.js 2015-11-19 10:50:27 -06:00
Yury Delendik
2f34fd46cb Move CustomStyle. 2015-11-19 10:47:17 -06:00
Manas
a2ba1b8189 Uses editorconfig to maintain consistent coding styles
Removes the following as they unnecessary
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
2015-11-14 07:32:18 +05:30
Jonas Jenwald
1c66d4a106 Add a totalLength getter to OperatorList, since the length is zero after flushing
In the `RenderPageRequest` handler in `worker.js`, we attempt to print an `info` message containing the rendering time and the length of the operator list. The latter is currently broken (and has been for quite some time), since the `length` of an `OperatorList` is reset when flushing occurs.
This patch attempts to rectify this, by adding a getter which keeps track of the total length.
2015-10-26 18:12:14 +01:00
Jonas Jenwald
25e55322c4 Improved get fingerprint unit-tests (PR 5124)
This patch adds a unit-test for the changes contained in PR 5124, and also improves the existing `get fingerprint` test slightly.
2015-10-24 14:18:36 +02:00
Yury Delendik
58c3ea0820 Adds thread abort capabilities. 2015-10-23 09:06:32 -05:00
Yury Delendik
59c13b32aa Adds destroy method to the document loading task.
Also renames PDFPageProxy.destroy method to cleanup.
2015-10-23 08:57:14 -05:00
Jonas Jenwald
e04113a35b Add unit-tests for the onPassword/onProgress callbacks of the API
The standard viewer implicitly depends on the `onPassword` and `onProgress` callbacks, in order to open password protected PDF files, respectively to report file loading progress. We currently have no unit-tests for this functionality, which seems unfortunate; hence this patch.

*Please note:* Rather than adding more unit-tests to `api_spec.js`, I slightly extended/reworked two existing tests. Specifically for the password test, this *does not* really change what we actually test, just how the test is done.
2015-10-21 00:01:52 +02:00
Jonas Jenwald
5987197bd5 Ensure that all getDocument unit-tests returns the expected data 2015-10-16 18:54:20 +02:00
Jonas Jenwald
34cbee9bd3 Add unit-tests for PR 6531 2015-10-16 18:54:18 +02:00
Jonas Jenwald
39b962e3b0 Add unit-tests for isExternalLinkTargetSet 2015-10-13 21:56:46 +02:00
Brendan Dahl
3eaeacfe19 Merge pull request #6476 from Snuffleupagus/PartialEvaluator_readToUnicode-cmap-length
Right-size the `map` array in PartialEvaluator_readToUnicode
2015-10-09 10:31:28 -07:00
Jonas Jenwald
e8ad6c9d13 Add a unit-test for bug 1020226
For reference, see PR 4902 and https://bugzilla.mozilla.org/show_bug.cgi?id=1020226.
2015-10-04 15:45:24 +02:00
Jonas Jenwald
ae255f8921 Slightly improved getPage unit-tests 2015-10-04 14:28:24 +02:00
Jonas Jenwald
8d831449ab Right-size the map array in PartialEvaluator_readToUnicode
We can avoid a lot of intermediate resizings, by directly allocating the required number of elements for the `map` array.
2015-09-24 13:08:53 +02:00
Jonas Jenwald
297984e2e9 Add unit-tests for removeNullCharacters (PR 6431 follow-up)
I overlooked that we already had existing unit-tests for `web/ui_utils.js`, so this PR adds a few tests for `removeNullCharacters` (see PR 6431).
2015-09-14 12:19:29 +02:00
Jonas Jenwald
c5c8b239e9 Add unit-tests for stringToPDFString
The other day I was looking as the utilily function `stringToPDFString`, and I noticed that it didn't have any unit-tests. This patch fixes that.
2015-09-10 12:25:40 +02:00
Yury Delendik
943efea876 Merge pull request #6404 from Snuffleupagus/linearization-unit-tests
Add unit-tests for Linearization dictionary parsing (PR 5023 follow-up)
2015-08-31 07:38:55 -05:00
Jonas Jenwald
0edb520a10 Add unit-tests for Linearization dictionary parsing (PR 5023 follow-up)
This should *really* have been part of 5023, but better late than never I suppose.
2015-08-30 14:06:11 +02:00
Jonas Jenwald
0dde08554d Add a unit-test for skipping paintXObject if Subtype === PS (PR 4861) 2015-08-29 20:43:22 +02:00
Tim van der Meij
d08895d659 Merge pull request #6236 from Rob--W/print-javascript-action
Detect scripted auto-print requests
2015-07-25 19:42:31 +02:00
Tim van der Meij
980aa10e04 Refactor annotation rectangle code and add unit tests
This patch refactors the code responsible for setting the annotation's rectangle. Its goal is to:

- Actually check that the input array is actually an array, and if so, that it contains exactly four elements.
- Only call `normalizeRect` if the input array is valid, i.e., we do not call it for the default rectangle anymore.

Unit tests are provided just like with the other patches in this series.
2015-07-20 22:01:47 +02:00
Rob Wu
c676ecb5a0 Detect scripted auto-print requests
Fixes #6106

To avoid future regressions, two new unit tests were added:
1. A new PDF based on the report from #6106, which contains an
   OpenAction of type JavaScript and a string "this.print({...}".
2. An existing PDF from https://bugzil.la/1001080 (from #4698).

Although it does not matter, since we don't execute the JavaScript code,
I have also changed "print(true)" to "print({})" since the print method
takes an object (not a boolean). See "Printing PDF documents", page 62:
http://adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/js_developer_guide.pdf
2015-07-20 18:25:02 +02:00
Tim van der Meij
465611a2ff More cleanup regarding annotation border styles 2015-07-17 21:51:24 +02:00
Jonas Jenwald
c718d1ab10 Ignore double negative in Lexer_getNumber (issue 6218)
Basic mathematics would suggest that a double negative should always become positive, but it appears that Adobe Reader simply ignores that case. Hence I think that it makes sense for us to do the same.

Fixes 6218.
2015-07-16 12:11:49 +02:00
Tim van der Meij
a2e9845093 Refactor annotation color handling and add unit tests 2015-07-15 18:49:19 +02:00
Jonas Jenwald
940bedf75f Add a unit-test that attempts to fetch a non-existent named destination
Doing this helped uncover an issue with the `getDestination` implementation.
Currently if a named destination doesn't exist, the method (in `obj.js`) may return `undefined` which leads to the promise being stuck in a pending state.
*Note:* returning `null` for this case is consistent with other methods, e.g. `getOutline` and `getAttachments`.
2015-07-07 22:05:08 +02:00
Brendan Dahl
98339f63a8 Merge pull request #5585 from timvandermeij/annotation-layer-borderstyle
Annotation border styles
2015-07-01 10:48:12 -07:00
Jonas Jenwald
38955d491f Further improvements of the getStats and getDownloadInfo unit tests
The patch adds a test to ensure that `getStats` returns the expected result after the page has been parsed, and cleans up the existing test a bit.
Also, since I'm touching the file anyway, I'm making a small adjustment of the `getDownloadInfo` test. (I have no idea why I didn't just write it like this initially.)
2015-06-25 23:00:26 +02:00
Jonas Jenwald
46a8485db4 Ignore paint form XObject when the name is missing (issue 4558)
Fixes 4558 (since the font issues already appear to be fixed).
2015-06-22 22:10:26 +02:00
Tim van der Meij
6007a57291 Add tests and documentation for the annotation border style class
This patch adds:
- Unit tests for the annotation border style class
- Regression test (self-made) for the annotation border style class
- Documentation generation using JSDoc
2015-06-17 22:28:08 +02:00
Jonas Jenwald
f59e20226c Slightly improved Crypto unit tests
Currently in the tests which check that incorrect passwords are rejected, we don't ensure that the exceptions thrown are the ones we expect. This patch improves the current situation, so that we actually can be sure that the code "fails" in the correct way.

*Note:* This patch also fixes some cases of weird indentation in the file.
2015-06-10 00:21:40 +02:00
Mike Corbin
4c9b65f0e1 Extract correct PDF format version from the catalog
The 'Version' field of the most recent document catalog, if present, is
intended to supersede the value in the file prologue.

This is significant for incrementally-built PDF documents and generators that
emit a low version in the prologue and later apply a format version based on
PDF features used, such as Apple's CoreGraphics/Quartz PDF backend.

Fixes the internal version variable, as well as the PDFFormatVersion reported
by the API and consumed by viewers.
2015-05-26 01:56:09 +01:00
Brendan Dahl
4824baf31c Merge pull request #5905 from timvandermeij/specialpowers
Remove SpecialPowers addon
2015-04-27 10:36:54 -07:00
Jonas Jenwald
7c7d05e7a3 Attempt to infer if a CMap file actually contains just a standard Identity-H/Identity-V map 2015-04-25 11:28:33 +02:00
Jonas Jenwald
36ac67583f Remove commented out code about |disableWorker| in the test suite
Since the tests have run with workers enabled for a long time, these comments are no longer relevant.
2015-04-04 13:32:44 +02:00
Tim van der Meij
75d8f70d06 Remove SpecialPowers addon 2015-04-03 20:17:20 +02:00
fkaelberer
a78bb6b946 Use binary search in getVisibleElements() 2015-03-01 17:41:20 +01:00
Collin Anderson
54e984c763 cleaned whitespace 2015-02-17 11:07:37 -05:00
Tim van der Meij
b215af30d3 Require destinations when they are needed and do not fetch all of them in advance 2014-10-06 22:26:18 +02:00
Jonas Jenwald
dc5b0d251f Improve the getData unit test
As a follow-up to PR #4795, this patch improves the `getData` unit test to ensure that the returned data is of the expected type and of the correct length.
2014-09-23 13:16:58 +02:00
Jonas Jenwald
27a80f3b88 Add unit test for |MissingPDFException| 2014-09-08 22:34:26 +02:00
Jonas Jenwald
6077e93275 In test/unit/api_spec.js rename the function waitsForPromise to waitsForPromiseResolvedand add a waitsForPromiseRejected function 2014-09-08 22:34:26 +02:00
Jonas Jenwald
fb7489ffd0 Add getStats unit test
Since some Telemetry data depends on `getStats`, having a unit test should make it more diffucult to accidentally break this without noticing.
2014-08-30 22:12:34 +02:00
Jonas Jenwald
9f1e140c4f Add unit test for PDF file loaded as typed array 2014-08-15 17:21:46 +02:00
Jonas Jenwald
b201cc4940 Remove the remaining references to cidmaps.js from the test suite 2014-08-14 12:42:57 +02:00
Jonas Jenwald
1fb404aff2 Fix CMap unit tests
When the binary CMaps were added, some of the relevant unit tests were not changed. This patch updates them, so that we actually test the current implementation.
What's somewhat troubling here is that we currently have CMap unit tests that passes, *despite* not working as intended (the CMap files doesn't load).
2014-08-14 12:36:49 +02:00
Jonas Jenwald
06b5d97bc6 Remove two instances of leftover console.log debug statements
The `console.log` statement in evaluator_spec.js is obviously not needed. In obj.js it could have been replaced by `info`, but that seemed unnecessary given the already existing `error`.
2014-08-13 14:29:46 +02:00
Jonas Jenwald
c3691500fa Merge pull request #5172 from nnethercote/readCharCode-retval
Avoid an allocation in readCharCode().
2014-08-13 11:03:07 +02:00
Nicholas Nethercote
61e6b576d4 Avoid an allocation in readCharCode().
readCharCode() returns two values, and currently allocates a length-2
array on every call to do so. This change makes it instead us a
passed-in object which can be reused.

This tiny change reduces the total JS allocations done for the document
in Mozilla bug 992125 by 4.2%.
2014-08-12 16:12:58 -07:00
Jonas Jenwald
fc5ad8a8d6 Add even more unit tests for the API
This patch replaces most of the remaining TODOs in test/unit/api_spec.js with actual tests.
2014-08-12 12:09:31 +02:00
Jonas Jenwald
cb4a847347 Merge pull request #5134 from yurydelendik/fun4
Improves speed of the functions
2014-08-05 23:51:03 +02:00
Yury Delendik
6865c284a7 Merge pull request #5111 from nnethercote/better-cidchars
Represent cid chars using integers, not strings.
2014-08-04 22:26:55 -05:00
Yury Delendik
f750e35224 Optimizes functions to not create arrays 2014-08-04 11:23:11 -05:00
Yury Delendik
cb81bd6be6 Compiles some of the FunctionType 4 2014-08-04 11:21:31 -05:00
Nicholas Nethercote
adf58ed687 Represent cid chars using integers, not strings.
cid chars are 16-bit unsigned integers. Currently we convert them to
single-char strings when inserting them into the CMap, and then convert
them back to integers when extracting them from the CMap. This patch
changes CMap so that cid chars stay in integer format throughout, saving
both time and space.

When loading the PDF from issue #4580, this change reduces peak RSS from
~600 to ~370 MiB. It also improves overall speed on that PDF by ~26%,
going from 724 ms to 533 ms.
2014-08-01 02:35:17 -07:00
Tim van der Meij
b0349cd184 Use strict equalities in test/unit/{function_spec, stream_spec, testreporter}.js 2014-07-31 23:08:55 +02:00
Tim van der Meij
7586d777eb Enforcing JSHint's undef option 2014-07-19 16:41:07 +02:00
Tim van der Meij
34728ee49b Removing unused code 2014-07-18 22:34:50 +02:00
Nicholas Nethercote
081866a184 Use null instead of [] for ops with no args.
This reduces peak RSS on one test file from ~600 to ~560 MiB.
2014-06-22 16:03:48 -07:00
Yury Delendik
bdeca30fbf Splits shared/annotation.js into core/ and display/ 2014-06-17 17:43:33 -05:00
pramodhkp
1d00e9d13c Added getOperatorList to api.js 2014-06-18 01:30:42 +05:30
Daniel West
1fce2856c6 Added support for decrypting PDF 1.7/2.0 Algorithm 5 revision 5 and 6.
*Added AES128 Encryption
*Added AES258 Encryption/Decryption
*Added SHA256
*Added SHA512
*Added class to handle 8 byte integers and associated bit operations
*Added SHA384
*Added routines to handle new algorithm and perform PDF2.0 hashing.
2014-06-13 13:05:47 -05:00
Yury Delendik
fcc4dfd9b5 Moves shared/function.js to core/ 2014-05-23 14:11:47 -05:00
Yury Delendik
7a19085159 Moves shared/colorspace.js into core/ 2014-05-23 14:11:47 -05:00
Jonas Jenwald
7079992d89 Merge pull request #4770 from yurydelendik/promise-operationlist
Adds Promises to getOperatorList
2014-05-19 23:22:40 +02:00
Yury Delendik
d8eb8b1de1 Adds Promise to the getOperatorList 2014-05-19 16:19:54 -05:00
Jonas Jenwald
a984fe5b55 Add more unit tests for the API 2014-05-18 23:35:29 +02:00
Christian Krebs
3e7bcaa892 Handle nested post script arguments in the preprocessor
Fix for issue #4785
2014-05-15 19:49:43 +02:00
Yury Delendik
179f4231e6 Merge pull request #4795 from Snuffleupagus/getData-unittest
Add unit test for getData
2014-05-14 06:55:40 -05:00
Jonas Jenwald
3adab8b183 Fix unit test for getDestinations 2014-05-14 12:54:18 +02:00
Jonas Jenwald
e00b986bd3 Add unit test for getData 2014-05-14 11:57:48 +02:00
Michał Gołębiowski
e625af3fef Remove type="text/javascript" from script tags.
"text/javascript" is not a correct MIME type (the correct one is
"application/javascript") but it's not even needed; all browsers default
to the correct type and treat it as executable JS when type is ommited.
Since not all browsers recognize the "application/javascript" MIME type
the only way to both stay compliant and to support all popular browsers
is to omit the type. It's also shorter this way.
2014-05-13 02:41:01 +02:00
Yury Delendik
a26d28a393 Merge pull request #4683 from yurydelendik/grouppath
Groups path commands into single operation
2014-05-08 22:16:58 -05:00
Tim van der Meij
4caf5b694e Completes unit tests for PostScript evaluator and fixes two bugs in the evaluator itself 2014-05-03 12:18:18 +02:00
Yury Delendik
63d5aae3f6 Groups path commands into single command 2014-04-30 09:09:04 -05:00
Thorben Bochenek
e8f0700bfa Move the colour conversion to jpg.js
Benchmarking shows that this improves performance for the invitation document
from https://github.com/mozilla/pdf.js/issues/3809 by 35%
2014-04-24 15:07:12 +02:00
Yury Delendik
2c6692050b Merge pull request #4640 from yurydelendik/special-powers
Fix special powers add-on for firefox.
2014-04-17 08:06:54 -05:00
Brendan Dahl
70ce3a88a1 Use special powers quit in unit tests. 2014-04-17 07:34:34 -05:00
Tim van der Meij
7a2cb7cddd Fixes lint warning W004 in /test 2014-04-11 00:02:33 +02:00
Yury Delendik
f57c6935d7 Implements WebGL support 2014-04-03 08:36:22 -05:00
Yury Delendik
20a91bcdbf Fixes ignoring of the escaped CR LF 2014-03-20 11:50:12 -05:00
Thorben Bochenek
c547f17ee5 Add Test for PDFDocumentProxy_getPageIndex 2014-03-19 10:17:58 +01:00
Jonas Jenwald
2bd81786c2 Fix coding style in test/unit/testreporter.js 2014-03-14 15:46:23 +01:00
Jonas Jenwald
9e3f7e4d6d Fix coding style in test/unit/crypto_spec.js 2014-03-14 15:41:12 +01:00
Jonas Jenwald
6489a80dd0 Fix coding style in test/unit/font_spec.js 2014-03-14 15:38:34 +01:00
Jonas Jenwald
3cd64a85ba Fix coding style in test/unit/function_spec.js 2014-03-14 15:35:04 +01:00
Jonas Jenwald
7d4acc13fb Fix coding style in test/unit/parser_spec.js 2014-03-14 15:32:32 +01:00
Jonas Jenwald
9dfc26e1e3 Fix coding style in test/unit/stream_spec.js 2014-03-14 15:31:00 +01:00
Yury Delendik
1c0e1cc591 Merge pull request #4444 from nnethercote/min-length
Estimate the size of decoded streams in advance.
2014-03-13 10:58:31 -05:00
Yury Delendik
7963f22545 Merge pull request #4259 from brendandahl/built-in-cmaps-squash
Adds built in CMaps and unifies the glyph mapping.
2014-03-13 10:27:48 -05:00
Nicholas Nethercote
b3024db677 Estimate the size of decoded streams in advance.
When decoding a stream, the decode buffer is often grown multiple times, its
byte size increasing like so: 512, 1024, 2048, etc. This patch estimates the
minimum size in advance (using the length of the encoded stream), often
allowing the smaller sizes to be skipped. It also renames numerous |length|
variables as |maybeLength| to make it clear that they can be |null|.

I measured this change on eight documents. This change reduces the cumulative
size of decode buffer allocations by 0--32%, with 10--20% being typical. This
reduces peak RSS by 10 or 20 MiB for several of them.
2014-03-13 02:06:58 -07:00
Yury Delendik
ad4eb9a21d Merge pull request #4354 from nnethercote/Name-cache
Use a cache to minimize the number of Name objects.
2014-03-02 18:44:29 -06:00
Mitar
2c82e720b8 Updated to current latest stable version of jshint. 2014-03-01 13:31:25 -08:00
Nicholas Nethercote
fdb7c218da Use a cache to minimize the number of Name objects. 2014-02-27 20:41:03 -08:00
Brendan Dahl
b5b94a4af3 Use built in CMaps and unify the glyph mapping. 2014-02-11 10:27:09 -08:00
Ophir LOJKINE
4a66eccedc Rewrite Lexer_getNumber.
Now, it computes the numbers with only basic arithmetic operations, without first creating a string and then calling parseFloat.
The new function doesn't behave exactly the same as the old one.
In particular, the old behaviour was that when there was a number immediatly followed by an 'E', the 'E' was consumed. Now it's not. It allows for "glued" numbers and operators.
Also, the new function is faster and consumes less memory.
2014-02-01 21:46:09 +01:00
Yury Delendik
e9327050c3 Basic function.js split 2014-01-27 20:29:47 -06:00
Yury Delendik
bf432a37bb Refactors shared/pattern.js into core/ and display/ 2014-01-25 12:18:22 -06:00
Yury Delendik
09f8f951c8 Extracts evaluator preprocessor and refactor text extraction 2014-01-17 07:16:52 -06:00
Yury Delendik
5bf3e44e30 Introduces LegacyPromise; polyfills DOM Promise 2014-01-03 18:17:05 -06:00
Brendan Dahl
f4942b11f8 Reduce the memory usage of the operator list. 2013-11-13 11:43:38 -08:00
Yury Delendik
1c7f1cee00 Merge pull request #3674 from brendandahl/cmap-squash
Read multi-byte character codes based on codespace ranges.
2013-09-25 18:04:49 -07:00
Brendan Dahl
f32e65b19f Read multi-byte character codes based on codespace ranges. 2013-09-25 10:32:04 -07:00
Brendan Dahl
730a2cc550 Increase api unit tests timeout for chrome. 2013-09-24 09:30:54 -07:00
Brendan Dahl
5ecce4996b Split files into worker and main thread pieces. 2013-08-12 10:48:06 -07:00
Brendan Dahl
bf72bc94e2 Incrementally render by sending the operator list by chunks as they're ready. 2013-07-31 11:17:36 -07:00
Yury Delendik
19e8f2f059 lookChar refactoring 2013-07-08 21:25:55 -05:00
Brendan Dahl
ae1f973204 Use A+ spec compatible promises. 2013-06-05 12:28:31 -07:00
Yury Delendik
ffeec0572c Fixes incorrect unit test 2013-05-16 12:15:01 -05:00
Mack Duan
f8f4b3f45d Refactor code for annotations 2013-05-07 14:22:13 -04:00
Yury Delendik
65a884c421 Merge pull request #3075 from brendandahl/font-encoding
Fix priority of which font encoding is used.
2013-04-30 09:40:52 -07:00
Mack Duan
2ce00279be Address more of brendan's comments 2013-04-18 10:41:33 -07:00
Mack Duan
dbccbaaa27 Make getOperatorList() calls independent and merge queues at end 2013-04-18 00:16:41 -07:00
Mack Duan
6b2c6fc223 Changes to regression tests for progressive loading 2013-04-18 00:16:36 -07:00
Mack Duan
ef423ef30c Implement progressive loading of PDFs 2013-04-12 16:13:22 -07:00
Brendan Dahl
0f41b2db44 Fix priority of which font encoding is used. 2013-04-10 09:51:06 -07:00
Brendan Dahl
028151d13a Restructure/rewrite of the Type1 font parser. 2013-03-27 17:17:01 -07:00
Yury Delendik
8ee193892b Seac support for Windows 2013-03-04 12:37:59 -06:00
Yury Delendik
95e5429707 Fixes getString 2013-02-23 11:35:18 -06:00
Yury Delendik
81f8f92696 Adds web/* and test/* for jshint target 2013-02-04 12:01:19 -06:00
vyv03354
a254de86fb CFF parser didn't count hints defined by hstem/vstem 2013-01-26 22:08:45 +09:00
mduan
5ab3bb1e03 Skip commands that have too few arguments
- Commands that have too few args will be skipped
- Commands that have too many args will generate an info, but still
execute
2013-01-15 14:07:16 -08:00
Brendan Dahl
a79f005527 Fix isDict when type is missing in dictionary. 2013-01-10 16:32:26 -08:00
mduan
eb8f4e8343 Handle some illegal characters in hex string
Do not throw exception when hex strings are in the wrong format

Currently pdf.js is throwing an exception for the following hex string:

`<7 0 2 15 5 2 2 2 4 3 2 4>`

The issue is that the 15 is not a valid hex character so pdf.js ends up
throwing an exception.

This diff changes the parser to process the above hex string as follow:

`70 21 55 2 24 32` (Note: the final 4 of the hex string is ignored)

replicating the behaviour of MuPDF, and doesn't throw an exception.
2013-01-08 15:29:24 -08:00
khodzha
18da086b96 fix of combineUrl(baseUrl, url) in case of url - null, empty, undefined + unittests 2012-11-24 04:25:49 +04:00
Yury Delendik
4c0f9eb924 Fixes getNumber at the end of stream 2012-10-24 10:47:16 -05:00
Brendan Dahl
66563d0f95 Increase wait timeout for api unit tests. 2012-10-15 11:37:50 -07:00
Yury Delendik
e32ecc44d3 Fixes CFF test and CFF int16 parsing 2012-08-29 12:58:12 -05:00
Yury Delendik
0dd445bf18 Fixes unit tests and adds few for util.js 2012-06-23 15:35:59 -05:00
Yury Delendik
43f1946c7a Add prefixes for literals 2012-05-20 14:05:23 -05:00
Yury Delendik
ec6c185cf5 Allow parsing of the "glued" commands 2012-05-20 13:44:03 -05:00
Brendan Dahl
60dd0e08e4 Merge pull request #1694 from yurydelendik/owner-password
Fixes user and owner passwords logic
2012-05-15 11:52:56 -07:00
Yury Delendik
910ba0b91f Fixes user and owner passwords logic 2012-05-12 21:34:32 -05:00
Yury Delendik
324b867183 Adds evaluator tests 2012-05-10 16:11:27 -05:00
Yury Delendik
f7ccb291f4 Fix broken metadata 2012-04-23 16:43:20 -05:00
Yury Delendik
8b7cd47798 Merge pull request #1580 from brendandahl/unittest
Use test.py for unit tests too.
2012-04-23 12:42:44 -07:00
Brendan Dahl
909951d975 Allow time to finish requests. 2012-04-19 14:19:08 -07:00
Brendan Dahl
5f17d881a9 Fix nit. 2012-04-19 12:34:50 -07:00
Brendan Dahl
e18a2c512e Use test.py for unit tests too. 2012-04-19 12:32:24 -07:00
Brendan Dahl
e5732f489d Handle junk at the end of postscript functions. 2012-04-18 09:48:28 -07:00
Brendan Dahl
19c0c6a983 Add back other unit tests. Disable worker. 2012-04-12 18:09:25 -07:00
Brendan Dahl
3925e37417 Add basic api unit testing. 2012-04-12 17:59:30 -07:00
Brendan Dahl
1a1767ce82 Fix lint. 2012-03-10 19:47:14 -08:00
Brendan Dahl
386ea373a5 Add font spec to the unit test list. 2012-03-10 19:19:00 -08:00
Brendan Dahl
ce53b1b018 CFF Parser and Compiler. 2012-03-10 19:12:33 -08:00
Adil Allawi
b50cf76ab5 Properly integrate new file bidi.js 2012-02-13 14:56:37 +00:00
Kalervo Kujala
58107b1958 Add crypto and stream specs to test runner configuration. 2012-01-10 19:35:26 +02:00
Kalervo Kujala
0c50d14f38 Merge remote-tracking branch 'upstream/master' into dev
Conflicts:
	test/unit/unit_test.html
2012-01-10 19:27:51 +02:00
Kalervo Kujala
91c935180e Use correct default rule for unit test. 2012-01-10 19:21:43 +02:00
Kalervo Kujala
aeaaea35a8 Create debug option for the unit test makefile. 2012-01-09 20:51:30 +02:00
Kalervo Kujala
37d2d82f59 Merge remote-tracking branch 'upstream/master' into dev 2012-01-09 20:39:05 +02:00
notmasteryet
50a16573ad Add unit tests for calculateMD5, ARCFourCipher, and PredictorStream 2012-01-08 18:26:01 -06:00
Kalervo Kujala
f975f929f5 Add Unit tests for RefSet. 2012-01-07 22:22:22 +02:00
Kalervo Kujala
075d2d9cbf Add new unit tests to jsTestDriver.conf. 2012-01-05 21:23:07 +02:00
Kalervo Kujala
09eed8d971 Merge remote-tracking branch 'upstream/master' into dev
Conflicts:
	Makefile
	test/unit/unit_test.html
2012-01-05 21:16:15 +02:00
Kalervo Kujala
678b7dcd04 Use absolute paths in profiles for unit test. 2012-01-05 20:58:35 +02:00
Kalervo Kujala
71494bbab5 Find profile dirs in a better way for unit test. 2012-01-04 22:40:43 +02:00
Kalervo Kujala
d2a67eda78 Separate browsers correctly with newlines.
Also simplify $$RANDOM handling.
2012-01-04 22:24:58 +02:00
notmasteryet
c0cf081ec0 Merge pull request #994 from brendandahl/type4func
Type4 PostScript Functions
2011-12-30 16:05:49 -08:00
Brendan Dahl
9de52f375d Fix idiv and cvi. Add test case for idiv. 2011-12-30 13:25:34 -08:00
Brendan Dahl
6afb49c6c6 Address Yury's PR comments. 2011-12-30 09:24:13 -08:00
Brendan Dahl
20dace0513 Switch to a single "code stack". 2011-12-29 13:41:54 -08:00
Kalervo Kujala
0e2fb810c5 Refactor obj.js unit tests to be aligned with code. 2011-12-29 14:06:06 +02:00
Brendan Dahl
27b0d0c941 Switch to two arrays for instructions. 2011-12-28 20:08:18 -08:00
Kalervo Kujala
84d6a121af Add basic unit tests for obj.js. 2011-12-28 23:20:04 +02:00
Kalervo Kujala
58a2919ef7 Separate unit test Makefile commands to separate variables for readability.
Also add more debug info for the make.
2011-12-27 23:58:26 +02:00
Brendan Dahl
971f35d165 Add unit files to lint, fix lint errors. 2011-12-23 21:19:15 -08:00
Brendan Dahl
1089c30b56 Adding type4 postscript function support. 2011-12-23 19:41:12 -08:00
Kalervo Kujala
43b57f9e49 Add debug logging to unit test Makefile. 2011-12-22 22:33:16 +02:00
Kalervo Kujala
d741a8a7aa Set the Makefile variables correctly for unit test. 2011-12-21 01:21:15 +02:00
Kalervo Kujala
3a55c1c8b9 Create the profile directories beforehand for unit test. 2011-12-21 01:15:51 +02:00
Kalervo Kujala
86663408f0 Use simpler sed and random temp profile names for unit test. 2011-12-16 00:23:23 +02:00
Kalervo Kujala
75c9286a20 Add unit test support for Google Chrome for Windows. 2011-12-15 00:55:00 +02:00
Kalervo Kujala
be2e7a7a9c Add profile handling for the unit test. 2011-12-15 00:51:10 +02:00
Kalervo Kujala
190432f252 Remove unit_test.html.
JsTestDriver has made it obsolete. Also add explicitly the used config to
the Makefile.
2011-12-12 22:31:10 +02:00
Kalervo Kujala
1c2bb4ace7 Remove unit-test from 'make test' and add Aurora to the paths on mac. 2011-12-12 22:12:33 +02:00
Kalervo Kujala
0e46928f36 Use paths to binaries for Mac in unit test makefile. 2011-12-11 14:18:40 +02:00
Kalervo Kujala
168e5db2fd Add unit test files to lint.
And fix the lint warnings from obj_spec.js.
2011-11-26 20:35:46 +02:00
Kalervo Kujala
27ba65dc6f Add unit-test to master Makefile.
And add unit-test to test-target. Also fetch the paths to browsers that are
going to be used in testing from the browser_manifest.json.
2011-11-26 20:24:39 +02:00
Kalervo Kujala
1a119bcb08 Make unit tests runnable from command line. 2011-11-24 00:03:17 +02:00
Kalervo Kujala
624a7a74ea Add jasmine files to external-directory. 2011-11-20 21:16:47 +02:00
Kalervo Kujala
c2dd452342 Create first unit test in Jasmine unit test framework.
To run the unit test open pdf.js/test/unit/unit_test.html in your browser.

This requires that https://github.com/pivotal/jasmine is cloned to the same
directory level as pdf.js.
2011-11-13 21:39:56 +02:00