Commit Graph

65 Commits

Author SHA1 Message Date
Yury Delendik
8e681ce3e2 Change amd to cjs path in ES6 modules 2017-04-14 10:32:36 -05: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
Rob Wu
775441b7c6 Refactor: configurable page rotation in print job
Determine the page rotation at the same place as where the page size is
determined. This allows us to implement custom print page rotation logic
in one place, in the future.
2017-02-07 23:42:36 +01:00
Jonas Jenwald
52e0f51917 Enable the no-unused-vars ESLint rule
Please see http://eslint.org/docs/rules/no-unused-vars; note that this patch purposely uses the same rule options as in `mozilla-central`, such that it fixes part of issue 7957.

It wasn't, in my opinion, entirely straightforward to enable this rule compared to the already existing rules. In many cases a `var descriptiveName = ...` format was used (more or less) to document the code, and I choose to place the old variable name in a trailing comment to not lose that information.

I welcome feedback on these changes, since it wasn't always entirely easy to know what changes made the most sense in every situation.
2017-01-29 23:23:17 +01:00
Tim van der Meij
1948a53ebb Merge pull request #7973 from Snuffleupagus/eslint_spaced-comment
Enable the `spaced-comment` ESLint rule
2017-01-22 21:58:42 +01:00
Jonas Jenwald
82ea7e6e6e Enable the no-unsafe-finally/no-octal/no-useless-call ESLint rules
http://eslint.org/docs/rules/no-unsafe-finally, there's just one violation which in this case can actually be ignored since there's nothing `return`ed there.
http://eslint.org/docs/rules/no-octal, there're no violations in the code-base.
http://eslint.org/docs/rules/no-useless-call, there's just one violation that needs to be fixed.
2017-01-21 17:15:57 +01:00
Jonas Jenwald
4626fc8342 Enable the spaced-comment ESLint rule
Please see http://eslint.org/docs/rules/spaced-comment.

Note that the exceptions added for `line` comments are intended to still allow use of the old preprocessor without linting errors.
Also, I took the opportunity to improve the grammar slightly (w.r.t. capitalization and punctuation) for comments touched in the patch.
2017-01-19 16:41:59 +01:00
Jonas Jenwald
70c1a6b120 [Bug 1331081] omit addEventListener/removeEventListener's third parameter when it's false
Upstream changes from https://bugzilla.mozilla.org/show_bug.cgi?id=1331081; this patch also covers one file, `pdf_print_service.js`, that's not present in mozilla-central.

Fixes 7962.
2017-01-17 17:50:21 +01:00
Rob Wu
594592216c Refactor printing: startPrint -> performPrint
- Renamed startPrint to performPrint to emphasize that the method
  does not start the print process (preparing pages for the printer),
  but that it does the actual printing (sending pages off to the
  printer).

- Put performPrint in the PDFPrintService, so that it can be
  overridden if needed.
2016-10-30 12:03:24 +01:00
Rob Wu
d3b13e36d3 Refactor page printing logic on the web
- Move the global scratchCanvas to PDFPrintService. This is mainly to
  make it easier to reason about the state of scratchCanvas. In practice
  there is no difference because only one PDFPrintService instance can
  be instantiated at any given time.

- Move all logic of using the rendered page to one location.
  This makes it easier to replace the printing logic later, when I add
  special handling to out-of-process frames in the Chrome extension.
2016-10-30 12:03:24 +01:00
Rob Wu
0c21ebf9f3 Close overlay if print service was not initialized
Fixes #7720
2016-10-30 12:03:24 +01:00
Rob Wu
1c869906c8 Strictly manage lifetime of PDFPrintService
Make sure that the print service is stopped as soon as possible when
aborted, and that it is not possible for a (slow) promise to
accidentally wipe the state of a print job that was started later.
2016-10-30 12:03:24 +01:00
Yury Delendik
1a056caf88 Localization of the print dialog. 2016-10-11 10:08:13 -05:00
Yury Delendik
c09f634bb6 Removes mozPrintCallback polyfill, converts canvas to PNG. 2016-10-11 10:08:13 -05:00