Commit Graph

68 Commits

Author SHA1 Message Date
Calixte Denizet
66982a2a11 [api-minor] Move to Fluent for the localization (bug 1858715)
- For the generic viewer we use @fluent/dom and @fluent/bundle
- For the builtin pdf viewer in Firefox, we set a localization url
  and then we rely on document.l10n which is a DOMLocalization object.
2023-10-19 11:20:41 +02:00
Jonas Jenwald
927e50f5d4 [api-major] Output JavaScript modules in the builds (issue 10317)
At this point in time all browsers, and also Node.js, support standard `import`/`export` statements and we can now finally consider outputting modern JavaScript modules in the builds.[1]

In order for this to work we can *only* use proper `import`/`export` statements throughout the main code-base, and (as expected) our Node.js support made this much more complicated since both the official builds and the GitHub Actions-based tests must keep working.[2]
One remaining issue is that the `pdf.scripting.js` file cannot be built as a JavaScript module, since doing so breaks PDF scripting.

Note that my initial goal was to try and split these changes into a couple of commits, however that unfortunately didn't really work since it turned out to be difficult for smaller patches to work correctly and pass (all) tests that way.[3]
This is a classic case of every change requiring a couple of other changes, with each of those changes requiring further changes in turn and the size/scope quickly increasing as a result.

One possible "issue" with these changes is that we'll now only output JavaScript modules in the builds, which could perhaps be a problem with older tools. However it unfortunately seems far too complicated/time-consuming for us to attempt to support both the old and modern module formats, hence the alternative would be to do "nothing" here and just keep our "old" builds.[4]

---
[1] The final blocker was module support in workers in Firefox, which was implemented in Firefox 114; please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#browser_compatibility

[2] It's probably possible to further improve/simplify especially the Node.js-specific code, but it does appear to work as-is.

[3] Having partially "broken" patches, that fail tests, as part of the commit history is *really not* a good idea in general.

[4] Outputting JavaScript modules was first requested almost five years ago, see issue 10317, and nowadays there *should* be much better support for JavaScript modules in various tools.
2023-10-07 09:31:08 +02:00
Jonas Jenwald
b659bacc43 Tighten the vars-argument for the ESLint no-unused-vars rule
Please see https://eslint.org/docs/latest/rules/no-unused-vars#vars
2022-12-04 16:15:50 +01:00
Jonas Jenwald
2ff904fb2b Add localization support for the annotationLayer reference tests (issue 10791) 2022-11-18 23:08:11 +01:00
Jonas Jenwald
1ebbdc253a Use the SimpleLinkService when running "annotations" reference tests
Rather than (basically) duplicating the `SimpleLinkService` in `test/driver.js`, with potential test failuires if you forget to update the test mock, it seems much nicer to just re-use the viewer component.

Note that `SimpleLinkService` is already bundled into the `build/components/pdf_viewer.js` file. Hence we only need to expose it similar to the other viewer components in that file, and make sure that the `gulp components` command runs as part of the test-setup.
2017-09-12 15:24:46 +02:00
Yury Delendik
b66b705ed7 Using pre-built code for testing. 2017-05-30 22:06:21 +02:00
Yury Delendik
5b50e0d414 Replaces RequireJS to SystemJS. 2017-02-27 08:32:39 -06:00
Yury Delendik
1d12aed5ca Move all PDFJS.xxx settings into display/global. 2016-04-07 13:46:07 -05:00
Yury Delendik
85e95d34ed Use RequireJS in the viewer, examples and tests. 2015-12-29 09:20:52 -06:00
Yury Delendik
6b60c8f4db Adds UMD headers to core, display and shared files. 2015-12-15 13:24:39 -06:00
Tim van der Meij
91274d6d2d Rename annotation_helper.js to annotation_layer.js 2015-12-02 23:30:28 +01:00
Yury Delendik
56ccaea99b Move text layer building logic into src/display/text_layer.js 2015-11-19 10:50:27 -06:00
Yury Delendik
2f34fd46cb Move CustomStyle. 2015-11-19 10:47:17 -06:00
Tim van der Meij
e02ab9fb79 Implement an option to disable automatic scrolling
This adds a checkbox with which one can disable scrolling, for example to look back at output during testing. Note that the styles are inline because the test runner removes all <style> elements for each test.
2015-05-21 20:19:36 +02:00
Tim van der Meij
ae8748edfb Refactor test driver to be more class-like
- Extract NullTextLayerBuilder and SimpleTextLayerBuilder from the driver code and create classes for them.
- Move options to the constructor and pass in HTML elements instead of getting them in the driver.
- Remove unused masterMode variable.
- Minor method name updates.

The rest is only moving/indenting existing code and adding 'this'.
2015-05-21 20:19:02 +02:00
Tim van der Meij
58769fd3b9 Refactor test slave
- Improved names of elements
- Easier scrolling code
2015-05-15 23:20:14 +02:00
Collin Anderson
54e984c763 cleaned whitespace 2015-02-17 11:07:37 -05:00
Yury Delendik
bdeca30fbf Splits shared/annotation.js into core/ and display/ 2014-06-17 17:43:33 -05:00
Yury Delendik
fcc4dfd9b5 Moves shared/function.js to core/ 2014-05-23 14:11:47 -05:00
Yury Delendik
7a19085159 Moves shared/colorspace.js into core/ 2014-05-23 14:11:47 -05:00
Michał Gołębiowski
e625af3fef Remove type="text/javascript" from script tags.
"text/javascript" is not a correct MIME type (the correct one is
"application/javascript") but it's not even needed; all browsers default
to the correct type and treat it as executable JS when type is ommited.
Since not all browsers recognize the "application/javascript" MIME type
the only way to both stay compliant and to support all popular browsers
is to omit the type. It's also shorter this way.
2014-05-13 02:41:01 +02:00
Yury Delendik
f57c6935d7 Implements WebGL support 2014-04-03 08:36:22 -05:00
Yury Delendik
bf432a37bb Refactors shared/pattern.js into core/ and display/ 2014-01-25 12:18:22 -06:00
Brendan Dahl
bb2529de03 Move the creation of canvas path fonts to the worker. 2013-08-19 16:33:20 -07:00
Brendan Dahl
5ecce4996b Split files into worker and main thread pieces. 2013-08-12 10:48:06 -07:00
Yury Delendik
0e133f0090 Drawing without fillText; refactoring ADD_TO_PATH 2013-05-15 15:57:27 -05:00
Mack Duan
f8f4b3f45d Refactor code for annotations 2013-05-07 14:22:13 -04:00
Mack Duan
ef423ef30c Implement progressive loading of PDFs 2013-04-12 16:13:22 -07:00
Brendan Dahl
332ae4ce41 Change to the Apache v2 license. 2012-08-31 15:48:21 -07:00
Yury Delendik
95bc99f698 Initial JBIG2 code 2012-06-16 15:15:42 -05:00
Brendan Dahl
5608f8e445 Test refactoring for async api. 2012-04-11 18:05:43 -07:00
Adil Allawi
b50cf76ab5 Properly integrate new file bidi.js 2012-02-13 14:56:37 +00:00
notmasteryet
93ca387d1b Migration of the JPX code (from jpx5) 2012-01-11 20:08:46 -06:00
Brendan Dahl
9bb2b881b0 Adds cmyk jpg support. Treats the cmyk jpg as a regular stream. 2011-11-08 08:48:10 -08:00
Julian Viereck
3b7829d057 Address review comments. Use only one PDFJS.workerSrc variable to specify the worker source 2011-11-01 19:32:20 +01:00
Artur Adib
e9c96c6052 Nit 2011-10-25 21:31:35 -04:00
Artur Adib
f9ba29cf12 Fixed tests 2011-10-25 21:29:51 -04:00
Artur Adib
8fbb05613e Progress 2011-10-25 09:10:56 -07:00
=
2ad1e622ab Move remaining worker.js code into pdf.js. 2011-10-20 12:13:18 -07:00
Kalervo Kujala
633baa881f Make test_slave.html as valid html5.
Fix also warnings in the error console that appear from a test run.
2011-10-11 22:09:13 +02:00
Julian Viereck
23e413520b Small fixes + docs 2011-10-08 17:08:17 +02:00
Julian Viereck
3054102d3b Merge worker_pull with master 2011-10-08 14:18:23 +02:00
notmasteryet
66cd79f308 Initial CID0 font encodings 2011-09-28 19:54:40 -05:00
notmasteryet
107576d634 Removing introduced by the test run DOM elements 2011-09-22 18:04:50 -05:00
Vivien Nicolas
41ebb55d75 Fix tests failures 2011-09-22 01:22:34 +02:00
Julian Viereck
00290b9ff4 Rename some stuff and add missing font_handler.js 2011-09-16 09:31:12 -07:00
Julian Viereck
fea3388c41 Make testdriver use new worker infrastructure 2011-09-15 09:03:50 -07:00
notmasteryet
4e21e417cd Fix test_slave.html ref to metrics.js 2011-09-09 16:46:46 -05:00
Rob Sayre
a4f8251d10 Make test driver a separate js file, eradicate some global variables. 2011-07-04 14:17:23 -07:00
Chris Jones
49058c9174 merge with remote 2011-06-30 02:14:47 -07:00