Commit Graph

9591 Commits

Author SHA1 Message Date
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
Rob Wu
5fdc908f02 Recognize file name in reference fragment in getPDFFileNameFromURL
The regular expression incorrectly marked a group as capturing.
For `http://example.com/#file.pdf`, the expected result is "file.pdf",
but instead "document.pdf" was returned.
2017-02-04 00:56:15 +01:00
Tim van der Meij
6f0cf8c4cb Merge pull request #7972 from Snuffleupagus/eslint_no-unused-vars
Enable the `no-unused-vars` ESLint rule
2017-02-01 23:50:23 +01:00
Tim van der Meij
fe3b64d4ab Merge pull request #8016 from Snuffleupagus/remove-isStream-property
Remove the unused `isStream` property on various `Stream`s
2017-02-01 23:07:40 +01:00
Tim van der Meij
37ecb8e620 Merge pull request #7959 from Snuffleupagus/PDFSidebar-notifications
Display a notification on the `sidebarToggle` button for PDF documents with outline/attachments
2017-02-01 22:59:31 +01:00
Jonas Jenwald
f7d99ccc26 Remove the unused isStream property on various Streams
This property was added all the way back in PR 542, but hasn't actually been relied upon ever since PR 692.
Note that there's a `isStream()` utility function which replaced the property years ago, hence the `isStream` property is now dead code.
2017-02-01 11:38:11 +01:00
Jonas Jenwald
c102232275 Append the contents of FileAttachment annotations to the attachments view of the sidebar, for easier access to the embedded files
Other PDF viewers, e.g. Adobe Reader, seem to append `FileAttachment`s to their attachments views.
One obvious difference in PDF.js is that we cannot append all the annotations on document load, since that would require parsing *every* page. Despite that, it still seems like a good idea to add `FileAttachment`s, since it's thus possible to access all the various types of attachments from a single place.

*Note:* With the previous patch we display a notification when a `FileAttachment` is added to the sidebar, which thus makes appending the contents of these annotations to the sidebar slightly more visible/useful.
2017-01-31 22:26:16 +01:00
Jonas Jenwald
616e5fadff Display a notification on the sidebarToggle button for PDF documents with outline/attachments
A longstanding issue with the viewer is that you cannot tell if a PDF document includes an outline and/or attachments without actually opening the sidebar.
This patch contains a suggested solution for that, by displaying an hide-on-interaction notification on the `sidebarToggle` button (and the relevant sidebar view buttons). Note that this was inspired by e.g. the update notification that is displayed on the menu button in Firefox.

For an initial implementation, I've tried to do this in such a way that the notification isn't too distracting. Without being an UX expert, I don't think that we'd want something too in-your-face, in order to keep the viewer toolbars reasonable clean. (We probably do *not* want e.g. an entire notification bar in these situations, since that would take up unnecessary screen space and require actions from the user to close.)

However it's certainly possible that the current notification might simply be *too* inconspicuous to be truly helpful to users, but we could probably iterate on that if the feature itself is deemed useful.
2017-01-30 15:39:04 +01:00
Jonas Jenwald
3f320f0b11 Merge pull request #8006 from timvandermeij/mozFillRule
Remove usage of `mozFillRule`
2017-01-30 10:35:29 +01:00
Tim van der Meij
95732279b6 Remove usage of mozFillRule
The non-standard `mozFillRule` has been removed in Firefox 51 [1, 2].
Instead, a parameter of the standard methods should be used. Note that
this is supported in all major browsers for a long time now, so there
should be no need keeping this Firefox-specific code around.

[1] https://developer.mozilla.org/en-US/Firefox/Releases/51
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=826619
2017-01-29 23:24:44 +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
8d684b5b3f Merge pull request #8003 from Snuffleupagus/move-EOF-isEOF
Move `EOF`/`isEOF` from core/parser.js to core/primitives.js
2017-01-29 22:16:25 +01:00
Jonas Jenwald
2b84fb79b4 Merge pull request #7995 from Snuffleupagus/addon-eslint_consistent-return
[Firefox addon] Enable the `consistent-return` ESLint rule (issue 7957)
2017-01-27 19:11:43 +01:00
Jonas Jenwald
7e1d92461a [Firefox addon] Enable the consistent-return ESLint rule (issue 7957)
See http://eslint.org/docs/rules/consistent-return; it appears that I overlooked this rule in PR 7982.

Also adds the http://eslint.org/docs/rules/no-nested-ternary rule, which didn't require any code changes, since that rule is being enforced in mozilla-central.

Re: issue 7957.
2017-01-27 19:04:08 +01:00