Commit Graph

8589 Commits

Author SHA1 Message Date
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
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
Yury Delendik
974433a7a7 Merge pull request #6953 from Snuffleupagus/smask-transferMap-upper-limit
Correct the upper bound used when building the `transferMap` for SMasks (PR 6723 followup)
2016-02-03 09:26:37 -06:00
Jonas Jenwald
4770b516fe Correct the upper bound used when building the transferMap for SMasks (PR 6723 followup)
Even though the currently known test-cases render correctly without this patch, that seems more like a lucky coincidence, given that there's no guarantee that `transferMap[255] === 0` for every possible transfer function.
2016-02-03 13:41:10 +01:00
Tim van der Meij
a4b90243d0 Merge pull request #6940 from Snuffleupagus/differences-fix-indirect-objects
Ensure that we don't modify the `Dict` data when the `Differences` array of a font contains indirect objects
2016-01-31 20:17:16 +01:00
Jonas Jenwald
992472fd38 Ensure that we don't modify the Dict data when the Differences array of a font contains indirect objects
This patch fixes an issue that I inadvertently introduced in PR 5815, where we accidentally modify the `Differences` array in the encoding dictionary for indirect objects.

Instead of this change, we could also have used the now existing `Dict_getArray`. However in this case I don't think that would have been a good idea, since it would mean iterating through the array *twice*.
2016-01-30 13:31:24 +01:00
Brendan Dahl
02331f6e33 Make type 1 font program decryption faster.
Discard the values first so we don't have to slice the array.
2016-01-29 11:10:30 -08:00
Yury Delendik
e36b04e1ff Fix 'Ready' message sequence for Firefox ext disabled worker. 2016-01-29 11:43:19 -06:00
Jonas Jenwald
e401804f13 Remove the 'oplist' rendering intent when getOperatorList has returned the complete OperatorList, and prevent errors in PDFPageProxy_destroy for the 'oplist' rendering intent 2016-01-29 12:34:26 +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
Tim van der Meij
5d797e1a85 Merge pull request #6921 from Snuffleupagus/mandatory-deprecated
Always display `deprecated` messages, regardless of the verbosity setting
2016-01-29 12:12:08 +01:00
Yury Delendik
365bc99508 Merge pull request #6934 from jswalden/detach-terminology
Adjust a comment discussing transferred ArrayBuffers, to refer to those buffers being detached, not neutered
2016-01-28 17:11:39 -06:00
Jeff Walden
4691a4a1e4 Adjust a comment discussing transferred ArrayBuffers to refer to those buffers being detached, not neutered. This change makes the comment consistent with terminology used in the ECMAScript specification. 2016-01-28 14:52:07 -08:00
Yury Delendik
825a2225ab Merge pull request #6915 from yurydelendik/lookuptables
Refactor lookup hash tables/objects
2016-01-28 15:01:06 -06:00
Yury Delendik
2edf2792dc Replaces literal {} created lookup tables with Object.create 2016-01-28 12:18:38 -06:00
Yury Delendik
d6adf84159 Lazify OP_MAP. 2016-01-28 12:18:37 -06:00
Yury Delendik
1de90454b7 Lazify Metrics 2016-01-28 12:11:46 -06:00
Yury Delendik
55a201d92d Lazify NormalizedUnicodes 2016-01-28 11:56:42 -06:00
Yury Delendik
d0738d7e24 Lazify stdFontMap, serifFonts, GlyphMapForStandardFonts 2016-01-28 11:51:54 -06:00
Yury Delendik
1a9a665adf Refactor Encodings 2016-01-28 11:32:59 -06:00
Yury Delendik
4ef20de429 Lazify GlyphsUnicode. 2016-01-28 11:32:59 -06:00
Brendan Dahl
252b9d5910 Merge pull request #6753 from yurydelendik/cdn-worker
Wraps worker script if its cross-origin location is detected.
2016-01-27 13:21:10 -08:00
Yury Delendik
e44dada047 Publish 1.4.20 2016-01-27 10:32:58 -06:00
Yury Delendik
b15f335380 Merge pull request #6930 from Snuffleupagus/page-labels-standard-numbering
[api-minor] Change `getPageLabels` to always return the pageLabels, even if they are identical to standard page numbering
2016-01-27 09:31:52 -06: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
Brendan Dahl
1f2910b2a2 Merge pull request #6928 from yurydelendik/url-check
Fixes URL polyfill check for MS Edge.
2016-01-26 17:50:30 -08:00
Yury Delendik
bc30c42758 Fixes URL polyfill check for MS Edge. 2016-01-26 16:49:44 -06:00
Yury Delendik
0558ffcbf9 Merge pull request #6922 from Snuffleupagus/issue-1536
Prevent failures in the "scanning for endstream" code, in `Parser_makeStream`, by handling the case where 'endstream' is split between contiguous chunks (issue 1536)
2016-01-26 10:06:51 -06:00
Jonas Jenwald
15ce96a6eb Prevent failures in the "scanning for endstream" code, in Parser_makeStream, by handling the case where 'endstream' is split between contiguous chunks (issue 1536) 2016-01-26 09:03:51 +01:00
Jonas Jenwald
472e793a27 Always display deprecated messages, regardless of the verbosity setting
Currently the `deprecated` message is using `warn`, meaning that it's possible to disable warnings about deprecated API usage through the `PDFJS.verbosity` setting.

I don't think that it should be possible to opt out of deprecation messages,[1] since it might mean that in a custom deployment of PDF.js these messages could be overlooked, leading to PDF.js being broken (seemingly without any warning) when updating to a future version.
Obviously this could be considered the responsibility of the people doing custom PDF.js implementations, but in order to reduce the support burden later on, it seems better to "annoy" people upfront.

Compared to various `info`/`warn`/`error` messages, `deprecated` messages should be very simple to get rid of -- just update the API usage and the message goes away!

---
[1] In e.g. Firefox it doesn't seem possible to prevent deprecation warnings from being displayed (in the Browser Console).
2016-01-25 12:38:34 +01:00
Yury Delendik
051a0746e1 Changes version of the stable release to 1.3.91 2016-01-24 12:35:05 -06:00
Brendan Dahl
117f105ef1 Merge pull request #6919 from brendandahl/update-links
Update beta and stable.
2016-01-22 10:45:14 -08:00
Brendan Dahl
0cb56968fa Update beta and stable. 2016-01-22 10:44:32 -08:00