Commit Graph

9819 Commits

Author SHA1 Message Date
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
Yury Delendik
aea3eccd0f Merge pull request #8361 from tobytailor/master
Export LoopbackPort
2017-05-02 13:51:57 -05:00
Tobias Schneider
a80c405941 Rename FakeWorkerPort to LoopbackPort and export it 2017-05-02 11:33:19 -07:00
Yury Delendik
de7002dc6c Merge pull request #8357 from Snuffleupagus/core-rm-bind
Replace unnecessary `bind(this)` and `var self = this` statements with arrow functions in remaining `src/core/` files
2017-05-02 10:11:02 -05:00
Jonas Jenwald
ebaa22478c Replace unnecessary bind(this) and var self = this statements with arrow functions in remaining src/core/ files 2017-05-02 15:47:43 +02:00
Tim van der Meij
0c99429291 Merge pull request #8349 from timvandermeij/remove-make
Migrate `make.js` to `gulpfile.js`
2017-05-02 01:12:56 +02:00
Tim van der Meij
f748407b26
Remove make.js and the target fetching in gulpfile.js
Note that we have to use `fs.writeFileSync` since `.to()` is not
available anymore. Moreover, introduce `safeSpawnSync` to make sure that
we check the return codes of the spawned processes properly.
2017-05-02 01:00:52 +02:00
Tim van der Meij
145c0cea39
Remove unused Gulp target for testing
To run the regression tests, developers use `gulp browsertest` and the
bot uses `gulp bottest`. We're not passing the `noreftest` option
anywhere in the code (probably because the `bottest` command takes care
of this already), so we should remove this.
2017-05-02 00:47:53 +02:00
Tim van der Meij
19cc9bcded
Port the mozcentraldiff target to Gulp 2017-05-02 00:47:51 +02:00
Tim van der Meij
74854fb4cc
Port the mozcentralbaseline target to Gulp
The baseline fix is dead code since three years, so we can safely remove
it.
2017-05-02 00:45:52 +02:00
Tim van der Meij
e18a08ffeb Merge pull request #8355 from Snuffleupagus/evaluator-rm-bind
Replace unnecessary `bind(this)` and `var self = this` statements with arrow functions in `src/core/evaluator.js`
2017-05-01 23:41:06 +02:00
Jonas Jenwald
95bbc8101c Replace unnecessary bind(this) and var self = this statements with arrow functions in src/core/evaluator.js
Note that by using `let` instead of `var` in `PartialEvaluator.setGState` and `TranslatedFont.loadType3Data`, we can get rid of further `bind` usages since `let` is block-scoped.
Also, the fact that `bind` wasn't used in the `Font` case inside of `setGState` is actually a bug which has been present ever since PR 5205, where a closure was replaced by a standard loop.[1]

---
[1] I'm not aware of any bugs caused by this, but that is probably more a happy accident than anything else, since e.g. just removing the `bind` from the `SMask` case without using block-scoped variables causes test failures.
2017-05-01 20:29:44 +02:00
Tim van der Meij
60c232bc8c Merge pull request #8353 from Snuffleupagus/eslint_object-shorthand
Enable the `object-shorthand` ESLint rule
2017-04-30 21:23:57 +02:00
Tim van der Meij
456b1566cb Merge pull request #8354 from Snuffleupagus/PdfStreamConverter-remove-bind
[Firefox addon] Replace a `bind(this)` statement with an arrow function in `PdfStreamConverter.jsm` (issue 8343)
2017-04-30 21:10:53 +02:00
Jonas Jenwald
8e976d7110 [Firefox addon] Replace a bind(this) statement with an arrow function in PdfStreamConverter.jsm (issue 8343)
Please note that I used the addon debugger to set a breakpoint in the `unload` function, in order to ensure that `this` still correctly refers to the `FindEventManager` scope.
2017-04-30 13:26:34 +02:00
Jonas Jenwald
7560f12a17 Enable the object-shorthand ESLint rule
Please see http://eslint.org/docs/rules/object-shorthand.

Unfortunately, based on commit 9276d1dcd9, it seems that we still need to maintain compatibility with old Node.js versions, hence certain files/directories that are executed in Node.js are currently exempt from this rule.

Furthermore, since the files specific to the Chromium extension are not run through Babel, the `/extensions/chromium/` directory is also exempt from this rule.
2017-04-30 11:13:34 +02:00
Jonas Jenwald
00d67371ec Merge pull request #8298 from timvandermeij/es6-modules-test
Convert the files in the `/test/unit` folder to ES6 modules
2017-04-30 10:34:48 +02:00
Tim van der Meij
35730148a7
Convert the files in the /test/unit folder to ES6 modules 2017-04-30 00:34:02 +02:00
Tim van der Meij
06c93d8fbd Merge pull request #8342 from Snuffleupagus/eslint_object-shorthand-src-core
Enable the `object-shorthand` ESLint rule in `src/core`
2017-04-29 23:59:20 +02:00
Tim van der Meij
5fb779d26f Merge pull request #8351 from Snuffleupagus/eslint_object-shorthand-web
Enable the `object-shorthand` ESLint rule in `web`
2017-04-29 23:49:33 +02:00
Jonas Jenwald
2a0207ccaf Enable the object-shorthand ESLint rule in web
Please see http://eslint.org/docs/rules/object-shorthand.

For the most part, these changes are of the search-and-replace kind, and the previously enabled `no-undef` rule should complement the tests in helping ensure that no stupid errors crept into to the patch.
2017-04-29 20:29:04 +02:00
Jonas Jenwald
165294a05f Merge pull request #8335 from Snuffleupagus/jbig2-decodeRefinement-subtract-offsets
Subtract the X/Y offsets when decoding refinement regions of JBIG2 images (issue 7145, 7308, 7401, 7850, 8270)
2017-04-28 23:13:07 +02:00
Jonas Jenwald
8defde508a Merge pull request #8352 from yurydelendik/rm-builderbuild
Removes builder.build().
2017-04-28 20:41:11 +02:00
Yury Delendik
140dd0f15b Removes builder.build(). 2017-04-28 12:47:20 -05:00
Yury Delendik
9276d1dcd9 Allow older versions on node.js to run gulpfile. 2017-04-28 09:20:21 -05:00
Yury Delendik
71bbcfad8a Merge pull request #8309 from vologab/feature/allow_query_string_for_pdfjs
Allow use versions for pdf.js script (i.e. - pdf.js?2412313)
2017-04-27 19:00:43 -05:00
Tim van der Meij
499c605b32 Merge pull request #8348 from Snuffleupagus/README.mozilla-commit
Add the commit hash to the `README.mozilla` file (issue 8347)
2017-04-27 23:24:41 +02:00
Jonas Jenwald
b3582ccbad Add the commit hash to the README.mozilla file (issue 8347) 2017-04-27 23:01:22 +02:00
Yury Delendik
7fd2084796 Merge pull request #8346 from Snuffleupagus/issue-8344
Restore the `URL.createObjectURL` check to the `createObjectURL` utility function (issue 8344)
2017-04-27 15:42:53 -05:00
Jonas Jenwald
ee09336f32 Restore the URL.createObjectURL check to the createObjectURL utility function (issue 8344)
This is a regression from commit 3888a993b1.

It turns out the even though we have a `URL` polyfill, it's still dependent on the existence of native `URL.{createObjectURL, revokeObjectURL}` functions.
Since no such thing exists in Node.js, our `createObjectURL` utility function breaks there.
2017-04-27 20:57:15 +02:00
Yury Delendik
acdfc2d860 Merge pull request #8345 from timvandermeij/bot-prefs
Bots: disable the default browser test and enable E10s
2017-04-27 13:51:44 -05:00
Tim van der Meij
ee86a81a50
Bots: disable the default browser test and enable E10s
The test runner is automated, so if the default browser test is
performed, the browser hangs waiting for user input it never gets.
Disable the test to fix that.

Moreover, enable E10s now that it is mature. This may help with the
performance of the test runner as well.
2017-04-27 20:39:57 +02:00
Yury Delendik
e3d0cd4913 Fixes stable version number 2017-04-27 12:07:42 -05:00
Jonas Jenwald
afc74b0178 Enable the object-shorthand ESLint rule in src/shared
Please see http://eslint.org/docs/rules/object-shorthand.

For the most part, these changes are of the search-and-replace kind, and the previously enabled `no-undef` rule should complement the tests in helping ensure that no stupid errors crept into to the patch.
2017-04-27 17:29:40 +02:00
Tim van der Meij
f91d01cad3 Merge pull request #8332 from Snuffleupagus/eslint_object-shorthand-src-shared-display
Enable the `object-shorthand` ESLint rule in `src/shared` and `src/display`
2017-04-27 16:43:37 +02:00
Tim van der Meij
32c0ea5909 Merge pull request #8324 from timvandermeij/es6-annotation-presentation-rendering
Convert the annotation layer builder, presentation mode and rendering queue to ES6 syntax
2017-04-27 16:30:07 +02:00
Tim van der Meij
24d44b2a34
Convert the rendering queue to ES6 syntax 2017-04-27 16:23:30 +02:00
Tim van der Meij
ccdc7ba3c8
Convert presentation mode to ES6 syntax 2017-04-27 16:23:29 +02:00
Tim van der Meij
3554a93c2b
Convert the annotation layer builder to ES6 syntax 2017-04-27 16:23:29 +02:00
Tim van der Meij
f4690a3c93 Merge pull request #8331 from Snuffleupagus/ui-utils-unit-tests-travis
Enable running the `ui_utils` unit-tests on Travis
2017-04-27 15:33:32 +02:00
Tim van der Meij
19af5952c0 Merge pull request #8339 from Snuffleupagus/es6-ViewHistory
Convert the `ViewHistory` to an ES6 class, and re-factor it to make it properly asynchronous
2017-04-27 15:24:01 +02:00
Jonas Jenwald
09edfb3dc0 Re-factor ViewHistory to make it properly asynchronous
Rather than having to manually use `initializedPromise`, which really ought to be a private property, to ensure that setting/getting values in the `ViewHistory` works as intended, this re-factoring simply changes all of its methods to be asynchronous.

Furthermore, a `getMultiple` method (mirroring the existing `setMultiple` one) is also added to `ViewHistory`.

Finally, this patch also addresses an existing issue, where certain preferences (e.g. the default zoom level) would be ignored when calling `setInitialView` if reading from the `ViewHistory` fails for some reason.
2017-04-27 11:49:35 +02:00
Jani Pehkonen
64deb6c700 Subtract the X/Y offsets when decoding refinement regions of JBIG2 images (issue 7145, 7308, 7401, 7850, 8270)
Please refer to the JBIG2 standard, see https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-T.88-200002-I!!PDF-E&type=items.
In particular, section "6.3.5.3 Fixed templates and adaptive templates" mentions that the offsets should be *subtracted*; where the offsets are defined according to "Table 6" under section "6.3.2 Input parameters".

Fixes 7145.
Fixes 7308.
Fixes 7401.
Fixes 7850.
Fixes 8270.
2017-04-26 16:06:15 +02:00
Jonas Jenwald
16b4132ebf Convert the ViewHistory to an ES6 class 2017-04-26 11:49:06 +02:00