Commit Graph

9022 Commits

Author SHA1 Message Date
Jonas Jenwald
05917b65d5 Merge pull request #7016 from timvandermeij/annotations-missing-popup
Group popup creation code and apply it to more annotation types
2016-02-25 10:27:49 +01:00
Tim van der Meij
ad31e52a26 Group popup creation code and apply it to more annotation types 2016-02-25 00:35:45 +01: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
Tim van der Meij
6a33dfd13a Implement support for FileAttachment annotations 2016-02-23 22:49:53 +01:00
Tim van der Meij
c53581f4e5 Merge pull request #7009 from KamiHQ/annotations-fix
[api-minor] Always expose data.title and data.contents for TextAnnotation
2016-02-22 22:59:38 +01:00
Tim van der Meij
ebe6fb2560 Merge pull request #7012 from KamiHQ/fix-annotation-popup
don't render highlight/underline/squiggly/strikeout annotations that doesn't have popup
2016-02-22 21:54:08 +01:00
Xiliang Chen
6762ff2fd6 don't render highlight/underline/squiggly/strikeout annotations that doesn't have popup 2016-02-22 13:10:20 +13:00
Xiliang Chen
266cedd960 always expose data.title and data.content 2016-02-19 13:50:25 +13:00
Brendan Dahl
0629fd0afa Merge pull request #7007 from Snuffleupagus/bug-1248959
[Addon] Catch errors in `getFindBar` (in PdfStreamConverter.jsm) to fix loading of PDF files in the bookmark sidebar (bug 1248959)
2016-02-18 16:18:15 -08:00
Yury Delendik
0d591719d9 Makes PDF data reading Streams API friendly. 2016-02-18 13:17:53 -06:00
Jonas Jenwald
f64113c927 [Addon] Catch errors in getFindBar (in PdfStreamConverter.jsm) to fix loading of PDF files in the bookmark sidebar (bug 1248959)
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1248959.
2016-02-18 13:59:18 +01:00
Jonas Jenwald
8cdb69634f Merge pull request #6984 from Snuffleupagus/issue-6066
Update `JpegImage.getData` to support `forceRGBoutput` for images with `numComponents === 1` (issue 6066)
2016-02-18 11:51:07 +01:00
Jonas Jenwald
a494e33776 Update JpegImage.getData to support forceRGBoutput for images with numComponents === 1 (issue 6066)
*A more robust solution for issue 6066.*

As a temporary work-around for (the upstream) [bug 1164199](https://bugzilla.mozilla.org/show_bug.cgi?id=1164199), we parsed *all* images in the Firefox addon during a short time.
Doing so uncovered an issue with our image handling (see 6066), for JPEG images with a `DeviceGray` ColorSpace *and* `bpc !== 1` (bits per component).

As long as we let the browser handle image decoding in this case, this isn't going to be an issue, but I do think that we should proactively fix this to avoid future issues if we change where the images are decoded (in `jpg.js` vs in browser).
Also, we currently don't seem to have a test-case for that kind of image data.
2016-02-18 10:12:37 +01:00
Tim van der Meij
9eedfc128c Merge pull request #6998 from Snuffleupagus/outline-styles-core
[api-minor] Change `getOutline` to actually return the RGB color of outline items
2016-02-16 23:31:55 +01: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
45fea8808e Merge pull request #6985 from timvandermeij/xhtml-leftovers
Remove XHTML leftovers from the viewer HTML files
2016-02-14 15:32:45 +01:00
Tim van der Meij
05e080c802 Merge pull request #6987 from timvandermeij/readme
Remove Opera from the README file as they removed the extension
2016-02-14 14:09:48 +01:00
Tim van der Meij
eeeebe8061 Remove Opera from the README file as they removed the extension 2016-02-14 14:05:20 +01:00
Tim van der Meij
edb2eecdc8 Remove XHTML leftovers from the viewer HTML files 2016-02-14 13:23:34 +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
e9a1a47d28 Merge pull request #6982 from Snuffleupagus/evaluator-remove-getAll
Remove the only remaining `Dict_getAll` usage (in evaluator.js) and the method itself
2016-02-13 20:48:37 +01:00
Tim van der Meij
addc4a3ded Merge pull request #6856 from KamiHQ/remove-has-html
move hasHtml to AnnotationElement
2016-02-13 20:12:09 +01:00
Tim van der Meij
cd9d134af3 Merge pull request #6939 from LilyBin/uglifyjs
Use UglifyJS to minify files in minified target
2016-02-13 15:07:47 +01:00
Jonas Jenwald
1ee016b005 Remove Dict_getAll since it is now unused
`Dict_getAll` is problematic for a number of reasons. First of all, as issue 6961 shows, it can be really bad for performance, since it dereferences all indirect objects.
Second of all, all the derefencing can lead to data being unncessarily requested when ranged/chunked loading is used, thus unnecessarily delaying rendering.

Note: For cases where `Dict_getAll` was previously used, `Dict_getKeys` in combination with `Dict_get` can be used instead. This has the advantage that data isn't requested until it's actually needed.
2016-02-12 22:32:07 +01:00
Jonas Jenwald
93ea866f01 Remove getAll from EvaluatorPreprocessor_read
For the operators that we currently support, the arguments are not `Dict`s, which means that it's not really necessary to use `Dict_getAll` in `EvaluatorPreprocessor_read`.
Also, I do think that if/when we support operators that use `Dict`s as arguments, that should be dealt with in the corresponding `case` in `PartialEvaluator_getOperatorList` which handles the operator.

The only reason that I can find for using `Dict_getAll` like that, is that prior to PR 6550 we would just append certain (currently unsupported) operators without doing any further processing/checking. But as issue 6549 showed, that can lead to issues in practice, which is why it was changed.

In an effort to prevent possible issue with unsupported operators, this patch simply ignores operators with `Dict` arguments in `PartialEvaluator_getOperatorList`.
2016-02-12 22:31:50 +01:00
Jonas Jenwald
62b17ad36e Add a linked load test for issue 6549 2016-02-12 18:10:07 +01:00
Yury Delendik
2f145d8db4 Republish addon 2016-02-11 15:36:32 -06:00
Yury Delendik
2addcc7957 Republish addon 2016-02-11 15:21:15 -06:00
Jonas Jenwald
2d61652c75 Update l10n files 2016-02-11 14:33:03 +01:00
Tim van der Meij
1f49e7b194 Merge pull request #6975 from Snuffleupagus/ColorSpace-remove-getAll
Get rid of `getAll` usage in colorspace.js
2016-02-11 14:23:10 +01:00
Tim van der Meij
6133a993a9 Merge pull request #6972 from Snuffleupagus/loadType3Data-getKeys
Replace `getAll` with `getKeys` in `loadType3Data`
2016-02-11 14:15:31 +01:00
Tim van der Meij
72c05af37c Merge pull request #6973 from pra85/patch-1
Fix a typo in api.js
2016-02-11 14:10:45 +01:00
Jonas Jenwald
02a6b73492 Get rid of getAll usage in colorspace.js
For the `CalGray`/`CalRGB`/`Lab` colour spaces, we're currently using `getAll` to retrieve the parameters. However that's not really necessary, since we may just as well explicitly `get` the needed parameters instead.
2016-02-11 11:59:26 +01:00
Prayag Verma
049beac346 Fix a typo in api.js
`fulfills` misspelt as `fullfills`
2016-02-11 07:18:56 +05:30
Xiliang Chen
e42da0f5e9 move hasHtml to AnnotationElement 2016-02-11 13:58:17 +13:00
Tim van der Meij
acf74d40b1 Merge pull request #6941 from Rob--W/crx-allow-pdf-in-local-frames
Allow local PDF files to be viewed in local frames
2016-02-10 20:58:24 +01:00
Jonas Jenwald
f7f60197ce Replace getAll with getKeys in loadType3Data
Not only is `getAll` less efficient, but given that we actually need the keys here, using `getKeys` seems much more suitable.
2016-02-10 20:19:14 +01:00
Yury Delendik
33b57d7450 Merge pull request #6971 from Snuffleupagus/issue-6961
Replace `getAll` with `getKeys` in `PartialEvaluator_hasBlendModes` to speed up loading of badly generated PDF files (issue 6961)
2016-02-10 11:06:06 -06:00
Jonas Jenwald
07e1ad40a2 Replace getAll with getKeys in PartialEvaluator_hasBlendModes to speed up loading of badly generated PDF files (issue 6961)
Some bad PDF generators, in particular "Scribus PDF", duplicates resources *a lot* at various levels of the PDF files. This can lead to `PartialEvaluator_hasBlendModes` taking an unreasonable amount of time to complete.
The reason is that the current code is using `Dict_getAll`, which recursively dereferences *all* indirect objects, which can be really slow. This patch instead uses `Dict_getKeys`, and then manually looks up only the necessary indirect objects.

I've added the PDF file as a `load` test. The most important thing here is probably to ensure that the file remains available in the repo, and the comment should help reduced the chance of regressions. (Note that locally, the `load` test times out without this patch, but we cannot really assume that that always happens.)

Fixes 6961.
2016-02-10 17:21:38 +01:00
Rob Wu
0ec82d4a50 Allow local PDF files to be viewed in local frames
The Chrome extension enforces that local files cannot be embedded in
non-local web pages. The previous check was too strict (because the
origin of a file:-URL is "null"), and prevented local PDF from being
viewed in local files).

This patch fixes that problem, by querying the actual tab URL via the
background page.

Steps to verify:
1. Create a HTML file: `<iframe src=test.pdf width=100% height=100%>`
2. Build and load the extension.
3. Allow file access to the extension at `chrome://extensions`
4. Open the HTML file from a file:// URL.
5. VERIFY: The extension should attempt to load the PDF file.

6. Now open the following (replace ID with the extension ID, which you
   can find at `chrome://extensions`):
  `data:text/html,<iframe src="chrome-extension://ID/file:///test.pdf">`
7. VERIFY: The next error should be displayed:
   "Refused to load a local file in a non-local page for security reasons."
2016-02-10 14:52:54 +01:00
Tim van der Meij
03f12a10b5 Merge pull request #6954 from Snuffleupagus/setGState-fixes
Various `setGState` improvements
2016-02-10 00:38:31 +01:00
Tim van der Meij
02b161d432 Merge pull request #6933 from brendandahl/faster-decrypt
Make type 1 font program decryption faster.
2016-02-09 23:41:22 +01:00
Brendan Dahl
d7e5935f91 Merge pull request #6938 from yurydelendik/fix-ff-disableworker
Fix 'Ready' message sequence for Firefox ext disabled worker.
2016-02-09 10:50:12 -08:00
Tim van der Meij
a0aa781c39 Merge pull request #6913 from Rob--W/importScripts-work-around
Improve work-around for importScripts bug.
2016-02-04 19:51:26 +01:00
Rob Wu
097e273ca4 Improve work-around for importScripts bug.
Reverts "Hack to avoid intermidiate Chrome failures during tests."
(2b2c521213).

require.js uses importScript asynchronously, which activates the worker
GC bug in WebKit. This patch works around a bug in a way that is similar
in the upcoming (but not yet released) require.js 2.1.23

The advantage of the new work-around is that it allows the runtime to
garbage-collect idle Workers.

References:
- https://crbug.com/572225
- https://webkit.org/b/153317
2016-02-03 23:30:27 +01:00
Yury Delendik
4c59712606 Merge pull request #6904 from timvandermeij/cleanup-workers
Destroy workers when they are no longer needed in the unit tests
2016-02-03 14:46:22 -06:00
Jonas Jenwald
a1fe2cb443 Don't directly access the private map in setGState, and ensure that we avoid indirect objects
*This patch is based on something I noticed while debugging some of the PDF files in issue 6931.*

In a number of the cases in `setGState`, we're implicitly assuming that we're not dealing with indirect objects (i.e. `Ref`s). See e.g. the 'Font' case, or the various cases where we simply do `gStateObj.push([key, value]);` (since the code in `canvas.js` won't be able to deal with a `Ref` for those cases).

The reason that I didn't use `Dict_forEach` instead, is that it would re-introduce the unncessary closures that PR 5205 removed.
2016-02-03 17:13:42 +01:00
Jonas Jenwald
2d4a1aa0af Actually ignore no-op setGState (PR 5192 followup)
The intention of PR 5192 was to avoid adding empty `setGState` ops to the operatorList. But the patch accidentally used `>=`, which means that it's not actually working as intended, since empty arrays always have `length === 0`.
2016-02-03 17:13:02 +01:00