Commit Graph

9220 Commits

Author SHA1 Message Date
Tim van der Meij
043cea251d Merge pull request #7819 from Snuffleupagus/issue-7804
For commands with with too few arguments, clear out `args` if it's an Array instead of replacing it with `null` in `EvaluatorPreprocessor_read` (issue 7804)
2016-11-18 19:04:30 +01:00
Jonas Jenwald
7f678e3af1 Update l10n files 2016-11-17 12:03:31 +01:00
Jonas Jenwald
a930f9af15 For commands with with too few arguments, clear out args if it's an Array instead of replacing it with null in EvaluatorPreprocessor_read (issue 7804)
For `PartialEvaluator_getTextContent`, the same `args` Array should be re-used for every `EvaluatorPreprocessor_read` call. Hence we want to ensure that it's not accidentally replaced with `null` in `EvaluatorPreprocessor_read`, since otherwise corrupt PDF files (with too few arguments for certain commands) will cause errors in `PartialEvaluator_getTextContent`.

Perhaps a micro-optimization, but this patch also changes two `!args` comparisons to `args === null`, since that should be a tiny bit more efficient.
2016-11-16 10:20:29 +01:00
Jonas Jenwald
7f6a607ea5 Merge pull request #7803 from mukulmishra18/master
Fix #7701: additional check for http/https protocols to fix unsafe he…
2016-11-14 13:04:25 +01:00
Mukul Mishra
6ce2be98b7 Fix #7701: additional check for http/https protocols to fix unsafe header request.
add missing ! and removed trailing whitespaces.
2016-11-14 11:39:10 +05:30
Jonas Jenwald
7ec8adc712 Merge pull request #7801 from Snuffleupagus/preprocessor2-remove-comment-except-copyright
Enable removing of all comments (except for Copyright notices) when preprocessing code, and reduce the indentation level
2016-11-11 22:22:30 +01:00
Jonas Jenwald
4f1cccb138 Enable removing of all comments (except for Copyright notices) when preprocessing code, and reduce the indentation level 2016-11-11 22:05:17 +01:00
Jonas Jenwald
a139c75774 Merge pull request #7800 from Snuffleupagus/compatibility-Safari-regex
Replace the Safari detection in `checkRangeRequests` in compatibility.js with a regular expression
2016-11-11 17:57:29 +01:00
Jonas Jenwald
db2ce3ff64 Replace the Safari detection in checkRangeRequests in compatibility.js with a regular expression
According to e.g. issue 7754, it appears that the current `isSafari` check is failing in newer version of the browser. Despite the fact that checking the userAgent is an anti-pattern, which should be avoided, it's currently the simplest solution.
2016-11-11 17:15:24 +01:00
Jonas Jenwald
c23f124051 Merge pull request #7794 from Snuffleupagus/JavaScript-white-listed-actions
[api-minor] Add support for a couple of white-listed `JavaScript` actions that contains valid URLs (issue 3897, bug 843699)
2016-11-09 10:29:05 +01:00
Tim van der Meij
2f5170f28f Merge pull request #7792 from Snuffleupagus/bug-1315608
Make the `customScaleOption` disabled to prevent it being keyboard accessible (bug 1315608)
2016-11-08 21:55:51 +01:00
Jonas Jenwald
6d8a404a9c [api-minor] Add support for a couple of white-listed JavaScript actions that contains valid URLs (issue 3897, bug 843699)
By only allowing very specific type of `JavaScript` actions, and also utilizing the existing `URL` validation, this patch shouldn't pose too much risk.

Fixes one of the points in issue 3897 (with the PDF file taken from issue 3438).
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=843699 (probably, since that bug doesn't contain a test-case).
2016-11-08 16:48:27 +01:00
Jonas Jenwald
a97bc16fbc Make the customScaleOption disabled to prevent it being keyboard accessible (bug 1315608)
Given that the `customScaleOption` should already be hidden, provided that the browser supports that, this patch also prevents it from being accessible via the keyboard.
As far as my testing goes in various browsers, this doesn't seem to have any ill effects, and note that we're already explicitly ignoring the `custom` value in the `select` event handler.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1315608.
2016-11-08 12:04:55 +01:00
Jonas Jenwald
340c6638c5 Merge pull request #7781 from timvandermeij/viewer-responsiveness
Viewer: improve responsiveness and clean up CSS
2016-11-07 17:38:23 +01:00
Tim van der Meij
f95915fc73 Viewer: amend .sidebarOpen responsiveness rules with rules for
`.sidebarMoving`
2016-11-07 16:23:50 +01:00
Tim van der Meij
b428463ecc Merge pull request #7786 from SuriyaaKudoIsc/patch-3
Add HTTPS support for Demo
2016-11-05 15:45:08 +01:00
Suriyaa Kudo
1446e0e64f Add HTTPS support 2016-11-04 15:55:56 +01:00
Jonas Jenwald
b4100ba651 Merge pull request #7698 from Snuffleupagus/bug-1308536
Ignore reserved commands when parsing operands in `CFFParser_parseDict`, instead of just rejecting the entire font (bug 1308536)
2016-11-03 23:53:14 +01:00
Tim van der Meij
28ef012727 Viewer: improve responsiveness and clean up CSS
This patch resolves the responsiveness issues for the toolbar in the
viewer. Depending on the language (for example the Dutch language),
elements could overlap when the viewport size is reduced.

The main issue here is that the CSS rules are unnecessarily complex and
handle lots of different cases (LTR/RTL, displacements for specific
viewport widths, et cetera). By removing this complexity and letting the
browser handle the responsiveness, we not only get simpler CSS rules and
HTML mark-up, but the responsiveness issues are mostly fixed at the same
time. We no longer have to position the elements manually (by setting
their `left` attribute value) anymore.
2016-11-03 22:56:46 +01:00
Tim van der Meij
1d82521b4c Merge pull request #7782 from Snuffleupagus/page-labels-more-validation
Use `stringToPDFString` to sanitizing bad "Prefix" entries in Page Label dictionaries, and add more validation
2016-11-03 22:16:39 +01:00
Tim van der Meij
fe3c12bd16 Merge pull request #7778 from srslafazan/defensive-check-for-mousewheel-handler
Additional check to ensure pdfViewer object is defined before handleMouseWheel event accesses its property isInPresentationMode
2016-11-03 22:03:44 +01:00
Shain Lafazan
7fec8de502 Additional check to ensure pdfViewer object is defined before handleMouseWheel event accesses its property isInPresentationMode 2016-11-03 12:25:16 -07:00
Jonas Jenwald
0844a72b4d Add a bit more validation to Catalog_readPageLabels, to ensure that the Page Labels are well formed 2016-11-03 20:08:06 +01:00
Jonas Jenwald
2d8d8b5e53 Use stringToPDFString to sanitizing bad "Prefix" entries in Page Label dictionaries
It seems that certain bad PDF generators can create badly encoded "Prefix" entries for Page Labels, one example being http://ukjewishfilm.org/wp-content/uploads/2015/09/Jewish-Film-Festival-Programme-ONLINE.pdf.

Unfortunately I didn't come across such a PDF file while adding the API support for Page Labels, but with them now being used in the viewer I just found this issue. With this patch, we now display the Page Labels in the same way as Adobe Reader.
2016-11-03 19:48:08 +01:00
Jonas Jenwald
9dc6463933 Ignore reserved commands when parsing operands in CFFParser_parseDict, instead of just rejecting the entire font (bug 1308536)
According to the CFF specification, see http://partners.adobe.com/public/developer/en/font/5176.CFF.pdf#page=11, certain commands are currently reserved.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1308536.
2016-11-03 12:50:40 +01:00
Tim van der Meij
9f8d67475e Merge pull request #7775 from timvandermeij/widget-annotation-name
Widget annotation: implement field name according to the specification
2016-11-02 22:43:17 +01:00
Tim van der Meij
1d96854019 Widget annotation: implement field name according to the specification
The original code is difficult to read and, more importantly, performs
actions that are not described in the specification. It replaces empty
names with a backtick and an index, but this behavior is not described
in the specification. While the specification is not entirely clear
about what should happen in this case, it does specify that the `T`
field is optional and that multiple field dictionaries may have the same
fully qualified name, so to achieve this it makes the most sense to
ignore missing `T` fields during construction of the field name. This is
the most specification-compliant solution and, judging by opened issue #6623, also the required and expected behavior.
2016-11-02 21:44:44 +01:00
Tim van der Meij
6e22b32372 Merge pull request #7745 from Snuffleupagus/Launch-actions
[api-minor] Add basic support for `Launch` actions (issue 1778, issue 3897, issue 6616)
2016-11-01 21:12:08 +01:00
Jonas Jenwald
9295114bdd Merge pull request #7774 from timvandermeij/lint
Improve lint coverage and correct code style violations
2016-11-01 16:53:51 +01:00
Tim van der Meij
5194e68134 Lint: correct code style violations
Manual observations and working with other linting tools found these.
2016-11-01 15:04:21 +01:00
Tim van der Meij
978b214c92 Lint: do not ignore external/importL10n as it is one of our components 2016-11-01 14:43:38 +01:00
Tim van der Meij
c719762099 Lint: update .jshintignore
Remove folders that no longer exist and ignore folders with binary/PDF
files.
2016-11-01 14:39:35 +01:00
Tim van der Meij
29fc2f9908 Merge pull request #7773 from Snuffleupagus/update-swedish-l10n
[l10n] Add Swedish translations for a couple of new/changed localization IDs
2016-11-01 13:32:41 +01:00
Jonas Jenwald
40d2d3f569 [l10n] Add Swedish translations for a couple of new/changed localization IDs
I got tired of staring at a bunch of localization warnings every time that I open the console, hence this patch adds the missing translations to the Swedish locale.
2016-11-01 10:09:47 +01:00
Tim van der Meij
c8158dc672 Merge pull request #7771 from timvandermeij/l10n-updates
Localization updates
2016-10-31 23:44:55 +01:00
Tim van der Meij
775b294bb9 L10n: import upstream translations 2016-10-31 23:35:05 +01:00
Tim van der Meij
f8e29ad80f L10n: update the Dutch translation after recent string changes 2016-10-31 23:31:14 +01:00
Jonas Jenwald
077e644437 Fix a typo in the page_of_pages l10n ID for the en-US locale 2016-10-31 23:14:22 +01:00
Tim van der Meij
e9c63a2b32 Merge pull request #6945 from Snuffleupagus/page-labels-viewer
Add support for PageLabels in the viewer (issue 6902, bug 793632)
2016-10-31 22:59:56 +01:00
Yury Delendik
a740d69457 Merge pull request #7766 from Rob--W/printing-refactor-split-from-7721
Printing refactor split from 7721
2016-10-31 08:51:49 -05: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
Tim van der Meij
1c3fb175dd Merge pull request #7757 from Snuffleupagus/setHash-remove-pageNumber-directly-after-hash
Remove/deprecate specifying a pageNumber directly after the hash symbol (#), to improve compatibility since other PDF viewers don't support this form (issue 7746)
2016-10-27 23:56:23 +02:00
Jonas Jenwald
87c2ff5483 Remove/deprecate specifying a pageNumber directly after the hash symbol (#), to improve compatibility since other PDF viewers don't support this form (issue 7746)
There's no mention of our `#{pagenum}` form in http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf, and Adobe Reader doesn't seem to support it either.
Hence this patch removes support for it in the extensions, but keeps it in the `GENERIC` build with a deprecation warning and a fallback to handle it as a destination.

Fixes 7746.
2016-10-27 23:25:53 +02:00
Yury Delendik
ab464df336 Import L10n files. 2016-10-27 16:16:27 -05:00
Tim van der Meij
abc417cee9 Merge pull request #7750 from Snuffleupagus/PDFLinkService_navigateTo-more-validation
Add more validation to `PDFLinkService_navigateTo`
2016-10-27 22:16:35 +02:00
Tim van der Meij
a28a71072d Merge pull request #7756 from timvandermeij/npm
Travis CI: use most recent version of NPM
2016-10-27 21:19:03 +02:00
Tim van der Meij
7c78b2f6c0 Travis CI: use most recent version of NPM 2016-10-27 21:10:19 +02:00