Commit Graph

9762 Commits

Author SHA1 Message Date
Tim van der Meij
63597cc556 Merge pull request #8258 from Snuffleupagus/api-unit-tests-travis
Enable running a subset of the API unit-tests on Travis
2017-05-13 23:56:59 +02:00
Jonas Jenwald
bbe8c3d8ed Enable running a subset of the API unit-tests on Travis
Notably, this patch skips all canvas rendering tests in Node.js.
2017-05-12 11:48:27 +02:00
Jonas Jenwald
028d3421ac Merge pull request #8398 from Snuffleupagus/es6-dom-utils-factories
Convert the `DOMCMapReaderFactory` and `DOMCanvasFactory` to ES6 classes
2017-05-11 23:10:44 +02:00
Jonas Jenwald
c5f73edcd2 Convert the DOMCanvasFactory to an ES6 class
For consistency, also updates the `pdf2png.js` example to use the slightly less verbose `canvasAndContext` parameter name.
2017-05-11 20:15:22 +02:00
Jonas Jenwald
32baa6af7a Convert the DOMCMapReaderFactory to an ES6 class
Given that we only create *one* instance of this class per `getDocument` call, this shouldn't matter performance wise.
2017-05-11 20:15:19 +02:00
Yury Delendik
15425d5b9b Merge pull request #8400 from Snuffleupagus/ref-tests-wait-on-destroy
Wait for previous pdfDocument(s) to be destroyed before running the next reference test
2017-05-11 11:59:20 -05:00
Yury Delendik
372fec61c7 Merge pull request #8399 from Snuffleupagus/unit-tests-wait-on-destroy
Wait until `PDFDocumentLoadingTask.destroy` is resolved before calling `done` in the API unit-tests
2017-05-11 11:55:21 -05:00
Jonas Jenwald
b5775af716 Wait for previous pdfDocument(s) to be destroyed before running the next reference test
Refactors `Driver._cleanup` to return a `Promise` which is resolved once all opened documents have been destroyed.
This is then used in `Driver._nextTask` to ensure that we wait for everything to be cleaned up, such that the tests run sequentially.
2017-05-11 12:56:45 +02:00
Jonas Jenwald
7a040c05d7 Wait until PDFDocumentLoadingTask.destroy is resolved before calling done in the API unit-tests
Try to ensure that everything, including workers, are properly destroyed before running the next test-case.
2017-05-11 12:17:54 +02:00
Jonas Jenwald
52998c5fe1 Merge pull request #8397 from Snuffleupagus/extractText-refactor
Simplify `extractText`, and replace unnecessary `var self = this` statements with arrow functions, in `web/pdf_find_controller.js`
2017-05-10 17:05:37 +02:00
Jonas Jenwald
9efd11c5c9 Replace unnecessary var self = this statements with arrow functions in web/pdf_find_controller.js 2017-05-10 14:09:20 +02:00
Jonas Jenwald
c750514903 Simplify extractText in web/pdf_find_controller.js
Currently this method first uses a loop to build a temporary array to hold Promises, which are then resolved from a recursive helper function once the textContent is fetched for each page.

To me, this is unncessarily complicated, since we can do everything within one loop by simply chaining the asynchronous calls to retrieve the textContent. (Note that this guarantees that the textContent of the pages is still fetched sequentially.)
2017-05-10 14:09:15 +02:00
Yury Delendik
9bfbf27f94 Merge pull request #8350 from ydfzgyj/fix-svg-image
Fix svg image render
2017-05-09 10:53:34 -05:00
Yury Delendik
595ee1232d Merge pull request #8391 from timvandermeij/es6-web
Convert the hand tool, interfaces and secondary toolbar to ES6 syntax
2017-05-09 07:53:27 -05:00
Yury Delendik
3923c4a6fa Merge pull request #8393 from Snuffleupagus/web-app-rm-self
Replace unnecessary `var self = this` statements with arrow functions in `web/app.js`
2017-05-09 07:48:29 -05:00
Jonas Jenwald
240a3926f4 Replace unnecessary var self = this statements with arrow functions in web/app.js
Also replaces `var` with `let` in the functions/methods that are touched in the patch. Please note that this should be completely safe, for two separate reasons, since trying to access `let` in a scope where it's not defined is first of all a runtime error and second of all an ESLint error (thanks to the `no-undef` rule).
2017-05-09 13:46:54 +02:00
巴里切罗
8d5d97264e fix(svg) adjust strategy for decoding JPEG images 2017-05-08 11:32:44 +08:00
Tim van der Meij
0dbc68a6d6 Merge pull request #8390 from Snuffleupagus/bug-1319111
Upstream changes from: Bug 1319111 - Expose result principal URL ("final channel URL") on LoadInfo, convert current consumers of LOAD_REPLACE
2017-05-07 22:07:20 +02:00
Tim van der Meij
8d9596480c
Convert the interfaces to ES6 syntax 2017-05-07 22:01:49 +02:00
Tim van der Meij
67049602c5
Convert the secondary toolbar to ES6 syntax 2017-05-07 21:43:50 +02:00
Honza Bambas :mayhemer
20aa8d74e9 Upstream changes from: Bug 1319111 - Expose result principal URL ("final channel URL") on LoadInfo, convert current consumers of LOAD_REPLACE
This is a downstream change introduced in [1]. That mozilla bug is adding a new property to channel's loadinfo object (nsILoadInfo) that protocol handlers has to set on channels when originalURI on the result channel is set to a different URI than the channel has been created for.

Existence of the new property on nsILoadInfo depends on landing [1].

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1319111
2017-05-07 21:38:10 +02:00
Tim van der Meij
bc49524ac7
Convert the hand tool to ES6 syntax 2017-05-07 21:30:07 +02:00
Yury Delendik
7015c88ce9 Merge pull request #8387 from evadne/issue-8386-webkit-subtle-crypto
amends Babel cache (#8364) implementation to also work on Safari
2017-05-07 13:13:20 -05:00
Evadne Wu
50af2284aa
amends Babel cache (#8364) implementation to disable caching on Safari
- the viewer was not loading in development mode on Safari, due to Safari
  having crypto.webkitSubtle instead of crypto.subtle.

- the isCachingPossible check was amended to check for crypro.subtle
  which is currently not in Safari but in Firefox and Chrome. This
  essentially works around the issue by disabling caching for Safari
  in development mode.

- maintainer sentiment: people who develop on Safari can get this speedup
  once Safari drops prefix for SubtleCrypto.

- note: at time of writing Safari Version 10.1 (12603.1.30.0.34) has an
  issue where caching can be enabled for PDF.js but must to be disabled for
  worker, otherwise the two sides do not communicate.

- https://github.com/mozilla/pdf.js/pull/8387#issuecomment-299709961
- https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
2017-05-07 18:00:30 +01:00
Tim van der Meij
b3e4361d7b Merge pull request #8381 from Snuffleupagus/document-properties-reset
Re-factor `PDFDocumentProperties` such that it's properly reset when a new PDF file is opened (issue 8371)
2017-05-07 17:43:23 +02:00
Jonas Jenwald
7780fd5b98 Re-factor PDFDocumentProperties such that it's properly reset when a new PDF file is opened (issue 8371)
This patch contains the following improvements:
 - Only fetch the various document properties *once* per PDF file opened, and cache the result (in a frozen object).
 - Always update the *entire* dialog at once, to prevent inconsistent UI state (issue 8371).
 - Ensure that the dialog, and all its internal properties, are reset when `PDFViewerApplication.close` is called.
 - Inline, and re-factor, the `getProperties` method in `open`, since that's the only call-site.
 - Always overwrite the fileSize with the value obtained from `pdfDocument.getDownloadInfo`, to ensure that it's correct.
 - ES6-ify the code that's touched in this patch.

Fixes 8371.
2017-05-07 10:16:03 +02:00
Jonas Jenwald
50d026fbda Merge pull request #8385 from tobytailor/master
Fix typo in LoopbackPort export
2017-05-06 10:35:49 +02:00
Tobias Schneider
e1a3e46cba Fix typo 2017-05-05 19:10:00 -07:00
Yury Delendik
deae2d8cb8 Merge pull request #8368 from yurydelendik/sourcemap
Enables source maps for webpack generated files.
2017-05-05 09:32:27 -05:00
Yury Delendik
996805f953 Produces source maps for built files. 2017-05-05 08:15:21 -05:00
Yury Delendik
c3cfcbe72f Merge pull request #8340 from ydfzgyj/fix-svg-spacing
Fix char spacing bug in SVG mode
2017-05-05 07:41:25 -05:00
巴里切罗
d58040aa29 fix(svg) char spacing bug 2017-05-05 12:11:20 +08:00
Yury Delendik
206ad8d8b2 Merge pull request #8378 from Snuffleupagus/es6-modules-src-shared
Convert the files in the `/src/shared` folder to ES6 modules
2017-05-04 14:35:09 -05:00
Jonas Jenwald
60b14f526e Convert the files in the /src/shared folder to ES6 modules 2017-05-04 21:07:59 +02:00
Yury Delendik
b0a796ced3 Merge pull request #8377 from Snuffleupagus/web-rm-bind
Replace unnecessary `bind(this)` statements with arrow functions in `web/` files
2017-05-04 12:08:05 -05:00
Jonas Jenwald
f27b5013e2 Replace unnecessary bind(this) statements with arrow functions in web/ files
By using `let`, which is block-scoped, instead of `var` in a couple of places we're able to get rid of additional `bind` calls.
2017-05-04 17:13:09 +02:00
Yury Delendik
c9d3c20e2c Fix esprima tests. 2017-05-04 08:24:44 -05:00
Yury Delendik
3adda80f97 Merge pull request #8358 from Snuffleupagus/PartialEvaluator-method-signatures
Change the signatures of the `PartialEvaluator` "constructor" and its `getOperatorList`/`getTextContent` methods to take parameter objects
2017-05-04 08:10:30 -05:00
Yury Delendik
e81c067de2 Merge pull request #8370 from Snuffleupagus/src-rm-bind
Replace unnecessary `bind(this)` and `var self = this` statements with arrow functions in remaining `src/` files
2017-05-03 18:00:34 -05:00
Jonas Jenwald
6c81b8e6dd Replace unnecessary bind(this) and var self = this statements with arrow functions in remaining src/ files 2017-05-03 23:12:35 +02:00
Yury Delendik
e42fc546a0 Merge pull request #8369 from mozilla/brendandahl-patch-1
Add no-default-browser-check to chrome runner.
2017-05-03 13:44:19 -05:00
Brendan Dahl
b06022895e Add no-default-browser-check to chrome runner. 2017-05-03 11:22:08 -07:00
Yury Delendik
74ba3033e8 Merge pull request #8359 from Snuffleupagus/Lexer-getNumber-ignore-line-breaks
Ignore line-breaks between operator and digit in `Lexer.getNumber`
2017-05-03 09:43:59 -05:00
Yury Delendik
2ac410625b Fixes shell parameters quoting after #8349 2017-05-03 08:17:31 -05:00
Jonas Jenwald
b4787f0d38 Merge pull request #8364 from yurydelendik/babel-cache
Adds babel caching for system.js.
2017-05-03 13:05:39 +02:00
Jonas Jenwald
3e20d30afc Change the signatures of the PartialEvaluator "constructor" and its getOperatorList/getTextContent methods to take parameter objects
Currently these methods accept a large number of parameters, which creates quite unwieldy call-sites. When invoking them, you have to remember not only what arguments to supply, but also the correct order, to avoid runtime errors.
Furthermore, since some of the parameters are optional, you also have to remember to pass e.g. `null` or `undefined` for those ones.
Also, adding new parameters to these methods (which happens occasionally), often becomes unnecessarily tedious (based on personal experience).

Please note that I do *not* think that we need/should convert *every* single method in `evaluator.js` (or elsewhere in `/core` files) to take parameter objects. However, in my opinion, once a method starts relying on approximately five parameter (or even more), passing them in individually becomes quite cumbersome.

With these changes, I obviously needed to update the `evaluator_spec.js` unit-tests. The main change there, except the new method signatures[1], is that it's now re-using *one* `PartialEvalutor` instance, since I couldn't see any compelling reason for creating a new one in every single test.

*Note:* If this patch is accepted, my intention is to (time permitting) see if it makes sense to convert additional methods in `evaluator.js` (and other `/core` files) in a similar fashion, but I figured that it'd be a good idea to limit the initial scope somewhat.

---

[1] A fun fact here, note how the `PartialEvaluator` signature used in `evaluator_spec.js` wasn't even correct in the current `master`.
2017-05-03 12:10:20 +02:00
Yury Delendik
bbb2cc000e Adds babel caching for system.js. 2017-05-02 19:28:03 -05:00
Yury Delendik
84f174bb2f Merge pull request #8363 from yurydelendik/worker-fromport
Adds initializeFromPort to the WorkerMessageHandler.
2017-05-02 19:22:20 -05:00
Yury Delendik
008aa56ac6 Adds initializeFromPort to the WorkerMessageHandler. 2017-05-02 16:11:54 -05:00
Jonas Jenwald
40feca12c1 Ignore line-breaks between operator and digit in Lexer.getNumber
This is consistent with the behaviour in Adobe Reader (and PDFium), and it fixes the display of page 30 in https://bug1354114.bmoattachments.org/attachment.cgi?id=8855457 (taken from https://bugzilla.mozilla.org/show_bug.cgi?id=1354114).

The patch also makes the `error` message for invalid numbers slightly more useful, by including the charCode as well. (Having that information available would have reduced the time spent on debugging the PDF file above.)
2017-05-02 20:59:42 +02:00