Commit Graph

10528 Commits

Author SHA1 Message Date
Jonas Jenwald
c56f3f04dd [api-major] Remove the SINGLE_FILE build target
Please note that this build target, and the resulting `build/pdf.combined.js` file, is equivalent to setting the `PDFJS.disableWorker` option to `true` which is a performance footgun.
2018-01-29 14:44:44 +01:00
Tim van der Meij
55e3f97aa9
Merge pull request #9415 from Snuffleupagus/clitests-PDFNodeStream
Utilize `PDFNodeStream` to run more API unit-tests on Node.js/Travis
2018-01-28 18:24:59 +01:00
Jonas Jenwald
42c71cd99f Utilize PDFNodeStream to run more API unit-tests on Node.js/Travis 2018-01-28 17:14:08 +01:00
Rob Wu
fd242ad2c2
Merge pull request #9410 from Rob--W/cleanup-chrome-compat
Cleanup code to drop support for Chrome < 49 in the Chrome extension
2018-01-26 16:32:18 +01:00
Rob Wu
ff5ecc3f4c Remove work-around for old filesystem:-bug
https://crbug.com/362061 was fixed in Chrome 36, and the lowest
supported Chrome version in the extension is Chrome 49, so the
work-around for a filesystem:-bug in chromecom can be removed.
2018-01-26 15:54:35 +01:00
Rob Wu
7268f4ec1b [CRX] Add comment about ftp compatibility 2018-01-26 15:54:35 +01:00
Rob Wu
838573abd4 [CRX] Clean up file/ftp handler
Merge ftp and file handler now their implementations are identical.
Remove redundant comment (the referenced Chrome bug has been fixed
a long time ago - https://crbug.com/302548 ).
2018-01-26 15:54:35 +01:00
Rob Wu
85378fc982 [CRX] Remove feature-detect.js
All detected features were introduced in Chrome 35.
We don't support Chrome 34 and earlier, so drop the legacy code.
2018-01-26 15:54:35 +01:00
Jonas Jenwald
28c87ce9c6
Merge pull request #9409 from Rob--W/compat-chrome-49
Fix Chrome 49 compatibility via polyfills
2018-01-26 14:36:31 +01:00
Rob Wu
e904b8a67c Drop third parameter to replaceState/pushState
This was introduced in #3582 to work around https://crbug.com/274024 .
The bug in Chrome has been fixed a long time ago (at least 33), so let's
simplify the code.
2018-01-26 13:23:51 +01:00
Rob Wu
5d1c541702 Enable some polyfills for compat with Chrome 49
Successfully tested with Chrome 49.
2018-01-26 12:31:41 +01:00
Rob Wu
44025a3ec1 Explicitly state intended support in compatibility.js
Add comments with supported browser versions where missing.

Method:
- Use MDN compat tables if available.
- Otherwise test in Chrome (31+) otherwise.
  (the Chrome Web Store does not update older versions of
   Chrome, so probably nobody is interested in even older
   versions, even though there is an existing comment for
   Chrome<29 at `document.currentScript`).
2018-01-26 12:31:41 +01:00
Jonas Jenwald
628e70fbb5
Merge pull request #9405 from Snuffleupagus/pr-9245-followup
Re-factor resetting of `StatTimer` instances to fix completely broken benchmarking (PR 9245 follow-up)
2018-01-26 10:15:41 +01:00
Jonas Jenwald
d33c763dd5 Re-factor resetting of StatTimer instances to fix completely broken benchmarking (PR 9245 follow-up)
It turns out that PR 9245 unfortunately broke benchmarking completely, sorry about that!

The bug is that we were attempting to reset the current instance of `StatTimer`, instead of creating a new one as was previously done. By resetting the current instance, the `StatTimer` data fetched in `test/driver.js` is now wiped out since it points to the *same* underlying object.
This re-use of a `StatTimer` instance was asked for during review, and unfortunately I didn't test this thoroughly enough before submitting the final version of the PR.[1]

---

[1] Note that while I did test the benchmarking scripts with that PR *before* initially submitting it, I did however forget to do that after addressing the review comments which might explain why this problem went unnoticed.
2018-01-25 19:46:03 +01:00
Jonas Jenwald
b6c57d9088
Merge pull request #8991 from janpe2/jbig2-huffman
Implement Huffman coding in JBIG2
2018-01-23 19:26:42 +01:00
Jani Pehkonen
5593c970e0 Implement Huffman coding in JBIG2 2018-01-23 17:04:07 +02:00
Jonas Jenwald
f0216484bc
Merge pull request #9383 from Rob--W/better-content-disposition-parser
Better content disposition parser
2018-01-21 15:08:14 +01:00
Tim van der Meij
9746646511
Merge pull request #9386 from shikhar-scs/remove-parsejbig2-function
removed parseJbig2 function
2018-01-21 14:51:59 +01:00
Rob Wu
a4e907169e Improve correctness of Content-Disposition parser
Re-uses logic from 9f5fcae11c/extension/content-disposition.js
which is already covered by tests: 6f3bbb8bbf
2018-01-21 13:31:12 +01:00
Jonas Jenwald
fe5102a27f
Merge pull request #9363 from Rob--W/fetch-http/s-only
Limit PDFFetchStream to http(s) in the Chrome extension
2018-01-21 11:45:09 +01:00
Shikhar Agnihotri
43e003cf5c
removed parseJbig2 function 2018-01-20 19:49:06 +05:30
Jonas Jenwald
fad2a3f427
Merge pull request #9384 from timvandermeij/remove-moznomarginboxes
Remove `moznomarginboxes`
2018-01-20 10:11:22 +01:00
Tim van der Meij
81aa95b560
Remove moznomarginboxes 2018-01-19 22:05:50 +01:00
Rob Wu
0ffe9b9289 Remove useless test from network_utils_spec.js
Remove "returns null when content disposition is form-data".
The name of the test is already misleading: It suggests that
the return value is null if the Content-Disposition starts with
"form-data". This is not the case, anything with the "filename"
parameter is accepted.

So, to correct this, one would have to rephrase the test description to
"returns null when content disposition has no filename".
But this is already tested by the test called
"gets the filename from the response header".

So, remove the test.
2018-01-19 17:28:47 +01:00
Tim van der Meij
75dc2bbd35
Merge pull request #9379 from Snuffleupagus/contentDispositionFilename
[api-minor] Extract the Content-Disposition filename
2018-01-18 23:28:50 +01:00
Jonas Jenwald
69a8336cf1 Address the final round of review comments for Content-Disposition filename extraction
This patch updates the `IPDFStreamReader` interface and ensures that the interface/implementation of `network.js`, `fetch_stream.js`, `node_stream.js`, and `transport_stream.js` all match properly.
The unit-tests are also adjusted, to more closely replicate the actual behaviour of the various actual `IPDFStreamReader` implementations.
Finally, this patch adjusts the use of the Content-Disposition filename when setting the title in the viewer, and adds `PDFDocumentProperties` support as well.
2018-01-18 17:39:22 +01:00
Juan Salvador Perez Garcia
eb1f6f4c24 Content disposition filename
File name is extracted from headers.
2018-01-18 17:38:44 +01:00
Jonas Jenwald
96c573ad38
Merge pull request #9345 from himanish-star/hide-download-button
Download button is now hidden for PDFs which are loaded from 'file://'
2018-01-18 17:36:21 +01:00
Soumya Himanish Mohapatra
06b3bb8214 Download button is now hidden for PDFs which are opened from 'file://' 2018-01-18 16:13:25 +05:30
Jonas Jenwald
f774abc8d3
Merge pull request #9368 from acchou/9362
end() is the official way to release a Writable stream
2018-01-17 12:45:23 +01:00
Jonas Jenwald
22a9274193 Update l10n files 2018-01-17 11:37:44 +01:00
Jonas Jenwald
2bc3d0ff91
Merge pull request #9360 from mmcev106/master
Fixed a javascript error in the mobile viewer example that prevented …
2018-01-17 11:32:48 +01:00
Mark McEver
c8344016fa Fixed a javascript error in the mobile viewer example that prevented an alert from being displayed 2018-01-16 15:36:54 -06:00
Andy Chou
b867c3299b end() is the official way to release a Writable stream 2018-01-16 12:01:33 -08:00
Tim van der Meij
1ad33c4514
Merge pull request #9364 from shikhar-scs/change-decodeURI-to-decodeURIcomponent
changed decodeURI to decodeURIComponent: Fixes #8987
2018-01-15 22:05:48 +01:00
shikhar-scs
32080f1081 changed decodeURI to decodeURIComponent 2018-01-15 19:31:25 +05:30
Tim van der Meij
237bc2ef9d
Merge pull request #9323 from juncaixinchi/master
Get correct path in node_stream on windows platform( issue #9020)
2018-01-14 15:41:56 +01:00
Rob Wu
1c8cacd6b9 Limit PDFFetchStream to http(s) in the Chrome extension
The `fetch` API is only supported for http(s), even in Chrome extensions.
Because of this limitation, we should use the XMLHttpRequest API when the
requested URL is not a http(s) URL.

Fixes #9361
2018-01-14 00:34:46 +01:00
Tim van der Meij
a7cb560f17
Merge pull request #9343 from Snuffleupagus/btoa/atob-Node-polyfills
Restore the `btoa`/`atob` polyfills for Node.js
2018-01-13 15:52:31 +01:00
juncaixinchi
8e278d9a45 Get correct path in node_stream on windows platform 2018-01-13 21:13:24 +08:00
Jonas Jenwald
0e1b5589e7 Restore the btoa/atob polyfills for Node.js
These were removed in PR 9170, since they were unused in the browsers that we'll support in PDF.js version `2.0`.
However looking at the output of Travis, where a subset of the unit-tests are run using Node.js, there's warnings about `btoa` being undefined. This doesn't appear to cause any errors, which probably explains why we didn't notice this before (despite PR 9201).
2018-01-13 01:31:05 +01:00
Tim van der Meij
ba0a3aebd0
Merge pull request #9356 from Snuffleupagus/PDFHistory-maxUid-pageHide-fixes
Two small `PDFHistory` fixes, concerning the `this._maxUid` property and the 'pagehide' event
2018-01-12 22:07:15 +01:00
Brendan Dahl
d77fc8882a
Merge pull request #9352 from Snuffleupagus/issue-9285
Attempt to actually resolve ColourSpace names in accordance with the specification (issue 9285)
2018-01-12 13:01:22 -08:00
Jonas Jenwald
e20eacd484 Allow overwriting temporary, in addition to empty, history entries on 'pagehide'
When navigating away from the viewer, there's no good reason for disallowing replacement of a *temporary* history entry (in addition to empty ones).

Given that the current position is temporarily added to the browser history using a (short) timeout, the history entry will most likely already be correct when the 'pagehide' event fires. However, if the user is quick enough that might not always be the case, in which case the adjusted logic may help.
2018-01-11 12:34:19 +01:00
Jonas Jenwald
448a7a27cb Ensure that the PDFHistory._maxUid property is correctly updated when initializing/navigating the history
This is a follow-up to commit e772124339, in PR 8994, to cover a couple of cases missed there.
2018-01-11 12:09:01 +01:00
Jonas Jenwald
d0c8992e8a Attempt to actually resolve ColourSpace names in accordance with the specification (issue 9285)
Please refer to the PDF specification, in particular http://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G7.3801570

> A colour space shall be specified in one of two ways:
>  - Within a content stream, the CS or cs operator establishes the current colour space parameter in the graphics state. The operand shall always be name object, which either identifies one of the colour spaces that need no additional parameters (DeviceGray, DeviceRGB, DeviceCMYK, or some cases of Pattern) or shall be used as a key in the ColorSpace subdictionary of the current resource dictionary (see 7.8.3, "Resource Dictionaries"). In the latter case, the value of the dictionary entry in turn shall be a colour space array or name. A colour space array shall never be inline within a content stream.
>
> - Outside a content stream, certain objects, such as image XObjects, shall specify a colour space as an explicit parameter, often associated with the key ColorSpace. In this case, the colour space array or name shall always be defined directly as a PDF object, not by an entry in the ColorSpace resource subdictionary. This convention also applies when colour spaces are defined in terms of other colour spaces.
2018-01-10 20:20:43 +01:00
Jonas Jenwald
5a52ee0a79
Merge pull request #9350 from janpe2/svg-closeEOFillStroke
Implement `closeEOFillStroke` in SVG backend
2018-01-09 21:09:11 +01:00
Brendan Dahl
3925aab010
Merge pull request #9282 from Snuffleupagus/TrueType-Collection
Add support for TrueType Collection fonts (issue 9262)
2018-01-09 11:22:52 -08:00
Jani Pehkonen
d1e1dbfc14 Implement closeEOFillStroke in SVG backend 2018-01-09 19:42:12 +02:00
Jonas Jenwald
915e3f4c5f
Merge pull request #9099 from tiriana/allow-dontFlip-in-PDFPageProxy-getViewport
Allows 'dontFlip' as third arg in PDFPageProxy.getViewport
2018-01-09 18:27:26 +01:00