Commit Graph

9554 Commits

Author SHA1 Message Date
Yury Delendik
41041c1576 Merge pull request #8063 from Snuffleupagus/issue-8061
Consume the current character when encountering illegal characters in `Lexer.getObject`, in order to prevent infinite loops during reading of streams (issue 8061)
2017-02-11 13:04:18 -06:00
Jonas Jenwald
23c62cc321 Consume the current character when encountering illegal characters in Lexer.getObject, in order to prevent infinite loops during reading of streams (issue 8061)
*Please note:* The rendering of the PDF file in issue 8061 first regressed in PR 7039, and then PR 7493 exacerbated the problem even further by causing an infinite loop.

In this particular case, when errors were encountered inside of the `Lexer.getObject` method *itself*, we didn't advance the stream position. This thus caused an inifinite loop in `parseCMap`, since the exact same character was then parsed over and over again.

Fixes 8061.
2017-02-11 19:32:48 +01:00
Tim van der Meij
da08b801a5 Merge pull request #8062 from timvandermeij/readme
Improve the README by removing outdated information
2017-02-11 16:33:46 +01:00
Tim van der Meij
fd21ee59a6 Improve the README by removing outdated information 2017-02-11 16:27:34 +01:00
Jonas Jenwald
7be8bd9f96 Merge pull request #8060 from a0preetham/font_ascent_fix
Font ascent descent calculation fix
2017-02-11 13:32:04 +01:00
pmysore1
af8292058f Font ascent descent calculation fix 2017-02-11 01:25:05 -05:00
Tim van der Meij
466760efca Merge pull request #8056 from Snuffleupagus/ChildNode.remove
Use `ChildNode.remove` instead of `ChildNode.ParentNode.removeChild` in a couple of places (bug 1334831, issue 8008)
2017-02-10 23:17:17 +01:00
Yury Delendik
1549a46e3d Merge pull request #8058 from yurydelendik/fix-webpack-combined
Fixes pdf.combined.js for webpack
2017-02-10 13:40:53 -06:00
Yury Delendik
7d9941d870 Fixes pdf.combined.js for webpack. 2017-02-10 11:24:35 -06:00
Yury Delendik
f8879d984c Merge pull request #8054 from Snuffleupagus/gulp-mozcentral-locale-dest
Write the l10n files to the correct destination for `gulp mozcentral` builds (PR 8023 follow-up)
2017-02-10 09:46:34 -06:00
Jonas Jenwald
63f13773e7 Use ChildNode.remove instead of ChildNode.ParentNode.removeChild in a couple of places (bug 1334831, issue 8008)
Re: [bug 1334831](https://bugzilla.mozilla.org/show_bug.cgi?id=1334831) and issue 8008.

Note that according to the specification, see https://dom.spec.whatwg.org/#interface-childnode, the `remove` method shouldn't throw.
This is also consistent with e.g. the Firefox implementation, see http://searchfox.org/mozilla-central/rev/d3307f19d5dac31d7d36fc206b00b686de82eee4/dom/base/nsINode.cpp#1852.

Obviously this isn't supported in IE (because that would be too easy), however we can easily polyfill it to avoid having to WONTFIX the bug/issue.
2017-02-10 14:39:50 +01:00
Rob Wu
ba81b37b43 Merge pull request #8053 from Snuffleupagus/DEFAULT_URL-chromecom
[Chromium addon] Prevent errors that break the addon, caused by the `DEFAULT_URL` constant being replaced by a `defaultUrl` viewer configuration parameter (PR 8046 follow-up)
2017-02-10 12:47:50 +01:00
Jonas Jenwald
991c7c196d Write the l10n files to the correct destination for gulp mozcentral builds (PR 8023 follow-up)
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1338395#c2.
2017-02-10 11:46:14 +01:00
Jonas Jenwald
190c8398ba [Chromium addon] Prevent errors that break the addon, caused by the DEFAULT_URL constant being replaced by a defaultUrl viewer configuration parameter (PR 8046 follow-up)
I missed this during review, sorry about that!

Fixes 8051.
2017-02-10 10:46:44 +01:00
Yury Delendik
32856f0adb Merge pull request #8046 from yurydelendik/webpack
Replacing custom bundling with webpack 2
2017-02-09 16:04:54 -06:00
Tim van der Meij
573236e3ad Merge pull request #8043 from Rob--W/issue6696-auto-rotate-page
Allow automatic print rotation via the enablePrintAutoRotate preference
2017-02-08 23:57:28 +01:00
Yury Delendik
0759066be0 Saving old-style JS module name of dist libraries. 2017-02-08 16:48:37 -06:00
Yury Delendik
a048519fa1 Replace copyright headers; changes UMD to CommonJS. 2017-02-08 16:35:58 -06:00
Yury Delendik
eb4c88cd44 Replacing custom bundling with webpack2. 2017-02-08 16:32:15 -06:00
Rob Wu
ece44d36e8 Allow automatic print rotation via enablePrintAutoRotate 2017-02-08 12:39:24 +01:00
Rob Wu
f6548e463f Open PDF attachments in the viewer instead of download
If users want to download, they can quickly click on the Download button
in the newly opened viewer.

The blobUrl logic for Firefox relies on `disableCreateObjectURL` is
never false in Firefox. If the assumption is invalid, then PDF
attachments at the attachment view will not correctly be displayed,
because a data-URL will be generated and `?<filename>` is treated as
part of the data:-URL.
2017-02-08 11:21:34 +01:00
Tim van der Meij
35102c025a Merge pull request #8041 from timvandermeij/radio-button-value
Interactive forms: set the `buttonValue` for radio buttons that do not have a `fieldValue`
2017-02-08 00:35:48 +01:00
Tim van der Meij
9f05a5a211 Interactive forms: unit test for radio buttons without a field value 2017-02-07 23:44:31 +01:00
vkuryakov
4e181e59ef Interactive forms: values for radio buttons (issue #6995) 2017-02-07 23:42:40 +01: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
Tim van der Meij
1a2f3f95ca Merge pull request #8040 from timvandermeij/l10n-update
Update localization files
2017-02-07 23:30:26 +01:00
Tim van der Meij
dae71559da Update localization files 2017-02-07 23:14:06 +01:00
Yury Delendik
d7a113e766 Merge pull request #8039 from yurydelendik/examples
Moving interactive examples to jsfiddle.net
2017-02-07 13:16:39 -06:00
Yury Delendik
fd4428136b Moving interactive examples to jsfiddle.net 2017-02-07 13:11:18 -06:00
Jonas Jenwald
d7cb46dafc Merge pull request #8038 from yurydelendik/rm-sed
Moves sed processing into the preprocessing tasks and merging tasks.
2017-02-07 17:24:29 +01:00
Yury Delendik
a5ad2b166b Moves sed processing into the preprocessing tasks and merging tasks. 2017-02-07 08:53:33 -06:00
Yury Delendik
9b0e0954fb Merge pull request #8036 from mukulmishra18/node-canvas
[api-minor] Fixes behaviour of DOMCanvasFactory to return {canvas, context}.
2017-02-07 07:39:12 -06:00
Tim van der Meij
d3ae5b38ce Merge pull request #8035 from Snuffleupagus/api-disableNativeImageDecoder
[api-minor] Add a `getDocument` parameter that allows disabling of the `NativeImageDecoder` (e.g. for use with Node.js)
2017-02-06 23:37:02 +01:00
Mukul Mishra
41d092d04b Fixes behaviour of DOMCanvasFactory to return {canvas, context}. 2017-02-07 03:47:13 +05:30
Jonas Jenwald
9c34d0aa8c [api-minor] Add a getDocument parameter that allows disabling of the NativeImageDecoder (e.g. for use with Node.js)
Note that I initially tried to add this as a parameter to the `PDFPageProxy.render` method, such that it could be passed to `PartialEvaluator.getOperatorList`.
However, given all the different code-paths that call `getOperatorList` (there's a bunch only in `annotation.js`), this seemed to very quickly become unwieldy and thus difficult to maintain compared to simply using the existing `evaluatorOptions`.
2017-02-06 22:21:34 +01:00
Tim van der Meij
ec26a7e565 Merge pull request #8028 from Snuffleupagus/tests-prevent-console-errors
Prevent browser console errors during testing
2017-02-06 22:04:54 +01:00
Jonas Jenwald
3e5c6e4287 Merge pull request #8030 from timvandermeij/acroforms-example
Interactive forms: rewrite AcroForms example
2017-02-06 17:45:44 +01:00
Yury Delendik
d842c9c6b0 Merge pull request #8002 from mukulmishra18/refactor-canvas
[api-minor] Fix #7798: Refactor scratch canvas usage.
2017-02-06 07:45:41 -06:00
Rob Wu
c67edabcb3 Set title using logic similar as download name
The download method (and the PDF document properties) detect the
file name using `getPDFFileNameFromURL`. The title ought to also
display the PDF filename if available.
2017-02-06 00:48:46 +01:00
Rob Wu
228d253f30 Detect download filename based on full URL 2017-02-06 00:48:46 +01:00
Tim van der Meij
63fa26843b Interactive forms: rewrite AcroForms example
This patch lets the AcroForms example make use of the built-in interactive
forms functionality in PDF.js. This makes the example:

- much easier to understand;
- more feature-complete;
- in sync with the core when new functionality is added;
- similar to the other examples in terms of structure.
2017-02-05 23:44:32 +01:00
Tim van der Meij
66304f7c99 Merge pull request #8027 from Snuffleupagus/addon-remove-MOZ_CENTRAL
[Firefox addon] Remove the unused `MOZ_CENTRAL` constant
2017-02-05 22:09:18 +01:00
Mukul Mishra
32817633c9 Fix #7798: Refactor scratch canvas usage.
Fixes extra canvas create calls.
Fixes unnecessary call of `new DOMCanvasFactory`.
Fixes undefined error of DOMCanvasFactory.
Fixes failures in some of the tests.
Fixes expected behaviour.
Remove unused vars.
2017-02-05 20:19:47 +05:30
Jonas Jenwald
e416032b38 Prevent browser console errors during testing
The `Driver._cleanup` method is removing all stylesheets between test runs, which causes "TypeError: styleElement.parentNode is null" console errors in `FontLoader.clear`.

As can also be seen during various tests, some of the changes I made in PR 7972 unfortunately causes console errors.
It seems that I didn't test this properly, since it *should* have been obvious to me that while tests are triggered using Node.js, the files in question are run within the *browser*.
My apologies for not testing this thoroughly, and for causing unnecessary churn in the code!
2017-02-05 13:23:42 +01:00
Tim van der Meij
cae8d97c4c Merge pull request #8025 from Snuffleupagus/eslint_brace-style_allowSingleLine_false
Adjust the `brace-style` ESLint rule to disallow single lines (and also enable `no-iterator`)
2017-02-04 22:23:01 +01:00
Jonas Jenwald
b898a453f0 [Firefox addon] Remove the unused MOZ_CENTRAL constant
The last (and only) usage of `MOZ_CENTRAL` was removed in PR 3036, so it's been unused for almost four years now.
If we need to have different code-paths for `FIREFOX`/`MOZCENTRAL` builds, the preprocessor should (and has) been used instead.
2017-02-04 17:51:40 +01:00
Jonas Jenwald
bc736fdc7d Adjust the brace-style ESLint rule to disallow single lines (and also enable no-iterator)
See http://eslint.org/docs/rules/brace-style.
Having the opening/closing braces on the same line can often make the code slightly more difficult to read, in particular for `if`/`else if` statements, compared to using new lines.

This patch also, for consistency with `mozilla-central`, enables the [`no-iterator`](http://eslint.org/docs/rules/no-iterator) rule. Note that this rule didn't require a single code change.
2017-02-04 15:53:08 +01:00
Jonas Jenwald
92e5fb099e Merge pull request #8023 from yurydelendik/mv-preprocessorbuild
Moves preprocessor stuff to the gulpfile.
2017-02-04 15:45:18 +01:00
Yury Delendik
2049cf01db Moves preprocessor stuff to the gulpfile. 2017-02-04 08:19:46 -06:00
Rob Wu
d9f90d595d [CRX] Recognize blob and data-URLs in the router
When a blob or data-URL is opened with the extension, viewer.html
rewrites the URL. But when the viewer is refreshed (e.g. F5), Chrome
would fail to display the viewer because the extension router was not
set up to recognize such URLs.

Now it is.
2017-02-04 01:20:17 +01:00