Commit Graph

9692 Commits

Author SHA1 Message Date
Tim van der Meij
25f772a255 Merge pull request #8050 from yurydelendik/systemjs
Replaces RequireJS to SystemJS.
2017-02-27 23:31:41 +01:00
Tim van der Meij
4e201d3787 Merge pull request #8072 from timvandermeij/annotation-append-operator-list
Annotations: move operator list addition logic to `src/core/document.js`
2017-02-27 22:50:57 +01:00
Tim van der Meij
0739f90707
Annotations: move operator list addition logic to src/core/document.js
Ideally, the `Annotation` class should not have anything to do with the
page's operator list. How annotations are added to the page's operator
list is logic that belongs in `src/core/document.js` instead where the
operator list is constructed.

Moreover, some comments have been added to clarify the intent of the
code.
2017-02-27 22:17:49 +01:00
Tim van der Meij
9db4240b85 Merge pull request #8110 from timvandermeij/interactive-forms-choice-inherit-options
Interactive forms: make choice widget options inheritable (issue 8094)
2017-02-27 22:14:25 +01:00
Tim van der Meij
1da7123f37 Merge pull request #8106 from Snuffleupagus/ObjStm-Dict-objId
Ensure that `Dict`s found in Object Streams are assigned an `objId` in `XRef.fetch`
2017-02-27 21:41:02 +01:00
Jonas Jenwald
2a7e5b8a54 Support the newWindow flag in white-listed app.launchURL JavaScript actions (PR 7794 follow-up)
A simple follow-up to PR 7794, which let's us add support for the `newWindow` parameter; refer to https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/js_api_reference.pdf#G5.1507380.

The patch also fixes an embarrassing oversight regarding the placement of the case-insensitive flag, and also allows arbitrary white-space at the beginning of JS actions.
2017-02-27 15:58:28 +01:00
Yury Delendik
5b50e0d414 Replaces RequireJS to SystemJS. 2017-02-27 08:32:39 -06:00
Jonas Jenwald
afc3cd2a81 Update l10n files 2017-02-26 13:46:58 +01:00
Tim van der Meij
8990de8614
Interactive forms: make choice widget options inheritable (issue 8094)
Even though the PDF specification does not state that `Opt` fields are
inheritable, in practice there are PDF generators that let annotations
inherit the options from a parent.
2017-02-25 23:34:26 +01:00
Jonas Jenwald
14cc6acb90 Ensure that Dicts found in Object Streams are assigned an objId in XRef.fetch
This fixes something that I noticed while working with the code in `Catalog.getPageDict` when debugging issue 8088.

Note that while I don't have an example where this patch really matters, given that e.g. `PartialEvaluator.hasBlendModes` depends on the `objId` to avoid cyclic references this patch could potentially help for some PDF files.
2017-02-25 10:20:19 +01:00
Brendan Dahl
54e86f441b Merge pull request #8109 from brendandahl/makeref
Add gulp task to generate refs.
2017-02-24 18:20:50 -08:00
Brendan Dahl
8be4db1c34 Add gulp task to generate refs. 2017-02-24 16:59:01 -08:00
Tim van der Meij
752510ffa0 Merge pull request #8107 from yurydelendik/init-via-port
Init PDFWorker via MesssagePort.
2017-02-25 00:13:33 +01:00
Tim van der Meij
59392fd544 Merge pull request #8102 from yurydelendik/mv-compatibilty
Move compatibility code to the shared/compatibility.js.
2017-02-24 22:47:49 +01:00
Tim van der Meij
912c952df7 Merge pull request #8105 from Snuffleupagus/issue-8088-2
Always check all Kids nodes, in `Catalog.getPageDict`, to avoid getting stuck in an empty node further down in the Pages tree (issue 8088)
2017-02-24 22:12:04 +01:00
Yury Delendik
51767d63fe Init PDFWorker via MesssagePort. 2017-02-24 13:33:18 -06:00
Jonas Jenwald
1ce295541c Always check all Kids nodes, in Catalog.getPageDict, to avoid getting stuck in an empty node further down in the Pages tree (issue 8088)
As discussed on IRC, we need to check all nodes at the *bottom* of the tree to ensure that we find the correct `Page` dict.
Furthermore, this patch also gets rid of the caching present in a previous version, since it's not clear if that really helps.

Note that this patch purposely adds an `eq` test, using a reduced test-case, so that we can be sure that the algorithm actually finds the correct `Page` dict for each `pageIndex`.

Fixes 8088.
2017-02-24 12:09:46 +01:00
Yury Delendik
facefb0c79 Move compatibility code to the shared/compatibility.js. 2017-02-23 19:18:44 -06:00
Tim van der Meij
cada411af4 Merge pull request #8091 from timvandermeij/gulp-baseline
Gulp: migrate `baseline` target from `make.js`
2017-02-22 00:31:43 +01:00
Tim van der Meij
0f4e6fdb9d
Gulp: migrate baseline target from make.js 2017-02-21 23:50:57 +01:00
Tim van der Meij
72a0916101 Merge pull request #8081 from danielj41/ios-chrome--fix-broken-download-button
iOS Chrome: Fix broken download button
2017-02-20 23:20:03 +01:00
Daniel Johnson
4fc64ceb76 iOS Chrome: Fix broken download button
The download button in pdf.js doesn't work in iOS Chrome.

  - It appears to be an issue with URLs from URL.createObjectURL.
    The URL is correct, but iOS Chrome won't even load the URL
    when `a.click()` is called in `download_manager.js`. Even
    if you manually visit the URL, you get a blank page.

  - Fix this by detecting iOS Chrome and disabling createObjectURL.

The `download_manager.js` `download` method wasn't checking
`PDFJS.disableCreateObjectURL`, so check it there, too.

  - Move the navigator.msSaveBlob check earlier, so that
    this doesn't change IE10 / IE11 behavior.

  - Remove the !URL check since pdf.js has a URL polyfill
    now.
2017-02-20 11:30:53 -08:00
Yury Delendik
bc288141be Allows to pull pdf.js from pdf_viewer using require(). 2017-02-20 08:49:55 -06:00
Tim van der Meij
cf73f4bc2d Merge pull request #8024 from Rob--W/issue-6643-pdf-attachment-in-pdfjs
Open PDF attachments in the viewer instead of an unconditional download
2017-02-18 21:52:29 +01:00
Tim van der Meij
f99e4e46bc Merge pull request #8080 from Snuffleupagus/cmap-unit-test-travis
Enable running the `cmap` unit-tests on Travis by utilizing a `NodeCMapReaderFactory`
2017-02-18 21:27:15 +01:00
Jonas Jenwald
9082f08e37 Enable running the cmap unit-tests on Travis by utilizing a NodeCMapReaderFactory 2017-02-17 23:15:36 +01:00
Yury Delendik
cfaa621a05 Merge pull request #8064 from Snuffleupagus/fetchBuiltInCMap
[api-minor] Refactor fetching of built-in CMaps to utilize a factory on the `display` side instead, to allow users of the API to provide a custom CMap loading factory (e.g. for use with Node.js)
2017-02-17 15:30:31 -06:00
Brendan Dahl
425ad30912 Merge pull request #8071 from Snuffleupagus/bug-1337429
Always choose a (3, 1) cmap table for TrueType fonts that have an encoding specified, regardless of the Symbolic font flag (bug 1337429)
2017-02-16 15:13:46 -08:00
Brendan Dahl
63c472cec8 Remove mailing list information.
The mailing list has become a burden to maintain with all the spam it gets. We have IRC and github for discussion.
2017-02-16 13:36:12 -08:00
Jonas Jenwald
111419a64a Cache built-in binary CMap files in the worker (issue 4794) 2017-02-16 10:55:39 +01:00
Jonas Jenwald
769c1450b7 [api-minor] Refactor fetching of built-in CMaps to utilize a factory on the display side instead, to allow users of the API to provide a custom CMap loading factory (e.g. for use with Node.js)
Currently the built-in CMap files are loaded in `src/core/cmap.js` using `XMLHttpRequest` directly. For some environments that might be a problem, hence this patch refactors that to instead use a factory to load built-in CMaps on the main thread and message the data to the worker thread.

This is inspired by other recent work, e.g. the addition of the `CanvasFactory`, and to a large extent on the IRC discussion starting at http://logs.glob.uno/?c=mozilla%23pdfjs&s=12+Oct+2016&e=12+Oct+2016#c53010.
2017-02-16 10:55:35 +01:00
Tim van der Meij
8aad33e8a3 Merge pull request #8065 from timvandermeij/annotation-appearances
Annotations: refactor setting the normal appearance stream
2017-02-15 23:27:40 +01:00
Tim van der Meij
26fc79d51d
Annotations: refactor setting the normal appearance stream
Previously, we had a function called `getDefaultAppearance`. This name,
however, is misleading as the method gets the normal appearance (in the
`N` entry) and not the default appearance (in the `DA` entry). Moreover,
it was not entirely clear how it works just from reading the code. It
primarily lacks comments and explicit error case handling.

This patch improves the situation by fixing the issues mentioned above
and making this function a proper method of the `Annotation` class, just
like e.g., `setColor` and `setBorderStyle`.
2017-02-15 22:42:17 +01:00
Jonas Jenwald
ce072022c1 Always choose a (3, 1) cmap table for TrueType fonts that have an encoding specified, regardless of the Symbolic font flag (bug 1337429)
This patch basically reverts one aspect of TrueType (3, 1) cmap parsing to the state prior to PR 4259. After that PR, a number of regressions occurred in this particular code-path, which necessitated a number of follow-ups such as PRs 5703, 5743, and 6425.
The empirical data suggests, at least to me, that we should always prefer a (3, 1) cmap for TrueType fonts when they have an encoding, regardless of the Symbolic font flag.

Obviously this patch passes all unit/font/reference tests locally, and I made sure that all the PRs mentioned above landed with test-cases included.
However, in my opinion, there's still a very real possibility that this patch could potentially cause new regressions.

Given that the PDF file in bug 1337429 has been broken for almost *three* years before anyone noticed, and considering that the code-path in question has been the source of numerous regressions, I do *not* intend to request uplift of this patch to previous Firefox versions (assuming that it's even accepted).

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1337429.
2017-02-15 17:38:08 +01:00
Jonas Jenwald
fde609e810 Merge pull request #8070 from yurydelendik/new-node-js-check
New node.js check to protect from webpack.
2017-02-15 17:15:18 +01:00
Yury Delendik
fa0e559fe2 New node.js check to protect from webpack. 2017-02-14 15:00:52 -06:00
Yury Delendik
b509a3f83c Merge pull request #8067 from Snuffleupagus/gulp-mozcentral-pdfjschildbootstrap.js
Include the `pdfjschildbootstrap.js` file in the output for `gulp mozcentral` builds (PR 8023 follow-up)
2017-02-13 16:44:53 -06:00
Jonas Jenwald
2aaeb17037 Include the pdfjschildbootstrap.js file in the output for gulp mozcentral builds (PR 8023 follow-up)
*Yet another thing that I unfortunately missed during review of PR 8023.*

Note that previously, in `make.js` this file was being preprocessed, however as far as I can tell that wasn't actually necessary. Hence this patch just copies the file to the proper output directory.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1338395#c8.
2017-02-13 23:25:54 +01:00
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