Commit Graph

10465 Commits

Author SHA1 Message Date
Tim van der Meij
5dd1c9a98b Merge pull request #9031 from Snuffleupagus/rm-viewer-2.0-fallback-code
Remove all warning/fallback code for obsolete method signatures in `web/` files
2017-10-15 17:11:26 +02:00
Jonas Jenwald
816ffa29aa Remove all warning/fallback code for obsolete method signatures in web/ files 2017-10-15 16:57:30 +02:00
Tim van der Meij
815bc53a16 Merge pull request #9029 from Snuffleupagus/eslint--report-unused-disable-directives
Enable the `--report-unused-disable-directives` ESLint command line option
2017-10-15 15:12:20 +02:00
Tim van der Meij
e955168cab Merge pull request #9027 from Snuffleupagus/core-js-WeakMap
Replace our `WeakMap` polyfill with the one from core-js
2017-10-15 15:10:43 +02:00
Jonas Jenwald
04b46831c1 Enable the --report-unused-disable-directives ESLint command line option
This option was added in [version `4.8.0` of ESLint](https://github.com/eslint/eslint/releases/tag/v4.8.0), which is already listed as the minimum version in our `package.json` file; please refer to https://eslint.org/docs/user-guide/command-line-interface#--report-unused-disable-directives for additional details.

Despite the caveat listed in the link above, I still think that using this option makes sense since it will help ensure that no longer necessary disable statements are removed.
2017-10-15 13:45:12 +02:00
Jonas Jenwald
0f90d5130c [api-major] Remove all remaining deprecated functions/methods 2017-10-15 13:27:10 +02:00
Jonas Jenwald
2f32131601 Replace our WeakMap polyfill with the one from core-js
Since we're already using core-js elsewhere in `compatibility.js`, we can reduce the amount of code we need to maintain ourselves.

https://github.com/zloirock/core-js#weakmap
2017-10-15 10:22:06 +02:00
Brendan Dahl
5ad945f462 Learning to spell. 2017-10-13 10:04:51 -07:00
Jonas Jenwald
7a0db8960d Layout the sidebar in the same vertical position regardless of the viewer width (issue 4052, bug 850591)
If we want to (eventually) make it possible to resize the sidebar, then having its width indirectly affect the toolbar is going to wreck havoc on the media queries used to show/hide buttons in the main toolbar (since many of them depend on the toolbar state, and thus its width).
Updating all of the media queries dynamically with JavaScript seems like a non-starter, given that it'd cause *very* messy code. It thus seem to me that we'd need to fix the position of the sidebar, to have any hope of (in the short term) addressing issue 2072.

Hence, I'm suggesting that the we always layout the sidebar in a consistent vertical position, and only animate the `viewerContainer` rather than the entire `mainContainer`.

Fixes 4052.
Fixes bug 850591.
2017-10-11 18:17:28 +02:00
Tim van der Meij
853db85b76 Merge pull request #9013 from Snuffleupagus/PDFHistory-nameddest
Fix a `PDFHistory` regression with document hashes of the `nameddest=...` form
2017-10-10 22:49:07 +02:00
Jonas Jenwald
33b1d1b20a Fix a PDFHistory regression with document hashes of the nameddest=... form
Unfortunately I've just found out that this isn't working entirely correct; my apologies for accidentally breaking this in PR 8775.

Compare e.g. this link: http://mirrors.ctan.org/info/lshort/english/lshort.pdf#page.157, with this one: http://mirrors.ctan.org/info/lshort/english/lshort.pdf#nameddest=page.157.

Notice how in the *second* case, the history stops working correctly.

*The various edge-case regressions in the new `PDFHistory` code is reminding my why I put off the rewrite for so long :-(*
2017-10-09 21:58:54 +02:00
Tim van der Meij
c80237729c Merge pull request #9009 from Snuffleupagus/issue-5767
Only warn about unsupported JavaScript, in the viewer, when non-empty actions exist (issue 5767)
2017-10-08 15:04:59 +02:00
Jonas Jenwald
b5a044b931 Only warn about unsupported JavaScript, in the viewer, when non-empty actions exist (issue 5767)
Some PDF files contain JavaScript actions that consist of nothing more that one, or possibly several, empty string(s). At least to me, printing a warning/showing the fallback seems completely unnecessary in that case.

Furthermore, this patch also makes use of an early `return`, so that we no longer will attempt to check for printing instructions when no JavaScript is present in the PDF file.

*Note:* It would perhaps make sense to change the API/core code, such that we ignore empty entries there instead. However, that would probably be considered a breaking changing with respect to backwards compatibility, hence this simple viewer only solution.

Fixes 5767.
2017-10-08 14:29:12 +02:00
Jonas Jenwald
ab4d5be192 Merge pull request #9008 from diegocr/patch-1
Mispelled isEvalSupported property at FontFaceObject() creation.
2017-10-07 23:12:54 +02:00
Diego Casorran
11b1daa72d Mispelled isEvalSupported property at FontFaceObject() creation. 2017-10-07 20:05:21 +02:00
Tim van der Meij
509d3728f1 Merge pull request #8922 from Snuffleupagus/paintXObject-errors
Allow `getOperatorList`/`getTextContent` to skip errors when parsing broken XObjects (issue 8702, issue 8704)
2017-10-07 15:46:26 +02:00
Tim van der Meij
bbec2ed1f1 Merge pull request #9001 from Snuffleupagus/AnnotationLayerBuilder-cancel
Prevent the `annotationLayer` from, in some cases, becoming duplicated on the first page when the document loads
2017-10-07 14:49:42 +02:00
Jonas Jenwald
ee5862bd81 Prevent the annotationLayer from, in some cases, becoming duplicated on the first page when the document loads
I don't know if this is a regression, but I noticed earlier today that depending on the initial scale *and* sidebar state, the `annotationLayer` of the first rendered page may end up duplicated; please see screen-shot below.

[screen-shot]

I can reproduce this reliable with e.g. https://arxiv.org/pdf/1112.0542v1.pdf#zoom=page-width&pagemode=bookmarks.
When the document loads, rendering of the first page begins immediately. When the sidebar is then opened, that forces re-rendering which thus aborts rendering of the first page.
Note that calling `PDFPageView.draw()` will always, provided an `AnnotationLayerFactory` instance exists, call `AnnotationLayerBuilder.render()`. Hence the events described above will result in *two* such calls, where the actual annotation rendering/updating happens asynchronously.

For reasons that I don't (at all) understand, when multiple `pdfPage.getAnnotations()` promises are handled back-to-back (in `AnnotationLayerBuilder.render()`), the `this.div` property seems to not update in time for the subsequent calls.
This thus, at least in Firefox, result in double rendering of all annotations on the first page.

Obviously it'd be good to find out why it breaks, since it *really* shouldn't, but this patch at least provides a (hopefully) acceptable work-around by ignoring `getAnnotations()` calls for `AnnotationLayerBuilder` instances that we're destroying (in `PDFPageView.reset()`).
2017-10-07 11:34:53 +02:00
Brendan Dahl
ec46967360 Merge pull request #9002 from mozilla/revert-8971-close-handler
Revert "Closes all promises/streams when handler is destroyed."
2017-10-06 10:26:24 -07:00
Yury Delendik
fab59e0f91 Revert "Closes all promises/streams when handler is destroyed." 2017-10-06 11:55:28 -05:00
Tim van der Meij
460c4e38cc Merge pull request #8994 from Snuffleupagus/PDFHistory-forward
Fix a regression that (effectively) makes `PDFHistory.forward` a no-op
2017-10-05 23:04:46 +02:00
Tim van der Meij
b9662e97d2 Merge pull request #8992 from Snuffleupagus/RenderingCancelledException-API-2
[api-major] When rendering is cancelled, always reject with `RenderingCancelledException`
2017-10-05 22:51:57 +02:00
Jonas Jenwald
e3873b29fd Merge pull request #8990 from pixelexel/fix-#8951
Added component example for single page viewer
2017-10-05 20:31:29 +02:00
Brendan Dahl
bc396efb54 Reccomend attaching pdfs instead of links. 2017-10-05 11:29:56 -07:00
pixel
484ec3d09c Added component example for single page viewer
Checking for PDFJS.PDFSinglePageViewer instead

Added component example for single page viewer
2017-10-05 23:46:02 +05:30
Jonas Jenwald
e772124339 Fix a regression that (effectively) makes PDFHistory.forward a no-op
*It appears that this accidentally broken in PR 8775.*

Note that `PDFHistory.forward` is only used with certain named actions, and these aren't that commonly used, which ought to explain why this error managed to sneak in.

Steps to reproduce the issue (and verify the fix):
 1. Navigate to e.g. http://mirrors.ctan.org/info/lshort/english/lshort.pdf
 2. Click on a couple of links, or outline items, such that the history is populated with a few entries.
 3. In the console, execute `PDFViewerApplication.pdfHistory.back()` one or more times, thus navigating back to a previous viewer position.
 4. In the console, execute `PDFViewerApplication.pdfHistory.forward() one or more times.

At the last step above, no (forward) navigation happens with the current `master`; now compare with this patch.
2017-10-05 13:56:40 +02:00
Jonas Jenwald
04d4faefc4 Remove the this._currentUid property from PDFHistory, since it's no longer needed
Commit 938dffb06b, in PR 8885, removed the only actual usage of `this._currentUid` and it can thus be removed.
2017-10-05 13:38:25 +02:00
Jonas Jenwald
43134d5b33 Only handle RenderingCancelledException in the viewer code, when rendering is cancelled 2017-10-04 18:13:46 +02:00
Jonas Jenwald
3d79bd5e87 [api-major] When rendering is cancelled, always reject with RenderingCancelledException 2017-10-04 18:09:28 +02:00
Tim van der Meij
e279d37181 Merge pull request #8980 from LukasDrgon/patch-1
Add CDN links
2017-10-03 22:51:02 +02:00
Tim van der Meij
f28a4b0197 Merge pull request #8982 from timvandermeij/remove-deprecated
[api-major] Remove deprecated code
2017-10-03 22:45:28 +02:00
Tim van der Meij
ee9b5a12da
Remove the deprecated parameters for getDocument of the API
This is deprecated since October 2015 with a visible message, so we can
safely remove this now.
2017-10-02 23:05:32 +02:00
Tim van der Meij
0817375d2f
Remove the deprecated disableNativeImageDecoder parameter of the API
This is deprecated since May 2017 with a visible message, so we can
safely remove this now.
2017-10-02 23:01:57 +02:00
Tim van der Meij
b651cfb440
Remove the deprecated UnsupportedManager class of the API
This is deprecated since November 2015 with a visible message, so we
can safely remove this now.
2017-10-02 22:54:22 +02:00
Tim van der Meij
918bd98a2f
Remove the deprecated destroy method of the API
This is deprecated since October 2015 with a visible message, so we can
safely remove this now.
2017-10-02 22:54:15 +02:00
Tim van der Meij
9b353ef407
Remove the deprecated parameter handling in the render method of the API
This is deprecated since January 2015 with a visible message, so we can
safely remove this now.
2017-10-02 22:54:01 +02:00
Lukas Drgon
c2f1ff48d5 Add CDN link
Add CDN link

Add Popular CDNs

Add popular CDNs (site)

Moving section
2017-10-02 22:14:06 +02:00
Tim van der Meij
ef02d3d8da Merge pull request #8983 from Snuffleupagus/rm-unused
Remove unused helper code
2017-10-02 21:57:21 +02:00
Yury Delendik
75a13eeb38 Version 1.10 2017-10-02 07:58:57 -05:00
Jonas Jenwald
5b67c7594c Remove the unused Util.sign function from src/shared/util.js
This has been completely unused since commit 10bb6c9ec0, in PR 2505, more than four and a half years ago.
2017-10-01 15:58:03 +02:00
Jonas Jenwald
65352c730f Remove the unused isWorker property from src/display/global.js
This has been completely unused since commit 1d12aed5ca, in PR 7126, almost one and a half years ago.
2017-10-01 15:49:55 +02:00
Tim van der Meij
50b1a91c02 Merge pull request #8981 from timvandermeij/translations
Update translations
2017-10-01 14:45:23 +02:00
Tim van der Meij
9a1f8b864e
Update translations 2017-10-01 14:42:00 +02:00
Tim van der Meij
9742e58275 Merge pull request #8977 from timvandermeij/updates
Update all packages to the most recent version
2017-10-01 14:36:15 +02:00
Jonas Jenwald
f9ce904fb7 Merge pull request #8979 from timvandermeij/downloads
Transform Web Archive URLs to avoid downloading an HTML page instead of the PDF file
2017-09-30 22:47:23 +02:00
Tim van der Meij
f73c9b75d9
Transform Web Archive URLs to avoid downloading an HTML page instead of the PDF file
Moreover, adjust one linked test case that did not conform to the
standard Web Archive URL format and adjust one linked test case because
the link was dead.
2017-09-30 19:50:31 +02:00
Tim van der Meij
0733b54e10
Update all packages to the most recent version
To support this, the following changes have to be made as well:

- Ignore `package-lock.json` since NPM creates it, but we should not
  have it in the repository.
- Switch from `babel-preset-es2015` to `babel-preset-env` to resolve
  the deprecation warning in the test logs. The latter is more recent
  and flexible, but should be the same functionality-wise.
- `transform` now needs to have the `utf-8` encoding option provided.
  If not given, it will call the callback with a `Buffer` object,
  which results in an unhandled promise rejection since what is
  returned from the callback is a string, not a `Buffer`.
2017-09-30 16:26:24 +02:00
Brendan Dahl
d03e127434 Merge pull request #8971 from yurydelendik/close-handler
Closes all promises/streams when handler is destroyed.
2017-09-29 14:28:53 -07:00
Tim van der Meij
3717757b39 Merge pull request #8976 from Snuffleupagus/webpack-simpler-node-polyfills-disable
Simplify the disabling of Node polyfills, in `gulpfile.js`, since we're now using Webpack 3.x
2017-09-29 22:10:57 +02:00
Jonas Jenwald
1a3c6f7d9a Simplify the disabling of Node polyfills, in gulpfile.js, since we're now using Webpack 3.x
Webpack was updated a while back, but we apparently forgot to update `gulpfile.js` as well.
2017-09-29 21:45:14 +02:00