Commit Graph

9857 Commits

Author SHA1 Message Date
Yury Delendik
b529df4547 Merge pull request #8281 from yurydelendik/v1.8.188
v1.8.188
2017-04-13 10:48:20 -05:00
Yury Delendik
b939827b4b v1.8.188 2017-04-13 10:46:19 -05:00
Yury Delendik
ad1023ff55 Merge pull request #8262 from tcorral/master
Fix worker resolution on using minified version
2017-04-13 10:41:36 -05:00
Tim van der Meij
32e01cda96 Merge pull request #8228 from timvandermeij/line-annotations
Implement support for line annotations
2017-04-13 00:18:31 +02:00
Tim van der Meij
e15a2ec523
Annotations: implement support for line annotations
This patch implements support for line annotations. Other viewers only
show the popup annotation when hovering over the line, which may have
any orientation. To make this possible, we render an invisible line (SVG
element) over the line on the canvas that acts as the trigger for the
popup annotation. This invisible line has the same starting coordinates,
ending coordinates and width of the line on the canvas.
2017-04-12 23:05:25 +02:00
Jonas Jenwald
2274465588 Merge pull request #8275 from Snuffleupagus/telemetry-stub
Rename PdfJsTelemetry-addon.jsm to PdfJsTelemetry-stub.jsm
2017-04-12 13:32:33 +02:00
Georg Fritzsche
4e8cd2b7d3 Rename PdfJsTelemetry-addon.jsm to PdfJsTelemetry-stub.jsm
And remove unused linting comments.
2017-04-12 13:11:04 +02:00
Yury Delendik
7052316f58 Merge pull request #8273 from Snuffleupagus/issue-8272
Correctly detect if `requestAnimationFrame` is supported in `compatibility.js` (issue 8272)
2017-04-11 10:14:39 -05:00
Jonas Jenwald
3a302fdb53 Correctly detect if requestAnimationFrame is supported in compatibility.js (issue 8272)
This is a regression from PR 8222.

Fixes 8272.
2017-04-11 17:01:35 +02:00
Jonas Jenwald
fbe7b2eee7 Always ignore Type3 glyphs if their OperatorLists contain errors, regardless of the value of the stopAtErrors option
Compared to the parsing of e.g. an entire page, it doesn't really make sense to only be able to render a Type3 glyph partially.
2017-04-11 08:59:22 +02:00
Jonas Jenwald
a39d636eb8 [api-minor] Always allow e.g. rendering to continue even if there are errors, and add a stopAtErrors parameter to getDocument to opt-out of this behaviour (issue 6342, issue 3795, bug 1130815)
Other PDF readers, e.g. Adobe Reader and PDFium (in Chrome), will attempt to render as much of a page as possible even if there are errors present.
Currently we just bail as soon the first error is hit, which means that we'll usually not render anything in these cases and just display a blank page instead.

NOTE: This patch changes the default behaviour of the PDF.js API to always attempt to recover as much data as possible, even when encountering errors during e.g. `getOperatorList`/`getTextContent`, which thus improve our handling of corrupt PDF files and allow the default viewer to handle errors slightly more gracefully.
In the event that an API consumer wishes to use the old behaviour, where we stop parsing as soon as an error is encountered, the `stopAtErrors` parameter can be set at `getDocument`.

Fixes, inasmuch it's possible since the PDF files are corrupt, e.g. issue 6342, issue 3795, and [bug 1130815](https://bugzilla.mozilla.org/show_bug.cgi?id=1130815) (and probably others too).
2017-04-11 08:59:22 +02:00
Jonas Jenwald
10e5f766a2 Merge pull request #8266 from brendandahl/issue6652
Normalize blend mode names.
2017-04-11 08:54:42 +02:00
Brendan Dahl
4969b2ad97 Normalize blend mode names. 2017-04-10 16:18:08 -07:00
TCASAS
010d38a8c0 Fix worker resolution on using minified version
- When the minified version is used the resolver of the worker can not find it properly and throws 404 error.
- The problem was that:
  - It was getting the current name of the file.
  - It was replacing **.js** by **.worker.js**
- When it was loading the unminified version it was working fine because:
  - *pdf.js - .js + .worker.js*  = **pdf.worker.js**
- When it was loading the minified version it didtn't work because:
  - *pdf.min.js - .js + .worker.js* = **pdf.min.worker.js**
  - **pdf.min.worker.js** doesn't exist the real file name is **pdf.worker.min.js**
2017-04-10 13:41:50 +02:00
Tim van der Meij
30d63b0c50
Annotations: move container border removal to the display layer
The display layer is responsible for creating the HTML elements for the
annotations from the core layer. If we need to ignore border styling for
the containers of certain elements, the display layer should do so and
not the core layer. I noticed this during the implementation of line
annotations, for which we actually need the original border width in the
display layer, even though we ignore it for the container. If we set the
border style to zero in the core layer, this becomes impossible.

To prevent this, this patch moves the container border removal code from
the core layer to the display layer. This makes the core layer output
the unchanged annotation data and lets the display layer remove any
border styling if necessary.
2017-04-09 19:01:38 +02:00
Jonas Jenwald
b2c3f8f081 Convert a number of import * as pdfjsLib from 'pdfjs-web/pdfjs'; cases to only specify the necessary imports
Rather than always importing everything from the `web/pdfjs.js`, similar to all other imports we can just choose what we actually need.
2017-04-09 11:55:48 +02:00
Jonas Jenwald
3b35c15d42 Convert the files in the /web folder to ES6 modules
Note that as discussed on IRC, this makes the viewer slightly slower to load *only* in `gulp server` mode, however the difference seem slight enough that I think it will be fine.
2017-04-09 11:55:48 +02:00
Jonas Jenwald
313060aff5 Refactor the DownloadManager initialization in GENERIC/CHROME builds, to avoid issues when converting the code to ES6 modules 2017-04-09 11:55:48 +02:00
Tim van der Meij
d6dfc26d4e Merge pull request #8257 from Snuffleupagus/eslint_prefer-promise-reject-errors
Enable the `prefer-promise-reject-errors` ESLint rule
2017-04-08 22:27:04 +02:00
Jonas Jenwald
f41d80bdd3 Enable the prefer-promise-reject-errors ESLint rule
See http://eslint.org/docs/rules/prefer-promise-reject-errors, note that this is similar to the already used  `no-throw-literal` rule.
2017-04-08 11:47:22 +02:00
Brendan Dahl
55a853b667 Merge pull request #8244 from Snuffleupagus/issue-8241
Actually skip pages included in the `skipPages` array when running tests, rather than creating empty 1x1 canvases (issue 8241)
2017-04-07 10:53:54 -07:00
Jonas Jenwald
c5199d0814 Update l10n files 2017-04-07 12:31:54 +02:00
Yury Delendik
8ff1fbe7f8 Merge pull request #8249 from yurydelendik/v1.8.170
Release 1.8.170
2017-04-06 13:44:11 -05:00
Yury Delendik
a0dee94d60 Release 1.8.170 2017-04-06 13:39:45 -05:00
Yury Delendik
3ca67550ef Merge pull request #8248 from yurydelendik/version-1.8
Version 1.8
2017-04-06 13:38:03 -05:00
Yury Delendik
a7f735dbfa Version 1.8 2017-04-06 13:36:33 -05:00
Jonas Jenwald
9d62ff80ca Actually skip pages included in the skipPages array when running tests, rather than creating empty 1x1 canvases (issue 8241)
Considering how extremely simple this patch turned out to be, I'm almost worried that I completely misunderstood why the current code looks like it does...
2017-04-06 13:17:52 +02:00
Jonas Jenwald
a662d26814 Merge pull request #8243 from brendandahl/no-skip-glyph0
Don’t skip glyph 0 in cmap.
2017-04-06 10:25:55 +02:00
Brendan Dahl
cdc79a4721 Don’t skip glyph 0 in cmap. 2017-04-05 15:17:38 -07:00
Yury Delendik
c380d25407 Merge pull request #8239 from georgf/master
Stub out Firefox addon Telemetry wrapper
2017-04-05 13:29:54 -05:00
Georg Fritzsche
788fe1f810 Stub out Firefox addon Telemetry wrapper
We are planning to remove the addon histogram APIs from Firefox
Telemetry.
The easy solution here is to just stub out all calls that use them.
2017-04-05 14:17:31 +07:00
Yury Delendik
f9c07fa695 Merge pull request #8235 from Snuffleupagus/issue-7901
Disable the `NativeImageDecoder` in the `node/pdf2svg.js` example (issue 7901)
2017-04-04 10:38:22 -05:00
Yury Delendik
b665b0319a Merge pull request #8222 from tjgrathwell/ios-fake-cancel-animation-frame
ios: Patch cancelAnimationFrame whenever fakeRequestAnimationFrame is used
2017-04-04 10:29:04 -05:00
Jonas Jenwald
d76cfc0610 Disable the NativeImageDecoder in the node/pdf2svg.js example (issue 7901)
It doesn't really make sense to attempt to utilize the `NativeImageDecoder` in Node, since there's no native image support available, hence building on PR 8035 we can easily disable it in the example.

Fixes 7901.
2017-04-04 17:24:29 +02:00
Yury Delendik
31f8875614 Merge pull request #8157 from Snuffleupagus/api-RenderTask-cancel-Error
[api-minor] Reject the `RenderTask` with an actual `Error`, instead of just a `string`, when rendering is cancelled
2017-04-04 09:38:47 -05:00
Yury Delendik
a2ddf2f9ca Merge pull request #8218 from amccreight/no-sync
Split pdfjschildbootstrap.js to avoid sync IPC
2017-04-03 17:37:22 -05:00
Yury Delendik
12c1679288 Merge pull request #8232 from amccreight/lazy-net-util
Lazily load NetUtil.jsm in PdfStreamConverter.jsm.
2017-04-03 17:27:30 -05:00
Andrew McCreight
071951d787 Lazily load NetUtil.jsm in PdfStreamConverter.jsm.
This is one step towards not loading NetUtil.jsm at startup in a clean
profile.
2017-04-03 10:33:57 -07:00
Travis Grathwell
bd70a73d43 ios: Patch cancelAnimationFrame whenever fakeRequestAnimationFrame is used
The existing implementation of fakeRequestAnimationFrame
did not return a timer ID, so the frame could not be cancelled
if you wanted to cancel it. But if you do want to cancel it,
it needs to be cancelled through clearTimeout instead of
cancelAnimationFrame, because the timer IDs are different.

Signed-off-by: Jonathan Barnes <jbarnes@pivotal.io>
2017-03-31 15:31:04 -07:00
Andrew McCreight
740e1ab450 Skip PdfJs.enabled check in bootstrap-enabled.
If we only invoke the bootstrap-enabled script when PdfJs.enabled is
true, then we don't need to check it again in the script.

This avoids a sync IPC call to the parent process.

It also keeps PdfJs.jsm from importing PdfjsContentUtils.jsm in the
child process until it is actually needed, which is one steps towards
not loading it until it is really needed.
2017-03-31 13:22:39 -07:00
Andrew McCreight
d804881151 Split bootstrap script.
pdfjschildbootstrap.js will always be run, but
pdfjschildbootstrap-enabled.js will only be run if PdfJs.enabled is
true. This will let us avoid some work in the child process in the
next patch.

This will need to be landed in the mozilla-central repository at the
same time as a change to nsBrowserGlue.js. See bug 1352218.
2017-03-31 13:22:39 -07:00
Tim van der Meij
57d9a64c14 Merge pull request #8210 from Snuffleupagus/issue-8209
Refactor removing of the `zoomLayer` into a helper method, and use that in `PDFPageView.reset` to ensure that the entire `zoomLayer` is actually removed (issue 8209)
2017-03-30 23:19:08 +02:00
Tim van der Meij
8cee63df5d Merge pull request #8205 from Snuffleupagus/built-in-CMap-errors
Improve the error handling when loading of built-in CMap files fail (PR 8064 follow-up)
2017-03-30 23:01:13 +02:00
Brendan Dahl
72eeb1ccb3 Merge pull request #8207 from Snuffleupagus/cache-getPageDict
Use a simple `RefSetCache` to significantly improve the performance of `Catalog.getPageDict` for certain long documents (PR 8105 follow-up)
2017-03-30 09:28:11 -07:00
Jonas Jenwald
437104969d Improve the error handling when loading of built-in CMap files fail (PR 8064 follow-up)
I happened to notice that the error handling wasn't that great, which I missed previously since there were no unit-tests for failure to load built-in CMap files.
Hence this patch, which improves the error handling *and* adds tests.
2017-03-29 22:38:29 +02:00
Jonas Jenwald
d98a6319ec Refactor removing of the zoomLayer into a helper method, and use that in PDFPageView.reset to ensure that the entire zoomLayer is actually removed (issue 8209) 2017-03-29 16:41:38 +02:00
Jonas Jenwald
61ee0de29f Use a simple RefSetCache to significantly improve the performance of Catalog.getPageDict for certain long documents (PR 8105 follow-up)
I found that PR 8105 unfortunately causes a *very serious* performance regression in long PDF documents where the `Pages` tree only has one level; my apologies for this!

Obviously we cannot revert that PR, since that would cause more issues than it solves. Hence it seems to me that the only viable solution here, is to add a simple `RefSetCache` to reduce the amount of redundant lookups.
Previously in PR 8105 caching was thought to be unnecessary, but as it turns out I don't think that we really have a choice in the matter any more.
2017-03-28 21:39:55 +02:00
Tim van der Meij
07f7c97b2b Merge pull request #8202 from Snuffleupagus/eslint-basic-es6-rules
Add a couple of basic ES6 rules to the ESLint config
2017-03-27 22:25:00 +02:00
Jonas Jenwald
892fd84eb8 Add a couple of basic ES6 rules to the ESLint config
See http://eslint.org/docs/rules/#ecmascript-6.

To try and enforce consistent rules and to help avoid some possible errors in ES6 code from the start, this patch adds a few basic ESLint rules.

Note that a two of the rules, `no-shadow` and `object-shorthand`, are currently disabled. While it'd certainly be nice to enable both of them, it's currently impossible since that would result in close to one thousand lint errors.
2017-03-27 20:03:20 +02:00
Jonas Jenwald
ede4d3c7c5 Merge pull request #8190 from Snuffleupagus/issue-8182
Try harder to find the next valid JPEG marker when decoding Scan data (issue 8182, issue 8189)
2017-03-27 17:20:41 +02:00