Commit Graph

8079 Commits

Author SHA1 Message Date
Jonas Jenwald
0fb31a4a9e Fallback in readCmapTable, instead of using error, for TrueType fonts with unsupported cmap formats (bug 1200096)
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1200096.

The problematic font has a `format 2` cmap, which we've never supported properly. Prior to PR 2606, we were able to fallback to a working state, despite not having proper support for that cmap format.

Obviously the best/correct solution would be to implement actual support for more cmap formats[1]. However, I'm hoping that a simple patch will be OK for now, given that:
 - `format 2` cmaps seem to be quite rare in practice, since this has been broken for 2.5 years before anyone noticed.
 - Having a simple patch will make potential uplifts a lot easier.

[1] See the specification at https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6cmap.html
2015-09-01 14:01:19 +02:00
Tim van der Meij
0020f33873 Merge pull request #6357 from Snuffleupagus/bidi-result
Avoid more allocations for RTL text in bidi.js
2015-09-01 00:44:33 +02:00
Tim van der Meij
8a27b8d8f5 Merge pull request #6405 from Snuffleupagus/pr-4731-load-test
Add a (linked) `load` test for PR 4731
2015-09-01 00:21:04 +02:00
Jonas Jenwald
09b825d1be Add a (linked) load test for PR 4731
Re: PR 4731.
Since the URL points to the Internet Archive, I think that adding a linked test-case should be OK. (Also, it's difficult to create reduced, or even `unit`, tests that accurately captures the brokenness of real-world PDF files.)

*Please note:* Since this is a `load` test, `makeref`ing won't be needed.
2015-08-31 17:15:41 +02:00
Tim van der Meij
8f1b0657c0 Merge pull request #6402 from DavidPrevot/reproducible
Set TZ=UTC before calls to zip
2015-08-31 16:32:04 +02:00
Tim van der Meij
678b662720 Merge pull request #6399 from Snuffleupagus/vertical-text-taro
Slightly improved test coverage for vertical text
2015-08-31 16:27:21 +02:00
Tim van der Meij
61459c7e30 Merge pull request #6403 from Snuffleupagus/issue-6113-test
Add a reduced test-case for issue 6113
2015-08-31 15:51:47 +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
Tim van der Meij
b42b894570 Merge pull request #6386 from Snuffleupagus/Parser_makeFilter-warn-on-empty-stream
Add a warning when we encounter an empty stream in `Parser_makeFilter`
2015-08-30 23:14:22 +02:00
Tim van der Meij
f518bbcc7c Merge pull request #6401 from Snuffleupagus/paintXObject-subtype-PS-unit-test
Add a unit-test for skipping `paintXObject` if `Subtype === PS` (PR 4861)
2015-08-30 23:03:32 +02:00
Tim van der Meij
b3c00f2dfb Merge pull request #6395 from Snuffleupagus/issue-1419-enable-test
Fix typo in `test_manifest.json` that prevents test-case `issue1419.pdf` from running
2015-08-30 22:53:51 +02: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
ba9fcce8eb Add a reduced test-case for issue 6113
As promised in PR 6125, here's a reduced test-case that should (hopefully) avoid the intermittent failure of the previous one.
2015-08-30 01:23:52 +02:00
Dhole
de83de0a58 Set TZ=UTC before calls to zip
This change allows to make the package build reproducible.

Bug-Debian: https://bugs.debian.org/793127
2015-08-29 14:52:19 -04:00
Jonas Jenwald
0dde08554d Add a unit-test for skipping paintXObject if Subtype === PS (PR 4861) 2015-08-29 20:43:22 +02:00
Jonas Jenwald
3ae49e15b3 Slightly improved test coverage for vertical text
Our current test coverage for vertical text is somewhat lacking, as evident from e.g. issue 6387. That regression could easily have been avoided if the `taro` test-case would have been an `eq` test, as well as an `text` test.
2015-08-29 15:54:32 +02:00
Jonas Jenwald
593ea00ecb Fix typo in test_manifest.json that prevents test-case issue1419.pdf from running
Currently we only attempt to test the *first* page, since `lastPage == 1`, but given that it's subsequently skipped we end up not testing anything.

*Note:* I've verified that the *second* page actually contains the kind of Colour space that the test was intended to check for.
2015-08-28 16:35:10 +02:00
Rob Wu
c6ba5ea42e Merge pull request #6390 from Snuffleupagus/rename-treeitem-assets
Switch `expanded/collapsed` in the names of the `treeitem-*` assets
2015-08-27 23:41:01 +02:00
Jonas Jenwald
2df1b7b3cd Switch expanded/collapsed in the names of the treeitem-* assets
It appears to me that the `expanded/collapsed` part of the names got switched around, since I'd expect the following convention:
 - `v` == expanded
 - `>` == collapsed
2015-08-27 23:21:34 +02:00
Rob Wu
50b15b8c10 Merge pull request #6388 from Snuffleupagus/outlineItemToggler-use-retina-assets
Use the Retina assets for `outlineItemToggler` when in HiDPI mode
2015-08-27 17:59:33 +02:00
Jonas Jenwald
b1950d3657 Use the Retina assets for outlineItemToggler when in HiDPI mode 2015-08-27 17:50:35 +02:00
Yury Delendik
70fd360d51 Merge pull request #6242 from Rob--W/outline-collapsible
Allow outline to be collapsed / shown via +/-.
2015-08-27 08:41:34 -05:00
Rob Wu
582573b96b Merge pull request #6358 from Snuffleupagus/Parser_tryShift-missingDataException
Don't catch `MissingDataException` in `Parser_tryShift`
2015-08-27 14:46:24 +02:00
Yury Delendik
63ed6816eb Merge pull request #6369 from Snuffleupagus/localization-notes-document-properties
Add locatization notes for the DocumentProperties strings with parameters
2015-08-26 15:22:57 -05:00
Yury Delendik
b2ad0bab70 Merge pull request #6362 from Snuffleupagus/issue-6361
Add `disableStream` to the list of preferences read by `PDFViewerApplication.initialize` (issue 6361)
2015-08-26 15:21:42 -05:00
Jonas Jenwald
f814fdc215 Add a warning when we encounter an empty stream in Parser_makeFilter
Having a warning here would have meant that issue 6360 could have been solved in approximately five minutes, instead of an hour. To avoid that happening again, this patch adds a warning whenever we treat a stream as empty.
2015-08-26 20:14:30 +02:00
Brendan Dahl
88e0326787 Merge pull request #6337 from Snuffleupagus/issue-6336
Adjust which TrueType (3, 1) glyphs we attempt to skip mapping of (issue 6336)
2015-08-25 09:49:46 -07:00
Yury Delendik
5dcd409d3b Merge pull request #6375 from Snuffleupagus/more-robust-XRef_indexObjects
Make `XRef_indexObjects` more robust against bad PDF files (issue 5752)
2015-08-24 15:05:05 -05:00
Rob Wu
7c992243fd Allow outline to be collapsed / shown via icon.
- This commit adds a '>' before every outline item that has subitems.
- Click on the '>' to collapse all subitems under that item (which turns
  the '>' in a 'v').
- Shift + click expands/collapses all descendant items under that tree.
- Double-clicking on the "Show Document Outline" button in the toolbar
  expands/collapses all outline items.
2015-08-22 18:49:08 +02:00
Jonas Jenwald
56a43a3181 Make XRef_indexObjects more robust against bad PDF files (issue 5752)
This patch improves the detection of `xref` in files where it is followed by an arbitrary whitespace character (not just a line-breaking char).
It also adds a check for missing whitespace, e.g. `1 0 obj<<`, to speed up `readToken` for the PDF file in the referenced issue.
Finally, the patch also replaces a bunch of magic numbers with suitably named constants.

Fixes 5752.

Also improves 6243, but there are still issues.
2015-08-21 20:33:02 +02:00
Yury Delendik
23cb01c8af Merge pull request #6372 from Snuffleupagus/issue-6360
Also check `maybeLength` when deciding if a stream is empty in `Parser_makeFilter` (issue 6360, bug 1191694)
2015-08-20 17:43:11 -05:00
Jonas Jenwald
5128603f64 Also check maybeLength when deciding if a stream is empty in Parser_makeFilter (issue 6360)
The problem with the PDF files in the issue, besides the obviously broken XRef tables which we're able to recover from, is that many/most of the streams have Dictionaries where the `Length` entry is set to `0`. This causes us to return `NullStream`, instead of the appropriate one in `Parser_makeFilter`.

Fixes 6360.
2015-08-20 23:04:18 +02:00
Yury Delendik
b11bc727c2 Merge pull request #6370 from castevinz/fix-getdocument-pdfBytes-check
api/getDocument: handle ArrayBuffer check for PDF binary data (byteLength)
2015-08-20 07:01:53 -05:00
Vincent Castelain
0cd4cc4e80 api/getDocument : handle ArrayBuffer check for PDF binary data (byteLength) 2015-08-20 08:56:05 +02:00
Jonas Jenwald
d1411fabfd Add locatization notes for the DocumentProperties strings with parameters
This should hopefully help prevent localizers from translating the actual parameters.
2015-08-19 13:22:52 +02:00
Jonas Jenwald
78dbf56484 Update l10n files 2015-08-19 12:28:38 +02:00
Jonas Jenwald
ede5235d3d Merge pull request #6332 from Rob--W/postMessage-error
Serialize errors before invoking postMessage
2015-08-19 12:00:02 +02:00
Yury Delendik
c56dc9a093 Merge pull request #6141 from skalnik/fix-font-csp-issues
Provide a fallback for font rendering when not allowed to use `eval`
2015-08-18 18:50:11 -05:00
Yury Delendik
f9c2783c36 Merge pull request #6366 from Snuffleupagus/issue-6364
Only take the fast-path in `PDFImage_createImageData` for un-masked JPEG images with "standard" colour spaces (issue 6364)
2015-08-18 16:02:50 -05:00
Jonas Jenwald
2597e3ffca Add a linked test-case for issue 4890 2015-08-18 22:33:09 +02:00
Jonas Jenwald
3fa5f6cc3b Only take the fast-path in PDFImage_createImageData for un-masked JPEG images with "standard" colour spaces (issue 6364)
Fixes 6364.
2015-08-18 22:25:37 +02:00
Jonas Jenwald
a6d10af3b4 Add disableStream to the list of preferences read by PDFViewerApplication.initialize (issue 6361)
Fixes 6361.
2015-08-18 12:35:42 +02:00
Jonas Jenwald
8c3b8238ac Don't catch MissingDataException in Parser_tryShift
I overlooked this while reviewing PR 6197, but I don't think that we should be catching that particular kind of exception here; hence this patch.
2015-08-16 11:35:54 +02:00
Jonas Jenwald
421289c7bc Merge pull request #6233 from Rob--W/crx-local-files
Improve support for viewing PDFs from file://-URLs in the Chrome extension
2015-08-15 14:15:36 +02:00
Jonas Jenwald
b1cf4d98ad Avoid more allocations for RTL text in bidi.js
Instead of building the resulting string char-by-char for RTL text, which is inefficient, we can just as well `join` the `chars` array.
2015-08-14 21:46:59 +02:00
Rob Wu
32e7a8adba Don't reload after updating if a tab is in use 2015-08-14 19:00:12 +02:00
Rob Wu
4ac8863e30 Restore extension tab after reload
Work-around for https://crbug.com/511670
2015-08-14 19:00:12 +02:00
Rob Wu
cf1d398bd2 Add translations of "Allow access to file URLs"
The JSON file is generated as follows.

1. Go to the src/chrome/app/resources directory of Chromium's source.

2. Find the translation ID of the "Allow access to file URLs" string:

grep 'Allow access to file URLs' generated_resources_en-GB.xtb

3. With the ID that you've found, locate the other translations.

grep 3341703758641437857 generated_resources_*.xtb

4. If the result looks OK, serialize the result as JSON and save it.

> path/to/pdf.js/web/chrome-i18n-allow-access-to-file-urls.json \
python -c "import json;print(json.dumps({ \
$(grep 3341703758641437857 generated_resources_*.xtb | \
 sed "s@generated_resources_\([^.]\+\)\.xtb:<translation[^>]\+>\(.\+\)</translation>@'\1':'''\2''',@" \
)}, sort_keys=True, indent=2))"

(Strings are taken from Chromium 45.0.2448.0 (ccrev.com/337313).
2015-08-14 18:59:55 +02:00
Rob Wu
775d4e69cf Teach users how to enable access to local files. 2015-08-14 18:59:30 +02:00
Jonas Jenwald
88bf19396e Merge pull request #6349 from yurydelendik/node-mozchunk
Fixes supportsMozChunked for node.js
2015-08-14 10:33:18 +02:00