Commit Graph

9297 Commits

Author SHA1 Message Date
Tim van der Meij
995be19378 Bidi: skip invalid Unicode character to make indexing work
For Arabic characters, the Unicode character codes are mapped to Unicode
character types using the character codes for indexing. However, the
character code 0x061D is undefined (and therefore invalid) in the
Unicode standard. The imported list does not contain this entry, but not
having it in the list breaks indexing for items after it. Therefore, put
an empty string on its position to make indexing work properly and issue
a warning in the unlikely event that we encounter this character.
2016-11-24 22:13:12 +01:00
Tim van der Meij
11839f018f Bidi: import Unicode types from the specification
Mention the specification in the comments for future reference. These
types have been imported from the CSV source.
2016-11-24 21:08:31 +01:00
Tim van der Meij
7c96da4373 Merge pull request #7845 from timvandermeij/dist-min
Make: include minified library files for the distribution target
2016-11-23 21:23:44 +01:00
Adhika Setya Pramudita
906b8ea907 Make: include minified library files for the distribution target
Fixes #5487.
2016-11-23 17:35:19 +01:00
Jonas Jenwald
ef7fd75a94 Merge pull request #7841 from timvandermeij/ios-range
Compatibility: disable range requests for iOS and refactor user agent detection
2016-11-22 22:53:36 +01:00
Tim van der Meij
cf3a7425b6 Compatibility: refactor user agent detection
This patch moves the user agent checks to the top of the file to reduce
duplication and to provide a clear overview of which user agent we are
detecting.

Moreover, we extract inline user agent checks as well and use existing
checks in more places. Finally, we fix the indenting in one place for
consistency.
2016-11-22 22:42:01 +01:00
Tim van der Meij
0b0e18f05c Compatibility: disable range request for iOS
Fixes #7815.
2016-11-22 22:19:20 +01:00
Tim van der Meij
9ff19985c0 Merge pull request #7832 from seanburke-wf/expose-userunit-on-page
Expose the optional UserUnit entry as a page property
2016-11-22 21:18:57 +01:00
Jonas Jenwald
3170a4c40a Improve rendering of non-embedded NuptialScript font
*This patch fixes something that I noticed while debugging https://bugzilla.mozilla.org/show_bug.cgi?id=1308536.*

The PDF file contains a font called "NuptialScript", which unfortunately is not embedded. Since that is a non-standard font we will not be able to render it entirely correct. However, by adding "NuptialScript" to the `getNonStdFontMap`, we can at least improve the rendering slightly by using an italic (serif) fallback font.
2016-11-22 17:56:17 +01:00
Jonas Jenwald
9d8fb02512 Merge pull request #7839 from Snuffleupagus/issue-7835
Correctly detect more cases of non-embedded Arial Black fonts (issue 7835)
2016-11-22 17:37:44 +01:00
Sean Burke
f76cd2ce43 Expose the optional UserUnit entry as a page property 2016-11-22 09:18:19 -07:00
Jonas Jenwald
d3043167de Correctly detect more cases of non-embedded Arial Black fonts (issue 7835)
This patch adds support for non-embedded Arial Black fonts, that use a `Arial-Black...` format for the font names.
Also, this patch changes `canvas.js` such that we always render Arial Black fonts with the maximum weight, which actually improves a number of existing test-cases. This should thus explain the test "failures", which are clear improvements compared with e.g. Adobe Reader.

Fixes 7835.
2016-11-22 13:56:21 +01:00
Tim van der Meij
787d887a2f Merge pull request #7793 from Snuffleupagus/ViewHistory-storage-key-name
Rename the `ViewHistory` localStorage (and sessionStorage) key from `database` to `pdfjs.history`, and migrate existing data on read (issue 7760)
2016-11-21 21:16:44 +01:00
Jonas Jenwald
0af42f1ca7 Rename the ViewHistory localStorage (and sessionStorage) key from database to pdfjs.history, and migrate existing data on read (issue 7760)
For consistency, I also renamed the `FIREFOX/MOZCENTRAL` sessionStorage key, but given that sessionStorage is a lot less permanent than localStorage it didn't seem necessary to migrate any existing values.

Fixes 7760.
2016-11-21 21:03:37 +01:00
Jonas Jenwald
8a1ed8ab1f Update l10n files 2016-11-21 17:23:22 +01:00
Tim van der Meij
99b5416ba0 Merge pull request #7830 from Snuffleupagus/paintOnSvg-unsupported
Return a mock object in `paintOnSvg` when SVG rendering is not supported, to prevent `TypeError`s in the addons
2016-11-21 17:09:20 +01:00
Jonas Jenwald
9872660a95 Return a mock object in paintOnSvg when SVG rendering is not supported, to prevent TypeErrors in the addons
Currently if you try to enable SVG rendering in the addons, a `TypeError` is thrown by the browser since we have code that depends on what `paintOnCanvas`/`paintOnSvg` (should) return.
2016-11-19 13:32:17 +01:00
Yury Delendik
9c3419de94 Merge pull request #7826 from Snuffleupagus/PDFPageView_paintOnSvg-FIREFOX-prevent-unreachable-code-after-return-statement-warning
Prevent "unreachable code after return statement" warnings from `PDFPageView_paintOnSvg` in the addons
2016-11-18 14:20:47 -06:00
Jonas Jenwald
7272bb4894 Prevent "unreachable code after return statement" warnings from PDFPageView_paintOnSvg in the addons
Follow-up to PR 7738.
2016-11-18 21:18:27 +01:00
Tim van der Meij
eaf9bff4e4 Merge pull request #7738 from yurydelendik/svg-page
Adds SVG rendering capabilities to the main viewer.
2016-11-18 20:10:12 +01:00
Yury Delendik
f7d6f3a739 Adds SVG rendering capabilities to the PDFViewer. 2016-11-18 13:03:49 -06:00
Yury Delendik
c9a0955c9c Refactors PDFPageView_draw. 2016-11-18 12:57:11 -06:00
Yury Delendik
f6a8d9c4dd Merge pull request #7789 from yurydelendik/toolbar
Refactor toolbar.
2016-11-18 12:53:51 -06:00
Yury Delendik
a4402c84de Refactor toolbar (and secondary toolbar). 2016-11-18 12:51:15 -06:00
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