Commit Graph

14 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
Yury Delendik
5438ce9b98 Wraps mozL10n to async calls; splits firefox and generic l10n libs. 2017-05-31 09:22:25 -05:00
Tim van der Meij
edb2eecdc8 Remove XHTML leftovers from the viewer HTML files 2016-02-14 13:23:34 +01: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
689927282e Removes reference to the Makefile 2014-04-15 08:27:35 -05:00
Yury Delendik
e5247e4895 Updates webL10n; using viewer.properties as is 2012-11-29 14:02:33 -06:00
Michael Payne
6ca9245a39 Changes to allowed versioned building of Chrome extension that meets new
Chrome extension security requirements
2012-09-06 12:39:49 -07:00
Michael Payne
088c6e17e8 changes to allow chrome extension to load
changes to remove inline scripts, update manifest version, fix make.js
so compatibility.js isn't included for chrome. Due to new Chrome
extension changes outlined at
http://developer.chrome.com/extensions/manifestVersion.html
2012-09-05 22:52:17 -07:00
Yury Delendik
00543a1c89 Embed locale.properties in the viewer.html for extension 2012-04-30 21:55:21 -05:00
Yury Delendik
9b8b3bd25f Initial localization 2012-04-30 15:29:05 -05: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
Julian Viereck
1e6d1f9922 Make worker support work again after file split. Add PDFJS_WORKER_DIR/PDFJS_WORKER_FILE to specify where to load files if worker support is enabled 2011-10-28 14:32:36 +02:00
Artur Adib
0075007d49 Production scripts 2011-10-25 17:22:45 -07:00