Commit Graph

8161 Commits

Author SHA1 Message Date
Rob Wu
7e345b223c [CRX] Call callback instead of onCompleted 2015-10-11 17:35:16 +02:00
Brendan Dahl
3eaeacfe19 Merge pull request #6476 from Snuffleupagus/PartialEvaluator_readToUnicode-cmap-length
Right-size the `map` array in PartialEvaluator_readToUnicode
2015-10-09 10:31:28 -07:00
Tim van der Meij
9332da3101 Merge pull request #6502 from Snuffleupagus/bug-1020858-test
Add a reduced load test-case for bug 1020858
2015-10-06 15:38:04 +02:00
Brendan Dahl
42ddb7151b Merge pull request #5356 from Rob--W/scroll-issue-5355
scrollIntoView: Skip overflow:hidden elements
2015-10-05 11:15:34 -07:00
Jonas Jenwald
7b44d644ab Merge pull request #6503 from Snuffleupagus/bug-1202902-followup
Follow-up to PR 6489 - Upstream changes from Bug 1202902
2015-10-05 12:51:51 +02:00
Jonas Jenwald
49389c2d30 Follow-up to PR 6489 - Upstream changes from Bug 1202902
I somehow managed miss including one of the upstream changes in PR 6489; hence this patch. Sorry about the unnecessary churn in this code!
2015-10-05 12:31:53 +02:00
Jonas Jenwald
03f2c704a3 Add a reduced load test-case for bug 1020858
Re: PR 4907 and https://bugzilla.mozilla.org/show_bug.cgi?id=1020858.

*Note:* Since this is a `load` test, `makeref` won't be necessary.
2015-10-04 23:49:49 +02:00
Tim van der Meij
cd8bd73529 Merge pull request #6499 from Snuffleupagus/issue-4387-test
Add a (linked) load test for issue 4387
2015-10-04 16:50:18 +02:00
Tim van der Meij
1e29ddc4de Merge pull request #6500 from Snuffleupagus/pr-4897-test
Add a (linked) test-case for PR 4897
2015-10-04 16:26:57 +02:00
Tim van der Meij
5e4910f7b6 Merge pull request #6491 from Snuffleupagus/check-trailer-if-xref-missing
Make `XRef_indexObjects` even more robust against bad PDF files, by checking for the existence of 'trailer' if 'xref' is not found
2015-10-04 16:00:00 +02:00
Tim van der Meij
39d75935bd Merge pull request #6494 from Snuffleupagus/bug-1020226-test
Add a unit-test for bug 1020226
2015-10-04 15:49:36 +02:00
Jonas Jenwald
e8ad6c9d13 Add a unit-test for bug 1020226
For reference, see PR 4902 and https://bugzilla.mozilla.org/show_bug.cgi?id=1020226.
2015-10-04 15:45:24 +02:00
Tim van der Meij
41a75b1423 Merge pull request #6501 from Snuffleupagus/getPage-unit-tests
Slightly improved `getPage` unit-tests
2015-10-04 15:39:28 +02:00
Tim van der Meij
dd9d0b8770 Merge pull request #5480 from CodingFabian/issue-5458
Remove TryCatch in canvas for EvenOdd winding rule.
2015-10-04 15:31:34 +02:00
Jonas Jenwald
ae255f8921 Slightly improved getPage unit-tests 2015-10-04 14:28:24 +02:00
Jonas Jenwald
bdfda37c04 Add a (linked) test-case for PR 4897
Re: PR 4897.
2015-10-04 13:54:05 +02:00
Jonas Jenwald
96b3dc127d Add a (linked) load test for issue 4387
Re: PR 4404 and issue 4387.
2015-10-04 13:15:10 +02:00
Jonas Jenwald
9b12c64be5 Cache the regular expression used for finding objs in XRef_indexObjects, to avoid unnecessary allocations 2015-10-02 12:46:58 +02:00
Yury Delendik
82f73dfed5 Merge pull request #6473 from Snuffleupagus/bug-1165272
Upstream the changes from Bug 1165272 - unify Get*CodebasePrincipal with createCodebasePrincipal in nsIScriptSecurityManager
2015-10-01 11:47:12 -05:00
Yury Delendik
09c1fc51f1 Merge pull request #6489 from Snuffleupagus/bug-1202902
Upstream changes from Bug 1202902 - Give loader scripts and XUL frame scripts a lexical scope that doesn't break everything?
2015-10-01 11:44:28 -05:00
Jonas Jenwald
192907e0d2 Make XRef_indexObjects even more robust against bad PDF files, by checking for the existence of 'trailer' if 'xref' is not found
Fixes http://www.cyjack.com/cognition/Terence%20McKenna%20-%20Lectures%20on%20Alchemy.pdf.
2015-10-01 15:01:25 +02:00
Jonas Jenwald
26ec36ba4c Upstream changes from Bug 1202902 - Give loader scripts and XUL frame scripts a lexical scope that doesn't break everything?
One of the patches in https://bugzilla.mozilla.org/show_bug.cgi?id=1202902, specifically [`Mass replace toplevel 'let' with 'var' in preparation for global lexical scope. (rs=jorendorff)`](https://hg.mozilla.org/mozilla-central/rev/380817d573cd), touches PDF.js code. Unfortunately it was landed upstream without, as far as I can tell, notifying us about it.

This patch uplifts the relevant changes to avoid future merge conflicts, and for consistency also tweaks `PdfJs-stub.jsm`.
2015-10-01 10:03:10 +02:00
Tim van der Meij
1bdfc47de8 Merge pull request #6411 from Snuffleupagus/remove-Parser_fetchIfRef
Remove `Parser_fetchIfRef` since it's obsolete
2015-09-30 00:38:35 +02:00
Tim van der Meij
a6761a52cc Merge pull request #6485 from Snuffleupagus/Dict-getArray-getAsyncArray
Prevent `PartialEvaluator_buildFormXObject` from failing if the `Matrix` or `BBox` contains indirect objects
2015-09-30 00:02:41 +02:00
Tim van der Meij
e28ad20d15 Merge pull request #6475 from Snuffleupagus/PDFPageView-annotationLayer-div
Tweak `PDFPageView` to reflect that `this.annotationLayer` is an `AnnotationsLayerBuilder` instance, instead of a DOM element (PR 5552 follow-up)
2015-09-29 23:38:04 +02:00
Brendan Dahl
7cdc6f3c12 Merge pull request #6468 from Snuffleupagus/issue-6467
Don't clear the `canvas` until re-rendering is finished when the `scale` or `rotation` is changed (issue 6467)
2015-09-29 11:09:44 -07:00
Jonas Jenwald
1b8cb52555 Prevent PartialEvaluator_buildFormXObject from failing if the Matrix or BBox contains indirect objects
This patch fixes yet another instance of bad PDF data, specifically a case where the `BBox` array contains indirect objects (i.e. `Ref`s).

Fixes the missing image in http://www.int.washington.edu/talks/WorkShops/int_08_37W/People/Franz_M/Franz.pdf#page=24. *Note:* There are missing images on a number of the pages in that file.
2015-09-29 10:11:49 +02:00
Jonas Jenwald
75557d27d1 Add getArray method to Dict
This method extend `get`, and will fetch all indirect objects (i.e. `Ref`s) when the result is an `Array`.
2015-09-29 10:11:47 +02:00
Tim van der Meij
973b15c5de Merge pull request #6482 from Snuffleupagus/TilingPattern-baseTransform
Ensure that the `baseTransform` is always defined for TilingPatterns
2015-09-29 00:27:39 +02:00
Tim van der Meij
a6270bb449 Merge pull request #6452 from Snuffleupagus/pr-2875-reduced-test
Replace the unavailable linked test-case for PR 2875 with a reduced test-case
2015-09-29 00:04:16 +02:00
Tim van der Meij
67ed161a6a Merge pull request #6450 from Snuffleupagus/issue-3115-test-new-link
Update the link location for the `issue3115` test file
2015-09-28 23:35:29 +02:00
Jonas Jenwald
9eab463b6d Ensure that the baseTransform is always defined for TilingPatterns
Fixes http://www2.emersonprocess.com/siteadmincenter/PM%20Micro%20Motion%20Documents/High-Pressure-Measurement-WP-001287.pdf#page=3.
2015-09-27 22:49:34 +02:00
Jonas Jenwald
7a8b0fb107 Merge pull request #6200 from Rob--W/hashchange-use-newURL
Refactor the previous history rewriting logic
2015-09-27 17:59:01 +02:00
Rob Wu
cdea75dc39 Refactor the previous history rewriting logic
When the user edits the URL and changes the reference fragment (hash),
PDF.js intercepts this action, and saves the then-current history state
in the previous history entry. This is implemented by navigating back,
editing the history and navigating forward again.

The current logic has a flaw: It assumes that calling history.back() and
history.forward() immediately updates the history state. This is however
not guaranteed by the web standards, which states that calling e.g.
history.back "must traverse the history by a delta -1", which means that
the browser must QUEUE a task to traverse the session history, per spec:
http://w3.org/TR/2011/WD-html5-20110113/history.html#dom-history-back
https://html.spec.whatwg.org/multipage/browsers.html#dom-history-back

Firefox and Internet Explorer deviate from the standards by immediately
changing the history state instead of queuing the navigation.
WebKit derived browsers (Chrome, Opera, Safari) and Opera presto do not.

The user-visible consequence of strictly adhering to the standards in
PDF.js can be shown as follows:

1. Edit the URL.
2. Append #page=2 for example.
3. Press Enter.
   -> Presto and WebKit: PDF.js reverts to the previous URL.
   -> Gecko and Trident: PDF.js keeps the new URL, as expected.

To fix the issue, modification of the previous history item happens in
a few asynchronous steps, guided by the popstate event to detect when
the history navigation request has been committed.

--
Some more implementation notes:

I have removed the preventDefault and stopPropagation calls, because
popstate is not cancelable, and window is already the last target of the
event propagation.

The previous allowHashChange logic was hard to follow, because it did
not explain that hashchange will be called twice; once during the
popstate handler for history.back() (which will reset allowHashChange),
and again for history.forward() (where allowHashChange will be false).
The purpose of allowHashChange is now more explicit, by incorporating
the logic in the replacePreviousHistoryState helper function.
2015-09-26 23:15:29 +02:00
Jonas Jenwald
5e7ce9d62d Fix incorrect indentation, and remove else after return, in PDFPageView_update 2015-09-26 15:41:02 +02:00
Jonas Jenwald
1ae9ba1d64 Don't clear the canvas until re-rendering is finished when the scale or rotation is changed (issue 6467)
*This regressed in PR 4920.*

The main motivation for PR 4920 was to quickly get rid of old canvases when pages are evicted from the `PDFPageViewBuffer` cache. However it inadvertently broke the use-case where the `canvas` is used as a preview, on scale or rotation changes, until the re-rendering is finished.

Fixes 6467.
2015-09-26 15:40:59 +02:00
Jonas Jenwald
0be1f449ee Upstream the changes from Bug 1165272 - unify Get*CodebasePrincipal with createCodebasePrincipal in nsIScriptSecurityManager
One of the patches in https://bugzilla.mozilla.org/show_bug.cgi?id=1165272, specifically https://hg.mozilla.org/mozilla-central/rev/5a29e8bc51ca, touches PDF.js code. Unfortunately it was landed upstream without, as far as I can tell, notifying us about it.
This patch uplifts the relevant changes, and also adds preprocessor tags to avoid including unnecessary code in mozilla-central.
2015-09-24 18:25:27 +02:00
Jonas Jenwald
8d831449ab Right-size the map array in PartialEvaluator_readToUnicode
We can avoid a lot of intermediate resizings, by directly allocating the required number of elements for the `map` array.
2015-09-24 13:08:53 +02:00
Jonas Jenwald
c7fd7f898f Tweak PDFPageView to reflect that this.annotationLayer is an AnnotationsLayerBuilder instance, instead of a DOM element (PR 5552 follow-up)
In PR 5552, specifically commit 9f384bbb41, the meaning of `this.annotationLayer` changed in `PDFPageView`. Previously it referred directly to a DOM element, but now it's instead an instance of `AnnotationsLayerBuilder`.
This patch tweaks things so that we won't try to hide a non-existent `annotationLayer` div in `PDFPageView_reset`, and also so that we don't attempt to insert empty (`null`) DOM elements in `PDFPageView_draw`.
2015-09-24 12:24:47 +02:00
Yury Delendik
20b5814249 Update l10n files. 2015-09-21 08:48:19 -05:00
Yury Delendik
c481c32810 Merge pull request #6464 from yurydelendik/version1.1.469
Version 1.1.469
2015-09-21 08:46:44 -05:00
Yury Delendik
ff31b77331 Version 1.1.469 2015-09-21 08:45:35 -05:00
Jonas Jenwald
b218b222b5 Replace the unavailable linked test-case for PR 2875 with a reduced test-case
This reduced PDF file only contains the relevant text/font; for reference please see PR 2875.
2015-09-16 13:59:58 +02:00
Brendan Dahl
f06aa6a380 Merge pull request #6391 from CodingFabian/fix-vertical-kernings-6387
Fix text spacing with vertical fonts (#6387)
2015-09-15 13:53:48 -07:00
Jonas Jenwald
958fb71ef4 Update the link location for the issue3115 test file
The file (`lshort.pdf`) has changed a couple of times since the test was added, hence there's no guarantee that the current version accurately reflects the issues the test was added to check.
In this patch, I'm updating the link location to point to the *intended* file version (hosted on the "Internet Archive").
2015-09-15 15:17:07 +02:00
Fabian Lange
2564827503 Fix text spacing with vertical fonts (#6387)
According to the PDF spec 5.3.2, a positive value means in horizontal,
that the next glyph is further to the left (so narrower), and in
vertical that it is further down (so wider).
This change fixes the way PDF.js has interpreted the value.
2015-09-15 09:28:45 +02:00
Tim van der Meij
e68a5c0222 Merge pull request #6435 from Snuffleupagus/issue-3205-reduced-test
Replace the unavailable linked test-case for issue 3205 with a reduced test-case
2015-09-14 23:59:14 +02:00
Tim van der Meij
abf9a76a66 Merge pull request #6447 from Snuffleupagus/issue-6416-unit-test
Add unit-tests for `removeNullCharacters` (PR 6431 follow-up)
2015-09-14 14:26:49 +02:00
Jonas Jenwald
297984e2e9 Add unit-tests for removeNullCharacters (PR 6431 follow-up)
I overlooked that we already had existing unit-tests for `web/ui_utils.js`, so this PR adds a few tests for `removeNullCharacters` (see PR 6431).
2015-09-14 12:19:29 +02:00
Jonas Jenwald
fef46a2121 Update l10n files 2015-09-13 18:15:45 +02:00