Commit Graph

9115 Commits

Author SHA1 Message Date
Jonas Jenwald
3b9042034b Update README.md to only guarantee Firefox addon compatibility with the current ESR version
To reduced the amount of compatibility code that we need to maintain in the addon, I think that we should be more explicit about which Firefox versions we intend to support. In the future, this should allow us to more quickly remove old compatibility code.
Furthermore, this patch also tries to be more explicit about the addon support for Seamonkey, by defining it in terms of the underlying Firefox version.
2016-06-25 08:59:59 +02:00
Yury Delendik
671f33a324 Merge pull request #7427 from Snuffleupagus/fonts-skip-mapping-ideographic-space
Skip mapping of glyphs to Unicode "Ideographic space" (issue 7416)
2016-06-24 10:57:55 -05:00
Yury Delendik
546e22397e Merge pull request #7437 from Snuffleupagus/addon-seamonkey-compat
[Firefox addon] Feature detect `originAttributes` to make it Seamonkey 2.40 compatible
2016-06-24 10:25:49 -05:00
Jonas Jenwald
9fbde18880 [Firefox addon] Feature detect originAttributes to make it Seamonkey 2.40 compatible
Fixes 7245.
2016-06-24 17:05:53 +02:00
Yury Delendik
98d9712308 Merge pull request #7409 from Snuffleupagus/upstream-bug-1242730
Upstream the changes from Bug 1242730 - Convert callsites to use channel.async0pen2() within browser/extensions/pdfjs (issue 7386)
2016-06-24 09:49:56 -05:00
Jonas Jenwald
2d8ed7ba18 Merge pull request #7430 from Rob--W/crx-rewrite-url-asap
Move Chromium URL rewrite to top of viewer.js
2016-06-24 09:05:12 +02:00
Rob Wu
de85278537 Move Chromium URL rewrite to top of viewer.js
Move the Chromium-specific URL rewriting code to the top of viewer.js
(before the PDF.js library) to make sure that the URL is as expected.

This ensures that variables that synchronously depends on the URL
(e.g. PDFViewerApplication.initialBookmark) are properly set.
2016-06-24 00:57:30 +02:00
Tim van der Meij
9a948f3190 Merge pull request #7428 from Snuffleupagus/importl10n-use-hg.mozilla.org
Unbreak the `importl10n` command by updating the links to point to hg.mozilla.org instead of mxr
2016-06-22 20:26:14 +02:00
Jonas Jenwald
2e42c19202 Update l10n files 2016-06-22 09:41:18 +02:00
Jonas Jenwald
bd0affab9c Unbreak the importl10n command by updating the links to point to hg.mozilla.org instead of mxr
Currently `importl10n` fails, since mxr.mozilla.org has been down for a while. Based on discussions in #developers, it isn't clear to me if/when it'll be available again.
Furthermore, I'm not sure why we're even getting the l10n files through a code search tool, rather than just using the official Mozilla repository directly.
2016-06-22 09:41:11 +02:00
Jonas Jenwald
c1ca268ef3 Skip mapping of glyphs to Unicode "Ideographic space" (issue 7416)
Fixes 7416, which is an IE specific issue.
2016-06-22 08:58:00 +02:00
Jonas Jenwald
6d7f6f1b86 Upstream the changes from Bug 1242730 - Convert callsites to use channel.async0pen2() within browser/extensions/pdfjs (issue 7386)
Please see https://bugzilla.mozilla.org/show_bug.cgi?id=1242730.

Fixes 7386.
2016-06-15 14:50:56 +02:00
Yury Delendik
a0a6e6d688 Merge pull request #7400 from Snuffleupagus/addon-minimum-firefox38
[Firefox addon] Change the minimum supported version to Firefox 38 and remove a bunch old no longer necessary fallback code
2016-06-15 13:27:33 +01:00
Jonas Jenwald
d3d3bb9695 [Firefox addon] Change the minimum supported version to Firefox 38 and remove a bunch old no longer necessary fallback code
From the discussion in issue 7386, it wasn't really clear if we can restrict addon support to Firefox `45` (i.e. the version that corresponds to the *current* ESR version).

However, we have a bunch of code for *very* old Firefox versions. Hence this patch changes the minimum supported version to Firefox `38` (which was released on `2015-05-12`, and correspond to the *previous* ESR version), and removes code that only applies to old Firefox versions.

Regardless what we end up deciding regarding addon support for previous Firefox versions, given the amount of code that even the Firefox `>= 38` condition lets us remove, I certainly think that there is value in doing this.
2016-06-15 09:54:41 +02:00
Jonas Jenwald
64a409b539 Merge pull request #7404 from Rob--W/crx-pdf-embed-object-fix-1
Force inline block display style for <object>.
2016-06-11 16:34:39 +02:00
Rob Wu
08ad551a01 Force inline block display style for <object>.
Test:
1. Build the Chrome extension and load it.
2. Visit https://robwu.nl/pdfjs/object-embed.html
3. Verify that all displayed blocks have the same width and
   height as the reference ("Expected dimension").
2016-06-11 15:54:16 +02:00
Tim van der Meij
f97d52182a Merge pull request #7341 from Snuffleupagus/getDestinationHash-Array
[api-minor] Improve handling of links that are using explicit destination arrays
2016-06-09 00:29:10 +02:00
Tim van der Meij
70b3eea4a3 Merge pull request #7389 from Snuffleupagus/move-isSpace
Move the `isSpace` utility function from core/parser.js to shared/util.js
2016-06-08 22:57:45 +02:00
Jonas Jenwald
6a0b047bfa Add upper-case I as a possible space replacement fallback in Font.spaceWidth to improve text-selection (issue 7180)
In fonts with only upper-case glyphs, that are also missing a space glyph, `get spaceWidth` won't be able to return anything useful.
By adding upper-case `I` as a fallback, we can thus improve text-selection in some PDF files.
Note that locally, the patch causes slight movement in a few existing `text` tests, but in my opinion this actually looks like slight improvements.

Fixes 7180.
2016-06-07 22:55:25 +02:00
Brendan Dahl
c4db4dd4ac Merge pull request #7361 from Snuffleupagus/bug-1146106
Attempt to recover valid `format 3` FDSelect data from broken CFF fonts (bug 1146106)
2016-06-07 11:47:51 -07:00
Jonas Jenwald
6260fc09a3 Attempt to recover valid format 3 FDSelect data from broken CFF fonts (bug 1146106)
According to the CFF specification, see http://partners.adobe.com/public/developer/en/font/5176.CFF.pdf#G3.46884, for `format 3` FDSelect data: "The first range must have a ‘first’ GID of 0".
Since the PDF file (attached in the bug) violates that part of the specification, this patch tries to recover valid FDSelect data to prevent OTS from rejecting the font.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1146106.
2016-06-06 18:20:52 +02:00
Jonas Jenwald
a36a946976 Move the isSpace utility function from core/parser.js to shared/util.js
Currently the `isSpace` utility function is a member of `Lexer`, which seems suboptimal, given that it's placed in `core/parser.js`. In practice, this means that in a number of `core/*.js` files we thus have an *otherwise* completely unnecessary dependency on `core/parser.js` for a one-line function.

Instead, this patch moves `isSpace` into `shared/util.js` which seems more appropriate for this kind of utility function. Not to mention that since all the affected `core/*.js` files already depends on `shared/util.js`, this doesn't incur any more file dependencies.
2016-06-06 09:11:33 +02:00
Rob Wu
bd47440e79 Merge pull request #7388 from Rob--W/crx-telemetry-7312-typo
Fix typo in telemetry.js, follow-up to #7370
2016-06-03 23:29:20 +02:00
Rob Wu
60438399e0 Fix typo in telemetry.js, follow-up to #7370 2016-06-03 23:28:01 +02:00
Yury Delendik
f0585f5d65 Merge pull request #7370 from Rob--W/crx-telemetry-7312
Add opt-out telemetry to the Chrome extension
2016-06-03 15:48:46 -05:00
Rob Wu
724308c57a Add opt-out telemetry to the Chrome extension
Privacy policy: https://github.com/Rob--W/pdfjs-telemetry#privacy-policy

Unit tests (offline):

```
node test/chromium/test-telemetry.js
```

Server tests (requires that Nginx is installed):

```
git clone https://github.com/Rob--W/pdfjs-telemetry.git
cd pdfjs-telemetry/
python testserver.py TestHttp TestHttps
```

Integration test (extension + server):

- Build the extension
- Edit build/chromium/telemetry.js and remove the check for
  chrome.runtime.id.
- Start Chrome (preferably a new profile):
  chromium --user-data-dir=/tmp/pdftest --no-first-run
- Open chrome://net-internals#events
- Visit chrome://extensions and enable Developer mode.
- Load unpacked extension, select build/chromium.
- Go to the chrome://net-internals tab and filter on pdfjs.robwu.nl.
- Click on URL_REQUEST and verify that the server replied with 204.
- Reload the extension.
- Verify that chrome://net-internals did not contain a new log request.
2016-06-03 20:36:57 +02:00
Yury Delendik
5a5bb99734 Merge pull request #7374 from Snuffleupagus/fix-getTextContent-setGState
Fix errors in `setGState` in `PartialEvaluator_getTextContent` that prevents text-selection from working properly
2016-06-03 11:54:41 -05:00
Jonas Jenwald
b02d560ae0 Fix errors in setGState in PartialEvaluator_getTextContent that prevents text-selection from working properly
Currently `setGState` is completely broken, and looking through the history of that code, it seems to me that this may never have worked correctly.
This patch fixes the text-selection in `extgstate.pdf` in the test-suite, which is also added as a `text` test.
2016-06-01 22:58:49 +02:00
Jonas Jenwald
7c7d239995 Update l10n files 2016-05-29 12:47:00 +02:00
Yury Delendik
5aefce6ba6 Merge pull request #5579 from jazzy-em/master
Added multiple term search functionality (with default phrase search)
2016-05-27 14:23:26 -05:00
Tim van der Meij
41f978c7c3 Merge pull request #7362 from bbodenmiller/patch-2
Github -> GitHub
2016-05-26 20:15:52 +02:00
Ben Bodenmiller
e0b9d49f2c Github -> GitHub 2016-05-26 11:11:50 -07:00
jazzy-em
0a347ec04d Added multiple term search functionality (with default phrase search) 2016-05-26 18:24:58 +05:00
Tim van der Meij
c55541f1f3 Merge pull request #7352 from Snuffleupagus/popup-annotation-inherit-parent-flags
Let non-viewable Popup Annotations inherit the parent's Annotation Flags if the parent is viewable
2016-05-25 23:57:33 +02:00
Jonas Jenwald
98fe094d18 Let non-viewable Popup Annotations inherit the parent's Annotation Flags if the parent is viewable
Fixes http://www.pdf-archive.com/2013/09/30/file2/file2.pdf.

Note how it's not possible to show the various Popup Annotations in the above document.
To fix that, this patch lets the Popup inherit the flags of the parent, in the special case where the parent is `viewable` *and* the Popup is not.
In general, I don't think that a Popup must have the same flags set as the parent. However, it seems very strange to have a `viewable` parent annotation, and then not being able to view the Popup.

Annoyingly the PDF specification doesn't, as far as I can find, mention anything about how this case should be handled, but this patch seem consistent with the actual behaviour in Adobe Reader.
2016-05-25 23:00:26 +02:00
Tim van der Meij
47b929be26 Merge pull request #7346 from Rob--W/crx-sync-storage
Support syncing of settings in Chrome extension
2016-05-25 01:50:39 +02:00
Rob Wu
0be8e72d6f Support syncing of settings in Chrome extension
Use chrome.storage.sync to store preferences instead of
chrome.storage.local, to allow settings to be synchronized if the user
chooses to sign in in Chrome and enables synchronization of extension
preferences.
2016-05-25 00:51:51 +02:00
Tim van der Meij
78359d8b03 Merge pull request #7353 from timvandermeij/chromium-regression
Resolve a regression in the Chromium extension's preferences handling
2016-05-25 00:43:50 +02:00
Tim van der Meij
fdfaa43f5e Resolve a regression in the Chromium extension's preferences handling
Commit df10513e10 unfortunately broke the options dialog of the Chromium extension because the logic required to work with the preference was not added. This patch adds the required logic to show the preference in the options dialog and to persist it to the preferences storage.

Verified using Chromium 50 on Arch Linux.
2016-05-25 00:32:32 +02:00
Tim van der Meij
6316ca0299 Merge pull request #7344 from Rob--W/crx-cleanup-compat-frame
Remove support for frames in old Chromium versions
2016-05-25 00:04:45 +02:00
Brendan Dahl
b86610ffdb Merge pull request #7300 from Snuffleupagus/bug-1068432
Prevent adding invalid values in `CFFDict_setByKey` (bug 1068432)
2016-05-24 12:12:38 -07:00
Jonas Jenwald
b354682dd6 [api-minor] Let LinkAnnotation/PDFLinkService_getDestinationHash return a stringified version of the destination array for explicit destinations
Currently for explicit destinations, compared to named destinations, we manually try to build a hash that often times is a quite poor representation of the *actual* destination. (Currently this only, kind of, works for `\XYZ` destinations.)
For PDF files using explicit destinations, this can make it difficult/impossible to obtain a link to a specific section of the document through the URL.

Note that in practice most PDF files, especially newer ones, use named destinations and these are thus unnaffected by this patch.
This patch also fixes an existing issue in `PDFLinkService_getDestinationHash`, where a named destination consisting of only a number would not be handled correctly.

With the added, and already existing, type checks in place for destinations, I really don't think that this patch exposes any "sensitive" internal destination code not already accessible through normal hash parameters.

*Please note:* Just trying to improve the algorithm that generates the hash is unfortunately not possible in general, since there are a number of cases where it will simply never work well.

 - First of all, note that `getDestinationHash` currently relies on the `_pagesRefCache`, hence it's possible that the hash returned is empty during e.g. ranged/streamed loading of a PDF file.

 - Second of all, the currently computed hash is actually dependent on the document rotation. With named destinations, the fetched internal destination array is rotational invariant (as it should be), but this will not hold in general for the hash. We can easily avoid this issue by using a stringified destination array.

 - Third of all, note that according to the PDF specification[1], `GoToR` destinations may actually contain explicit destination arrays. Since we cannot really construct a hash in `annotation.js`, we currently have no good way to support those. Even though this case seems *very* rare in practice (I've not actually seen such a PDF file), it's in the specification, and this patch allows us to support that for "free".

---
[1] http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G11.1951685
2016-05-21 14:14:07 +02:00
Jonas Jenwald
01ab15a6f1 [api-minor] Let Catalog_getPageIndex check that the Ref actually points to a /Page dictionary
Currently the `getPageIndex` method will happily return `0`, even if the `Ref` parameter doesn't actually point to a proper /Page dictionary.
Having the API trust that the consumer is doing the right thing seems error-prone, hence this patch which adds a check for this case.

Given that the `Catalog_getPageIndex` method isn't used in any hot part of the codebase, this extra check shouldn't be a problem.
(Note: in the standard viewer, it is only ever used from `PDFLinkService_navigateTo` if a destination needs to be resolved during document loading, which isn't common enough to be an issue IMHO.)
2016-05-21 14:13:41 +02:00
Tim van der Meij
db46829ef7 Merge pull request #7316 from timvandermeij/remove-unused
Remove unused variables
2016-05-21 14:07:33 +02:00
Tim van der Meij
7ac48ef4d5 Merge pull request #7340 from Snuffleupagus/unicode-unit-tests
Add basic unit-tests for unicode.js
2016-05-19 20:46:17 +02:00
Jonas Jenwald
c5c5a2a71f Add basic unit-tests for unicode.js
Re: issue 7261.
2016-05-19 19:45:45 +02:00
Tim van der Meij
f4e6afb74f Merge pull request #7337 from Snuffleupagus/combine-setTextMatrix
Attempt to combine text runs positioned with `setTextMatrix`
2016-05-18 23:05:36 +02:00
Jonas Jenwald
7ddb0bc718 Attempt to combine text runs positioned with setTextMatrix 2016-05-18 17:21:58 +02:00
Yury Delendik
8aa5901c20 Merge pull request #7332 from yurydelendik/fix-components
Fixes AMD name in web/the pdf_viewer.js.
2016-05-16 12:02:59 -05:00
Yury Delendik
185a1f45e7 Fixes AMD name in the web/pdf_viewer.js. 2016-05-16 12:01:29 -05:00