Tim van der Meij
b7fc916f48
Merge pull request #12753 from Snuffleupagus/issue-12752
...
Ignore, rather than throwing on, Coding style component (COC) markers in JPEG 2000 images (issue 12752)
2020-12-18 21:14:06 +01:00
Tim van der Meij
f2378eb715
Merge pull request #12754 from calixteman/event_sb_creation
...
Dispatch an event on sandbox creation
2020-12-18 21:09:35 +01:00
Calixte Denizet
4ae9064d60
Dispatch an event on sandbox creation
...
* the goal is to be able to know when the sandbox is ready for mochitest in m-c
2020-12-18 19:12:43 +01:00
calixteman
142f131ee1
Merge pull request #12741 from calixteman/global_eval
...
JS -- Actions must be evaluated in global scope
2020-12-18 19:08:36 +01:00
Jonas Jenwald
48a76aea2b
Ignore, rather than throwing on, Coding style component (COC) markers in JPEG 2000 images (issue 12752)
...
Similar to other markers that we currently skip, by ignoring the Coding style component (COC) marker we'll at least prevent outright errors (although some JPEG 2000 images may look slightly wrong).
2020-12-18 18:18:32 +01:00
Calixte Denizet
167ff1a7fc
JS -- Actions must be evaluated in global scope
...
* All the public properties of doc are injected into globalThis, in order to make them available through `this`
* Put event in the global scope too.
2020-12-17 22:01:45 +01:00
calixteman
c366390f6b
Merge pull request #12689 from calixteman/mv_stuff_from_mc
...
In order to simplify m-c code, move some in pdf.js
2020-12-17 21:54:29 +01:00
Calixte Denizet
8bff4f1ea9
In order to simplify m-c code, move some in pdf.js
...
* move set/clear|Timeout/Interval and crackURL code in pdf.js
* remove the "backdoor" in the proxy (used to dispatch event) and so return the dispatch function in the initializer
* remove listeners if an error occured during sandbox initialization
* add support for alert and prompt in the sandbox
* add a function to eval in the global scope
2020-12-17 15:03:26 +01:00
Brendan Dahl
3447f7c703
Merge pull request #12742 from calixteman/map
...
Don't use 'in' operator to check if key is in a Map
2020-12-16 11:15:16 -08:00
Calixte Denizet
03814bd6a2
Don't use 'in' operator to check if key is in a Map
2020-12-16 16:00:12 +01:00
Brendan Dahl
3c603fb28b
Merge pull request #12635 from calixteman/js_display_evts
...
JS -- Send events to the sandbox from annotation layer
2020-12-15 21:24:55 -08:00
Tim van der Meij
0655f50810
Merge pull request #12737 from Snuffleupagus/Safari-10
...
Change the minimum "supported" version of the Safari-browser to Safari 10
2020-12-15 22:58:23 +01:00
Calixte Denizet
6502ae889d
JS -- Send events to the sandbox from annotation layer
2020-12-15 16:28:47 +01:00
Jonas Jenwald
499d865ebf
Change the minimum "supported" version of the Safari-browser to Safari 10
...
According to https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support , Safari 9 is still listed as "mostly supported".
Given that the *last* release from the Safari 9 branch was on [September 1, 2016](https://en.wikipedia.org/wiki/Safari_version_history#Safari_9 ), it's questionable at least to me if it actually makes sense for us to even pretend to "support" such an old browser.
Especially when the *first* release from the Safari 10 branch was on [September 20, 2016](https://en.wikipedia.org/wiki/Safari_version_history#Safari_10 ), which is now over four years ago.
Based on the MDN compatibility data, this patch thus removes the following polyfills:
- `TypedArray.prototype.slice()`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice#Browser_compatibility
- `String.prototype.codePointAt()`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt#Browser_compatibility
- `String.fromCodePoint()`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint#Browser_compatibility
2020-12-15 09:49:32 +01:00
Tim van der Meij
640a08444c
Merge pull request #12724 from calixteman/follow-up-12707
...
Follow-up of #12707 : Add an integration test for checkboxes as radio …
2020-12-15 00:04:10 +01:00
Calixte Denizet
c6c9cc96bf
Follow-up of #12707 : Add an integration test for checkboxes as radio buttons
...
* Integration tests: Add a function to load a pdf and wait for a selected element
* Integration tests: Add a function to close all the open pages
2020-12-15 00:00:04 +01:00
Tim van der Meij
a825b9195b
Merge pull request #12700 from calixteman/12699
...
Fix automatic zoom under spread mode
2020-12-14 23:39:48 +01:00
Tim van der Meij
5354a97025
Merge pull request #12736 from Snuffleupagus/rm-IE-polyfills
...
Remove the remaining IE 11 polyfills
2020-12-14 23:36:36 +01:00
Calixte Denizet
785487c558
Fix automatic zoom under spread mode ( #12699 )
...
Reset scale when update spread mode
2020-12-14 17:57:00 +01:00
Jonas Jenwald
a2874b380a
Remove the remaining IE 11 polyfills
...
We really ought to settle on the *lowest* supported versions of various browsers[1], since that should allow even more clean-up, but given that https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support *explicitly* lists IE 11 as unsupported after PDF.js version `2.6.347` there's a number of polyfills that are no longer needed.
Based on the MDN compatibility data, this patch thus removes the following polyfills:
- `String.prototype.startsWith()`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith#Browser_compatibility
- `String.prototype.endsWith()`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith#Browser_compatibility
- `String.prototype.includes()`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#Browser_compatibility
- `Array.prototype.includes()`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes#Browser_compatibility
- `Array.from()`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Browser_compatibility
- `Object.assign()`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Browser_compatibility
- `Math.log2()`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log2#Browser_compatibility
- `Number.isNaN()`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN#Browser_compatibility
- `Number.isInteger()`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger#Browser_compatibility
- `Map.prototype.entries()`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries#Browser_compatibility
- `Set.prototype.entries()`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries#Browser_compatibility
- `WeakMap`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap#Browser_compatibility
- `WeakSet`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet#Browser_compatibility
- `Symbol`, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility
Finally, this patch also attempts to update the compatibility information for the remaining polyfills.
---
[1] For example: It's questionable if Safari 9 should be listed as supported, given that the last release from that branch was in 2016.
2020-12-14 14:31:25 +01:00
Tim van der Meij
959dc379ee
Merge pull request #12733 from Snuffleupagus/bug-1292316-test
...
Add a test-case for bug 1292316
2020-12-13 13:38:40 +01:00
Tim van der Meij
61d9269201
Merge pull request #12734 from Snuffleupagus/update-packages
...
Update packages and translations
2020-12-13 13:36:36 +01:00
Jonas Jenwald
3655777db7
Enable the ESLint no-unsafe-optional-chaining
rule
...
Given that we're using optional chaining in the code-base, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining , it can't hurt to add this ESLint rule to help catch one possible source of bugs when using optional chaining expressions.
Please find additional details about the ESLint rule at https://eslint.org/docs/rules/no-unsafe-optional-chaining
2020-12-13 11:46:32 +01:00
Jonas Jenwald
ad91972eb2
Update l10n files
2020-12-13 11:43:49 +01:00
Jonas Jenwald
e09f2a462d
Update npm
packages
2020-12-13 11:38:37 +01:00
Tim van der Meij
e3caa29239
Merge pull request #12732 from Snuffleupagus/scripting_spec-fail
...
Call `done.fail` correctly in the `scripting_spec.js` unit-tests
2020-12-12 13:33:28 +01:00
Jonas Jenwald
7f89be5dbf
Add a test-case for bug 1292316
...
It appears that the PDF document in [bug 1292316](https://bugzilla.mozilla.org/show_bug.cgi?id=1292316 ) now renders "correctly"[1] when compared to e.g. Adobe Reader and PDFium. Most likely this bug was fixed by a *somewhat* recent patch, or patches, to the `XRef.indexObjects` method.
Before just closing [bug 1292316](https://bugzilla.mozilla.org/show_bug.cgi?id=1292316 ) as WFM, I figured that it probably can't hurt to add it as a new test-case to avoid accidentally regressing this document in the future.
---
[1] Given that the XRef table is corrupt, and that we're forced to recover, there's generally speaking probably some question as to what actually constitutes "correct" in this case.
2020-12-12 13:24:31 +01:00
Jonas Jenwald
9adb225a7d
Call done.fail
correctly in the scripting_spec.js
unit-tests
...
The `done.fail` method should *always* be called with a reason, to ensure that any errors are propagated as intended to the test results.
2020-12-12 12:41:47 +01:00
Tim van der Meij
d1848f5022
Merge pull request #12725 from brendandahl/remeasure-std
...
Use widths defined by font for standard fonts.
2020-12-11 20:36:19 +01:00
Tim van der Meij
217a00ee3a
Merge pull request #12718 from Snuffleupagus/issue-12705
...
Ignore color-operators in Type3 glyphs beginning with a `d1` operator (issue 12705)
2020-12-11 20:19:49 +01:00
Tim van der Meij
8beb62e397
Merge pull request #12728 from Snuffleupagus/gulpfile-move-timezone
...
[gulpfile.js] Move the time-zone hack to the `testing-pre` task, such that *all* tests work regardless of the current time-zone
2020-12-11 20:08:52 +01:00
Jonas Jenwald
67e5db75d8
Ignore color-operators in Type3 glyphs beginning with a d1
operator (issue 12705)
...
Please refer to the PDF specification at https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G8.1977497 and https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G7.3998470
This patch removes the color-operators in the evaluator, since that should be more efficient than doing it repeatedly in the main-thread when rendering the Type3 glyphs.
2020-12-11 15:49:13 +01:00
Jonas Jenwald
20557d8199
[gulpfile.js] Move the time-zone hack to the testing-pre
task, such that *all* tests work regardless of the current time-zone
...
Currently only the `gulp unittest` task actually set the time-zone, which means that locally I'm now getting failures with e.g. `gulp test`.
*Please note:* I firmly believe that the unit-tests in question should be re-written, since even with this patch applied there's failures when running http://localhost:8888/test/unit/unit_test.html directly in a browser.
2020-12-11 12:17:16 +01:00
Brendan Dahl
45d9ab6e45
Use widths defined by font for standard fonts.
...
There doesn't seem to be anything definitive about this in
the spec, but from experimenting, it seems acrobat lets
PDFs override the widths of the standard fonts.
2020-12-10 15:30:39 -08:00
Tim van der Meij
00b4f86db3
Merge pull request #12717 from Snuffleupagus/issue-12714
...
Ensure that the /Annots-entry, on /Page-instances, is actually an Array (issue 12714)
2020-12-10 23:06:59 +01:00
Tim van der Meij
954ac3d944
Merge pull request #12719 from calixteman/emailvalidate
...
JS -- add function eMailValidate used to validate an email address
2020-12-10 22:19:37 +01:00
Tim van der Meij
e53ae01330
Merge pull request #12723 from mozilla/dependabot/npm_and_yarn/ini-1.3.7
...
Bump ini from 1.3.5 to 1.3.7
2020-12-10 22:08:53 +01:00
Brendan Dahl
31ea30ab25
Merge pull request #12668 from calixteman/interaction
...
Add some integration tests using puppeteer
2020-12-10 12:52:03 -08:00
Calixte Denizet
f94269c0d1
JS -- add function eMailValidate used to validate an email address
2020-12-10 21:51:37 +01:00
dependabot[bot]
7a0d89b3c0
Bump ini from 1.3.5 to 1.3.7
...
Bumps [ini](https://github.com/isaacs/ini ) from 1.3.5 to 1.3.7.
- [Release notes](https://github.com/isaacs/ini/releases )
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.7 )
Signed-off-by: dependabot[bot] <support@github.com>
2020-12-10 20:48:56 +00:00
Tim van der Meij
7097114e0c
Merge pull request #12720 from calixteman/fix_co
...
Be sure that CalculationOrder is either null or a non-empty array
2020-12-10 21:43:35 +01:00
Tim van der Meij
85ab53fef0
Merge pull request #12722 from calixteman/printf
...
JS -- fix printd issue with negative number
2020-12-10 21:41:11 +01:00
Calixte Denizet
5b42ac364a
Add some integration tests using puppeteer and Jasmine
...
* run with `gulp integrationtest`
2020-12-10 20:55:15 +01:00
Calixte Denizet
c7b09b8efc
JS -- fix printd issue with negative number
2020-12-10 18:43:04 +01:00
Calixte Denizet
25bf504ff5
Be sure that CalculationOrder is either null or a non-empty array
2020-12-10 16:02:11 +01:00
Jonas Jenwald
796a0d3155
Ensure that the /Annots-entry, on /Page-instances, is actually an Array (issue 12714)
...
In the referenced PDF document, the second and third page has *corrupt* /Annots-entries which contain /Dict-data rather than the intended Arrays.
2020-12-10 11:42:00 +01:00
Tim van der Meij
93b3ba2abb
Merge pull request #12712 from Snuffleupagus/issue-12704
...
Attempt to handle collapsed outline items, in the default viewer, according to the specification (issue 12704, PR 10890 follow-up)
2020-12-09 23:43:07 +01:00
Tim van der Meij
f48cfba945
Merge pull request #12707 from calixteman/radio_check
...
Checkboxes with the same name must behave like a radio buttons group
2020-12-09 23:29:03 +01:00
Tim van der Meij
0629a8f553
Merge pull request #12703 from Snuffleupagus/GenericScripting-rm-scriptElement
...
Ensure that the `pdf.sandbox.js` is removed from the DOM on destroy, and unbreak the Chromium-extension (PR 12695 follow-up)
2020-12-09 23:09:06 +01:00
Jonas Jenwald
6218b9a512
Re-factor/re-name the scripting
getter, on the externalServices
-implementations, to a createScripting
method
...
Given that the GENERIC default viewer supports opening more than one document, and that a unique scripting-instance is now used for each document, the changes made in this patch seem appropriate.
2020-12-09 22:15:50 +01:00