Commit Graph

254 Commits

Author SHA1 Message Date
Jonas Jenwald
0ee373f9cc Replace the bundled ReadableStream polyfill with the web-streams-polyfill npm package (issue 11157)
Compared to the recently replaced `URL` polyfill, the new `ReadableStream` polyfill isn't being exported globally for two reasons:
 - We're currently checking for the existence of a global `ReadableStream` implementation when determining if the Fetch API will be used; please see `isFetchSupported` in the src/display/display_utils.js file.
 - Given that it's much newer functionality (compared to `URL`) and that not all browsers may implement all parts of the specification yet, not exposing the `ReadableStream` globally seems safer for now.
2019-09-23 22:16:59 +02:00
Tim van der Meij
bdd28fd717
Remove unmaintained localizations
Fixes #11167.
2019-09-21 13:31:42 +02:00
Tim van der Meij
1f5ebfbf0c
Replace our URL polyfill with the one from core-js
`core-js` polyfills have proven to be of good quality and using them
prevents us from having to maintain them ourselves.
2019-09-19 14:09:51 +02:00
Jonas Jenwald
6d1595b669 Stop dispatching a "localized" event from the webL10n library, since it's unused and may clash with the default viewer
Currently this leads to confusing behaviour with `eventBusDispatchToDOM = true` set, since then there's *two* different "localized" events being fired.
2019-09-13 12:38:36 +02:00
Jonas Jenwald
173fbef05b Enable the consistent-return ESLint rule
This rule is already enabled in mozilla-central, and helps ensure more consistent functions/methods, see https://searchfox.org/mozilla-central/rev/b9da45f63cb567244933c77b2c7e827a057d3f9b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js#119-120

Please see https://eslint.org/docs/rules/consistent-return for additional information.
2019-05-11 14:27:21 +02:00
Tim van der Meij
a020434b26
Include the code of conduct for pdfjs-dist too 2019-03-30 19:00:57 +01:00
Jonas Jenwald
24a688d6c6 Convert some usage of indexOf to startsWith/includes where applicable
In many cases in the code you don't actually care about the index itself, but rather just want to know if something exists in a String/Array or if a String starts in a particular way. With modern JavaScript functionality, it's thus possible to remove a number of existing `indexOf` cases.
2019-01-18 17:57:41 +01:00
Jonas Jenwald
842e9206c0 Replace String.prototype.substr() occurrences with String.prototype.substring()
As outlined in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr, which refers to the ECMA-262 specification, using the `substr` function is advised against.

Hence this PR, which replaces all remaining `substr` occurrences with `substring` instead. Please refer to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr#Syntax respectively https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring#Syntax for the differences between the two functions.

Note that in most cases in the code-base there's only one argument passed to `substr`, and those require no other changes except replacing "substr" with "substring". For the other cases, the `substr(start, length)` calls are changed to `substring(start, start + length)` instead.
2018-09-28 11:41:07 +02:00
Tim van der Meij
c454868be1
Fix duplicated function name in the Esprima fixtures
This makes `gulp externaltest` work again. It looks like this wasn't
validated before, but is now after recent package updates.
2018-08-25 16:23:20 +02:00
Jonas Jenwald
099ed08852 Add support for async/await using Babel
For proof-of-concept, this patch converts a couple of `Promise` returning methods to use `async` instead.
Please note that the `generic` build, based on this patch, has been successfully testing in IE11 (i.e. the viewer loads and nothing is obviously broken).

Being able to use modern JavaScript features like `async`/`await` is a huge plus, but there's one (obvious) side-effect: The size of the built files will increase slightly (unless `SKIP_BABEL == true`). That's unavoidable, but seems like a small price to pay in the grand scheme of things.

Finally, note that the `chromium` build target was changed to no longer skip Babel translation, since the Chrome extension still supports version `49` of the browser (where native `async` support isn't available).
2018-08-19 16:54:11 +02:00
Jonas Jenwald
36b683ca55 Provide custom messages for the no-restricted-globals ESLint rule, and refactor the .eslintrc files (PR 9868 follow-up)
Without providing useful (custom) error messages for the `no-restricted-globals` rule, see https://eslint.org/docs/rules/no-restricted-globals, it's quite likely that the rule will be incorrectly disabled rather than the required globals being imported as intended.

To reduced duplication of the `no-restricted-globals` rule in multiple `.eslintrc` files, it's instead moved to the top-level `.eslintrc` file and disabled as needed on a folder/file basis outside of `/src` and `/web`.
2018-07-23 14:10:13 +02:00
Tim van der Meij
31012570ea
Merge pull request #9868 from Snuffleupagus/url-polyfill
Stop exposing the `URL` polyfill in the global scope
2018-07-08 16:29:53 +02:00
Tim van der Meij
8a6b7373a0
Remove the jp-JP-mac locale
It gives warnings when running `gulp locale`, in a previous patch it was
explicitly asked to remove it and there is quite a bit of discussion
about the validity of the locale at
https://bugzilla.mozilla.org/show_bug.cgi?id=418485. In short, let's
remove it to prevent these issues.
2018-07-08 15:40:38 +02:00
Jonas Jenwald
a9ce4e8417 Stop exposing the URL polyfill in the global scope
This moves/exposes the `URL` polyfill similarily to the existing `ReadableStream` polyfill, rather than exposing it globally, to avoid interfering with any "outside" code.
Both the `URL` and `ReadableStream` polyfills are now exposed on the `pdfjsLib` object, such that they are accessible to the viewer components.
Furthermore, the `no-restricted-globals` ESLint rule is also enabled to prevent accidental usage of the native `URL`/`ReadableStream` implementations directly in the `src/` and `web/` folders; see also https://eslint.org/docs/rules/no-restricted-globals

Addresses the remaining TODO in https://github.com/mozilla/pdf.js/projects/6
2018-07-04 09:16:28 +02:00
Jonas Jenwald
8f0cc07116 Prevent the development viewer, started with gulp server, from breaking completely in Private Browsing mode
Since attempting to access `IndexedDB` in Private Browsing mode in Firefox will throw an error, see https://bugzilla.mozilla.org/show_bug.cgi?id=781982, the development viewer fails to load.
2018-07-03 13:26:01 +02:00
Tim van der Meij
5baec1eeb4
Update translations 2018-06-30 20:36:17 +02:00
Tim van der Meij
a816ee5c25
Upgrade to Webpack 4 2018-06-02 20:28:36 +02:00
Wojciech Maj
ea2850e9a7 Fix typos 2018-04-01 23:20:41 +02:00
Tim van der Meij
2247af7e95
Update translations
This required changing the import script in two ways:

- we should use the `default` branch and not the `tip` tag since the
  latter may refer to another branch than `default` (this is the case for
  the `vi` locale, which caused in the files to be overwritten with
  incorrect contents since `tip` referred to the
  `THUNDERBIRD600b1_2018031614_RELBRANCH` branch);
- we should check if the response code is indeed 200 because recently a
  script removed all empty localization files upstream (refer to
  https://bugzilla.mozilla.org/show_bug.cgi?id=1443175).
2018-03-17 16:31:04 +01:00
Jonas Jenwald
45adf33187 Move the workerPort from the global PDFJS object and into GlobalWorkerOptions instead 2018-02-16 13:22:35 +01:00
Jonas Jenwald
1cf116ab88 Enable the mozilla/use-includes-instead-of-indexOf ESLint rule globally
This rule is available from https://www.npmjs.com/package/eslint-plugin-mozilla, and is enforced in mozilla-central. Note that we have the necessary `Array`/`String` polyfills and that most cases have already been fixed, see PRs 9032 and 9434.
2018-02-10 23:24:50 +01:00
Jonas Jenwald
56a8c934dd [api-major] Remove the PDFJS.disableWorker option
Despite this patch removing the `disableWorker` option itself, please note that we'll still fallback to loading the worker file(s) on the main-thread when running in environments without proper Web Worker support.

Furthermore it's still possible, even with this patch, to force the use of fake workers by manually loading the necessary file using a `<script>` tag on the main-thread.[1]
That way, the functionality of the now removed `SINGLE_FILE` build target and the resulting `build/pdf.combined.js` file can still be achieved simply by adding e.g. `<script src="build/pdf.worker.js"></script>` to the HTML (obviously with the path adjusted as needed).

Finally note that the `disableWorker` option is a performance footgun, and unfortunately many existing third-party examples actually use it without providing any sort of warning/justification.

---

[1] This approach is used in the default viewer, since certain kind of debugging may be easier if the code is running directly on the main-thread.
2018-01-31 12:52:10 +01:00
Rob Wu
742ed3d1c9 Remove __pdfjsdev_webpack__, use webpack options
`__pdfjsdev_webpack__` was used to skip evaluating part of an AST,
in order to not mangle some `require` symbols.
This commit removes `__pdfjsdev_webpack__`, and:

- Uses `__non_webpack_require__` when one wants the output to
  contain `require` instead of `__webpack_require__`.
- Adds options to the webpack config to prevent "polyfills" for
  some Node.js-specific APIs to be added.
- Use `// eslint-disable-next-line no-undef` instead of `/* globals ... */`
  for variables that are not meant to be used globally.
2017-07-09 16:35:48 +02:00
Mukul Mishra
bbd9968f76 Added sendWithStream method in MessageHandler.
Adds functionality to accept Queueing Strategy in
sendWithStream method. Using Queueing Strategy we
can control the data that is enqueued into the sink,
and hence regulated the flow of chunks from worker
to main thread.

Adds capability in pull and cancel methods.
Adds ready and desiredSize property in streamSink.

Adds unit test for ReadableStream and sendWithStream.
2017-06-07 21:05:27 +05:30
Jonas Jenwald
4a906955c4 Fix the remaining cases of inconsistent spacing and trailing commas in objects, and enable the comma-dangle and object-curly-spacing ESLint rules
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing

*Please note:* This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.

```diff
diff --git a/gulpfile.js b/gulpfile.js
index d18b9c58..7d47fd8d 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -1247,7 +1247,8 @@ gulp.task('gh-pages-git', ['gh-pages-prepare', 'wintersmith'], function () {
   var reason = process.env['PDFJS_UPDATE_REASON'];

   safeSpawnSync('git', ['init'], { cwd: GH_PAGES_DIR, });
-  safeSpawnSync('git', ['remote', 'add', 'origin', REPO], { cwd: GH_PAGES_DIR, });
+  safeSpawnSync('git', ['remote', 'add', 'origin', REPO],
+                { cwd: GH_PAGES_DIR, });
   safeSpawnSync('git', ['add', '-A'], { cwd: GH_PAGES_DIR, });
   safeSpawnSync('git', [
     'commit', '-am', 'gh-pages site created via gulpfile.js script',
```
2017-06-03 23:35:37 +02:00
Jonas Jenwald
45933545f1 Merge pull request #8394 from yurydelendik/l10n
Wraps mozL10n to async calls; splits firefox and generic l10n libs.
2017-05-31 17:31:22 +02:00
Yury Delendik
5438ce9b98 Wraps mozL10n to async calls; splits firefox and generic l10n libs. 2017-05-31 09:22:25 -05:00
Yury Delendik
bd288df909 Merge pull request #8396 from mukulmishra18/streams-lib
Adds streams-lib polyfill and exports ReadableStream from shared/util.
2017-05-31 08:42:48 -05:00
Yury Delendik
66c8893815 Removes last UMDs from the modules. 2017-05-31 07:14:17 -05:00
Franck Freiburger
a0b7f84461 Update webpack.js to support browsers that do not have the Web Workers API 2017-05-26 22:02:07 +02:00
Jonas Jenwald
957dc40ddf Replace a couple of leftover make.js references with gulpfile.js in docs/comments
Also updates a `console.log` statement in the `gulp importl10n` command (since I forgot it in a previous patch, and it didn't seem necessary with a separate patch for it).
2017-05-19 23:45:54 +02:00
Yury Delendik
7b365b9372 Merge pull request #8366 from yurydelendik/rm-shelljs
Removes shelljs
2017-05-19 15:08:04 -05:00
Mukul Mishra
c9f44f30e5 Adds streams-lib polyfill and exports ReadableStream from shared/util.
Added test for ReadableStream.

Adds ref-implementation license-header in streams-lib
and change gulp task to copy external/streams/ in build/
external/streams/ and build/dist/external/streams folder.

Adds README.md and LICENSE.md
2017-05-20 00:26:34 +05:30
Yury Delendik
c0a1ff0b32 Removes CRLF checker 2017-05-19 07:53:34 -05:00
Yury Delendik
65a1e836cf Removes shelljs 2017-05-19 07:53:05 -05:00
Jonas Jenwald
044a115d6e Change the importl10n script to use the Nightly channel
It seems that PR 8323 unfortunately didn't pick the right channel for pulling translations from, according to the information in:
 - https://groups.google.com/forum/#!topic/mozilla.dev.l10n/vzmbHLPo3rg
 - https://github.com/mozilla-l10n/localizer-documentation/blob/master/misc/aurora_faqs.md

My apologies for the unnecessary churn in this code!
2017-05-18 12:35:05 +02:00
Rob Wu
b3bd2f3b38 Gracefully ignore transaction failure in plugin-babel-cached 2017-05-14 16:01:32 +02:00
Yury Delendik
996805f953 Produces source maps for built files. 2017-05-05 08:15:21 -05:00
Yury Delendik
c9d3c20e2c Fix esprima tests. 2017-05-04 08:24:44 -05:00
Yury Delendik
bbb2cc000e Adds babel caching for system.js. 2017-05-02 19:28:03 -05:00
Jonas Jenwald
7560f12a17 Enable the object-shorthand ESLint rule
Please see http://eslint.org/docs/rules/object-shorthand.

Unfortunately, based on commit 9276d1dcd9, it seems that we still need to maintain compatibility with old Node.js versions, hence certain files/directories that are executed in Node.js are currently exempt from this rule.

Furthermore, since the files specific to the Chromium extension are not run through Babel, the `/extensions/chromium/` directory is also exempt from this rule.
2017-04-30 11:13:34 +02:00
Yury Delendik
140dd0f15b Removes builder.build(). 2017-04-28 12:47:20 -05:00
Jonas Jenwald
57cd52303a Change the importl10n script to use the Beta channel, since Aurora is being removed
Since the Aurora channel is being removed, and is no longer going to be receiving updates (with the possible exception of security bugs), we need to change the target for the `gulp importl10n` command.

For more information, please refer to:
 - https://groups.google.com/forum/#!topic/firefox-dev/q4Eb5nEcfSg
 - https://hacks.mozilla.org/2017/04/simplifying-firefox-release-channels/
 - https://mozilla.github.io/process-releases/draft/development_overview/
 - http://release.mozilla.org/firefox/release/2017/04/17/Dawn-Project-FAQ.html
2017-04-22 16:24:52 +02:00
Yury Delendik
46646a9dd1 Merge pull request #8131 from timvandermeij/remove-umd-validation
ES6 modules: remove UMD header validation
2017-04-13 10:49:41 -05:00
Yury Delendik
25873e92f0 Enable babel translation to enable ES module support. 2017-03-27 07:25:09 -05:00
Tim van der Meij
5eb090f288
ES6 modules: remove UMD header validation
This patch is another step towards enabling Babel. Since we're moving
towards ES6 modules, we will not be using UMD headers anymore, so we can
remove the validation.
2017-03-04 21:43:25 +01:00
Yury Delendik
51767d63fe Init PDFWorker via MesssagePort. 2017-02-24 13:33:18 -06:00
Yury Delendik
a048519fa1 Replace copyright headers; changes UMD to CommonJS. 2017-02-08 16:35:58 -06:00
Yury Delendik
eb4c88cd44 Replacing custom bundling with webpack2. 2017-02-08 16:32:15 -06:00
Jonas Jenwald
52e0f51917 Enable the no-unused-vars ESLint rule
Please see http://eslint.org/docs/rules/no-unused-vars; note that this patch purposely uses the same rule options as in `mozilla-central`, such that it fixes part of issue 7957.

It wasn't, in my opinion, entirely straightforward to enable this rule compared to the already existing rules. In many cases a `var descriptiveName = ...` format was used (more or less) to document the code, and I choose to place the old variable name in a trailing comment to not lose that information.

I welcome feedback on these changes, since it wasn't always entirely easy to know what changes made the most sense in every situation.
2017-01-29 23:23:17 +01:00
Jonas Jenwald
3aa37ae8bc Add the external/builder/fixtures/ directory to .eslintignore, to avoid having to disable various lint rules locally
This is similar to the already existing exception for `external/builder/fixtures_esprima`.
2017-01-10 14:45:40 +01:00
Jonas Jenwald
fe9a561d45 Actually increment the errors counter on failures in test-fixtures.js/test_fixtures_esprima.js, so that the test runners won't incorrectly report that the tests passed 2017-01-10 14:45:36 +01:00
Jonas Jenwald
cf00516f04 Rename the external/builder/test*.js files to make it more obvious what they test
Currently you have to open the files to be certain which tests each one will run, which we can avoid by appending the directory names to the file names of the tests themselves.
2017-01-10 14:27:05 +01:00
Yury Delendik
6265bb6038 Fixes preprocessor testing and adds deadcode removal. 2017-01-09 19:05:36 -06:00
porlan1
d9e1cb7955 unit test files as UMD modules 2017-01-09 11:40:57 -05:00
Jonas Jenwald
c850968fa7 Remove globals that are now unnecessary thanks to the use of various ESLint environments (e.g. Node, ShellJS, Jasmine) 2016-12-16 21:09:55 +01:00
Jonas Jenwald
2f3805efbc Switch to using ESLint, instead of JSHint, for linting
*Please note that most of the necessary code adjustments were made in PR 7890.*

ESLint has a number of advantageous properties, compared to JSHint. Among those are:
 - The ability to find subtle bugs, thanks to more rules (e.g. PR 7881).
 - Much more customizable in general, and many rules allow fine-tuned behaviour rather than the just the on/off rules in JSHint.
 - Many more rules that can help developers avoid bugs, and a lot of rules that can be used to enforce a consistent coding style. The latter should be particularily useful for new contributors (and reduce the amount of stylistic review comments necessary).
 - The ability to easily specify exactly what rules to use/not to use, as opposed to JSHint which has a default set. *Note:* in future JSHint version some of the rules we depend on will be removed, according to warnings in http://jshint.com/docs/options/, so we wouldn't be able to update without losing lint coverage.
 - More easily disable one, or more, rules temporarily. In JSHint this requires using a numeric code, which isn't very user friendly, whereas in ESLint the rule name is simply used instead.

By default there's no rules enabled in ESLint, but there are some default rule sets available. However, to prevent linting failures if we update ESLint in the future, it seemed easier to just explicitly specify what rules we want.
Obviously this makes the ESLint config file somewhat bigger than the old JSHint config file, but given how rarely that one has been updated over the years I don't think that matters too much.

I've tried, to the best of my ability, to ensure that we enable the same rules for ESLint that we had for JSHint. Furthermore, I've also enabled a number of rules that seemed to make sense, both to catch possible errors *and* various style guide violations.

Despite the ESLint README claiming that it's slower that JSHint, https://github.com/eslint/eslint#how-does-eslint-performance-compare-to-jshint, locally this patch actually reduces the runtime for `gulp` lint (by approximately 20-25%).

A couple of stylistic rules that would have been nice to enable, but where our code currently differs to much to make it feasible:
 - `comma-dangle`, controls trailing commas in Objects and Arrays (among others).
 - `object-curly-spacing`, controls spacing inside of Objects.
 - `spaced-comment`, used to enforce spaces after `//` and `/*. (This is made difficult by the fact that there's still some usage of the old preprocessor left.)

Rules that I indend to look into possibly enabling in follow-ups, if it seems to make sense: `no-else-return`, `no-lonely-if`, `brace-style` with the `allowSingleLine` parameter removed.

Useful links:
 - http://eslint.org/docs/user-guide/configuring
 - http://eslint.org/docs/rules/
2016-12-16 21:06:36 +01:00
Jonas Jenwald
28e50cfa21 Fix errors reported by the space-infix-ops ESLint rule
http://eslint.org/docs/rules/space-infix-ops
2016-12-12 20:36:00 +01:00
Jonas Jenwald
aae27e76bb Fix errors reported by the no-multiple-empty-lines ESLint rule
http://eslint.org/docs/rules/no-multiple-empty-lines
2016-12-12 20:35:58 +01:00
Jonas Jenwald
6606540fe4 Fix errors reported by the func-call-spacing ESLint rule
http://eslint.org/docs/rules/func-call-spacing
2016-12-12 20:35:54 +01:00
Yury Delendik
a4402c84de Refactor toolbar (and secondary toolbar). 2016-11-18 12:51:15 -06:00
Jonas Jenwald
4f1cccb138 Enable removing of all comments (except for Copyright notices) when preprocessing code, and reduce the indentation level 2016-11-11 22:05:17 +01:00
Tim van der Meij
978b214c92 Lint: do not ignore external/importL10n as it is one of our components 2016-11-01 14:43:38 +01:00
Yury Delendik
bf52ff156d Adds esprima-based preprocessor. 2016-10-14 08:33:22 -05: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
Yury Delendik
a4c81c203b Enables debugger only when needed. 2016-05-09 18:18:43 -05:00
Yury Delendik
fe6001363d Moves all testing into gulpfile. 2016-05-02 09:58:29 -05:00
Yury Delendik
76aa687548 Makes importl10n and server async gulp functions. 2016-04-22 17:23:25 -05:00
Yury Delendik
006e8fb59d Introduces UMD headers to the web/ folder. 2016-04-13 10:09:48 -05:00
Yury Delendik
118b71925c Forces UMD header to have relative path and extension for CommonJS. 2016-04-02 11:10:36 -05:00
Yury Delendik
0a700fa29d Updates Jasmine version. 2016-03-29 09:34:13 -05:00
Jonas Jenwald
41e5fa3c7a Use the correct path when checking if a /l10n directory exists, to avoid errors during gulp importl10n (PR 7063 followup)
This is regression from PR 7063, causing `gulp importl10n` to fail:
```
$ gulp importl10n
[19:45:02] Using gulpfile c:\Users\Jonas\Git\pdfjs\gulpfile.js
[19:45:02] Starting 'importl10n'...

Downloading ach...
[19:45:02] 'importl10n' errored after 4.42 ms
[19:45:02] Error: EEXIST, file already exists 'c:\Users\Jonas\Git\pdfjs\l10n\ach
'
    at Error (native)
    at Object.fs.mkdirSync (fs.js:747:18)
    at downloadLanguageFiles (c:\Users\Jonas\Git\pdfjs\external\importL10n\local
es.js:59:8)
    at next (c:\Users\Jonas\Git\pdfjs\external\importL10n\locales.js:90:5)
    at Object.downloadL10n (c:\Users\Jonas\Git\pdfjs\external\importL10n\locales
.js:91:5)
    at Gulp.<anonymous> (c:\Users\Jonas\Git\pdfjs\gulpfile.js:92:11)
    at module.exports (c:\Users\Jonas\Git\pdfjs\node_modules\gulp\node_modules\o
rchestrator\lib\runTask.js:34:7)
    at Gulp.Orchestrator._runTask (c:\Users\Jonas\Git\pdfjs\node_modules\gulp\no
de_modules\orchestrator\index.js:273:3)
    at Gulp.Orchestrator._runStep (c:\Users\Jonas\Git\pdfjs\node_modules\gulp\no
de_modules\orchestrator\index.js:214:10)
    at Gulp.Orchestrator.start (c:\Users\Jonas\Git\pdfjs\node_modules\gulp\node_
modules\orchestrator\index.js:134:8)
```
2016-03-20 20:02:43 +01:00
Tim van der Meij
96cca2b37a Migrate clean and importl10n target to gulp 2016-03-04 21:14:56 +01:00
Yury Delendik
cbbb9bb82d Adds UMD header to pdf.js and pdf.worker.js files. 2015-12-29 18:15:14 -06:00
Yury Delendik
fc3282db56 Adds RequireJS to worker. 2015-12-29 09:20:52 -06:00
Yury Delendik
85e95d34ed Use RequireJS in the viewer, examples and tests. 2015-12-29 09:20:52 -06:00
Tim van der Meij
df81b832bb Remove unused variables 2015-12-16 23:52:16 +01:00
Yury Delendik
450edc95cc UMD validation and generation tools. 2015-12-15 13:24:39 -06:00
Manas
a2ba1b8189 Uses editorconfig to maintain consistent coding styles
Removes the following as they unnecessary
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
2015-11-14 07:32:18 +05:30
Rob Wu
f8af4d6567 Fix preprocessor: nesting, error & tests
Features / bug fixes in the preprocessor:

- Add word boundary after regex for preprocessor token matching.
  Previously, when you mistakenly used "#ifdef" instead of "#if", the
  line would be parsed as a preprocessor directive (because "#ifdef"
  starts with "#if"), but without condition (because "def" does not
  start with a space). Consequently, the condition would always be false
  and anything between "#ifdef" and "#endif" would not be included.

- Add validation and error reporting everywhere, to aid debugging.

- Support nested comments (by accounting for the whole stack of
  conditions, instead of only the current one).

- Add #elif preprocessor command. Could be used as follows:
  //#if !FEATURE_ENABLED
  //#error FEATURE_ENABLED must be set
  //#endif

- Add #error preprocessor command.

- Add end-of-line word boundary after "-->" in the comment trimmer.
  Otherwise the pattern would also match "-->" in the middle of a line,
  and incorrectly convert something like "while(i-->0)" to "while(i0)".

Code health:

- Add unit tests for the preprocessor (run external/builder/test.js).

- Fix broken link to MDN (resolved to DXR).

- Refactor to use STATE_* names instead of magic numbers (the original
  meaning of the numbers is preserved, with one exception).

- State 3 has been split in two states, to distinguish between being in
  an #if and #else. This is needed to ensure that #else cannot be
  started without an #if.
2015-07-19 14:47:28 +02:00
Rob Wu
8ba73cb4de Improve getWorkerSrcFiles (builder.js)
It took a while to figure out why adding comments in worker_loader.js
caused the build to fail, because getWorkerSrcFiles did not print an
error message when it failed to parse the file. These issues have been
resolved as follows:

- Leading comments are stripped.
- The trailing comma is removed from the array.
- Errors are detected and useful error messages are printed.
2015-07-19 14:47:28 +02:00
Mike Corbin
979c108577 Remove unused require() directive
This had the undesirable side-effect of invoking make's command-line argument
parser upon inclusion.
2015-05-15 18:01:33 +01:00
Tim van der Meij
70b6eb09a8 Remove ShellJS copy and use the NPM version
There is no need to have a copy of ShellJS in the repository as it is also available on NPM. The NPM version is also much newer. This way we do not have to update this anymore and let NPM do that automatically.
2015-04-05 15:47:25 +02:00
Tim van der Meij
0ab5bb4b42 Fixes minor typo from #5826 2015-03-11 21:09:03 +01:00
Rob Wu
537216b872 [webL10n] Apply PDF.js-specific changes 2015-03-10 16:13:25 +01:00
Rob Wu
f20c5ddf99 Update to latest version of webL10n
New commits since last update:
- b5e072c...7d351d51b1
- Plus unmerged patch from PDF.js: https://github.com/fabi1cazenave/webL10n/pull/62

(the PDF.js-specific changes will be applied in a separate commit)
2015-03-10 16:11:59 +01:00
Rob Wu
ac5a8bcdda [l10n] Treat language as case-insensitive
See "Case-insensitive language comparisons per RFC 4646"
https://github.com/fabi1cazenave/webL10n/pull/51

Removed the "patch" in compatibility.js and fixed the bug in webL10n,
because the logic belongs to webL10n instead of PDF.js.
The immediate motivation for this patch is that Chrome 40 converts
navigator.language to lower case: https://crbug.com/454331
2015-02-02 22:02:18 +01:00
araghava
e2c001c19d [issue 5440] fix rtl direction bug for full language codes 2014-10-26 17:16:56 -04:00
Yury Delendik
5b93cc102c Adds css import preprocessing 2014-09-30 08:11:43 -05:00
Yury Delendik
10f702f60e Adds readme file for the pdfjs-dist repo. 2014-09-24 07:10:09 -05:00
Tim van der Meij
c29faaa22d Use strict equalities in make.js, external/* and extensions/* 2014-08-01 22:27:00 +02:00
Yury Delendik
812c5accb2 Making sure we are not importing CRs and BOMs 2014-05-28 08:25:27 -05:00
Tim van der Meij
a762c9f3c6 Removing old TODOs and comments from jasmine.js 2014-05-08 22:45:30 +02:00
Thorben Bochenek
e8f0700bfa Move the colour conversion to jpg.js
Benchmarking shows that this improves performance for the invitation document
from https://github.com/mozilla/pdf.js/issues/3809 by 35%
2014-04-24 15:07:12 +02:00
Thorben Bochenek
e7fe45a5c4 Refactor jpg.js and include forceRGBoutput, correct style of image.js
This refactors getData to be more readable and extracts all the color
conversion algorithms to their own functions. The resulting code was then
cleaned up.
This also introduces a flag `forceRGBoutput` to getData, that allows to always
get the data as a `width * height * 3` bytes long RGB buffer
2014-04-24 12:55:37 +02:00
Christian Krebs
5a49d2eb83 Create the WORKER_SRC_FILES and EXT_SRC_FILES lists in make automatically 2014-04-09 21:02:13 +02:00
Yury Delendik
5fc806823e Merge pull request #4504 from timvandermeij/importl10n
Import l10n files from mozilla-aurora
2014-03-26 17:52:45 -05:00
Tim van der Meij
c6f009403d Implements importl10n command 2014-03-26 23:48:02 +01:00
Thorben Bochenek
7bf0987810 Fixes for small colour variations in tests
https://github.com/notmasteryet/jpgjs/pull/24
2014-03-25 19:04:02 -05:00
Thorben Bochenek
2d99ff3f37 Fix for the offByOne-error and small performance optimisations 2014-03-21 09:16:40 -05:00
Thorben Bochenek
03892a85c2 jpgjs performance improvements
see https://github.com/notmasteryet/jpgjs/pull/22
2014-03-20 18:02:08 -05:00
Brendan Dahl
68be273c69 Merge pull request #4470 from yurydelendik/packcmap
CMaps binary packing
2014-03-17 12:27:35 -07:00
Yury Delendik
1d8f6cf0e7 Updates make.js for cmaps and make binary cmaps by default 2014-03-17 13:30:43 -05:00
Yury Delendik
734d6f346e Removes external/cmaps; adds binary cmaps to the repo 2014-03-17 13:30:27 -05:00
Yury Delendik
3e8ea958ae Quick notes about the format 2014-03-14 16:59:40 -05:00
Yury Delendik
69efd9cb96 CMaps binary packing 2014-03-14 16:46:35 -05:00
Jonas Jenwald
4f6b363b2c Fix coding style in external/builder/builder.js 2014-03-14 12:53:12 +01:00
Yury Delendik
7963f22545 Merge pull request #4259 from brendandahl/built-in-cmaps-squash
Adds built in CMaps and unifies the glyph mapping.
2014-03-13 10:27:48 -05:00
Mitar
2c82e720b8 Updated to current latest stable version of jshint. 2014-03-01 13:31:25 -08:00
Brendan Dahl
cc46cea7cb Merge pull request #4262 from yurydelendik/issue4257
Removes -moz-box-sizing usage
2014-02-24 12:47:27 -08:00
fkaelberer
e874b272bf jpgjs performance tuning 2014-02-18 09:24:59 -06:00
Gabriele Svelto
f4d54517c4 Bug 972435 - Recompress all PNG assets 2014-02-13 17:57:10 +01:00
Brendan Dahl
7be2d6db58 Add adobe CMaps. 2014-02-11 10:26:46 -08:00
Yury Delendik
894c82cec9 Removes -moz-box-sizing usage 2014-02-10 15:06:03 -06:00
Rob Wu
9f4745fd3f webL10n: Apply PDF.js-specific changes
Based on http://pastebin.mozilla.org/3061694

1. Remove "debug helpers" and use console.log/console.warn directly (top).
2. Remove page load initialization (middle).
3. Remove window._ alias (bottom)

The original diff contained an extra entry
"Adds fallback argument to the getL10nData;",
but this was already implemented in the rebased webL10n, so it's no
longer PDF.js-specific.
2013-09-15 15:31:37 +02:00
Rob Wu
d0d3b071ec Update webL10n to latest version + features
Base version of l10n:
- https://github.com/fabi1cazenave/webL10n/tree/b18c753c6f
4 extra commits (expected to be accepted):
- https://github.com/fabi1cazenave/webL10n/pull/38

New features compared to mozL10n:
- Support for getting translated attributes in get()

The previous version of mozL10n was based on:
- https://github.com/fabi1cazenave/webL10n/commits/0c06867a75
- diff: http://pastebin.mozilla.org/3061694

To make it easier to update webL10n in the future, I will apply
the PDF.js-specific changes in a separate commit.
2013-09-15 15:13:47 +02:00
Yury Delendik
56ea1e08e6 Fixes typo in 2-component image decoding 2013-08-19 08:43:17 -05:00
Brendan Dahl
6b9c272590 Merge pull request #3457 from yurydelendik/remove-prefixes
Removes foreign for Firefox CSS prefixes
2013-07-16 16:08:05 -07:00
Yury Delendik
2ab481a1da Removes foreign for Firefox CSS prefixes 2013-07-09 17:23:20 -05:00
Yury Delendik
5e5b66f688 Removes browser decoding optimization for JPEG CMYK 2013-07-02 09:46:14 -05:00
Yury Delendik
71c67976af Implements FFC1 marker (and syncs with jpgjs) 2013-06-25 12:35:34 -05:00
Yury Delendik
0a27f18bfe Updates shell.js to v0.1.2 2013-03-07 10:43:23 -06:00
Jon Buckley
c226147d09 Issue #2008 - Fix lint errors for external/crlfchecker/ 2013-01-31 19:12:46 -05:00
Jon Buckley
10cdb48f36 Issue #2008 - Fix lint errors for external/builder/ 2013-01-31 19:12:46 -05:00
Yury Delendik
e5247e4895 Updates webL10n; using viewer.properties as is 2012-11-29 14:02:33 -06:00
Pimm Hogeling
438e3c8f6d Fixes for subtile bugs that were introduced in 59283bdf6d and 99440ab691, among others. 2012-08-31 13:37:44 +02:00
Yury Delendik
ac0ae3e5fd Merges new jpgjs: fixes invalid JPEG marker. 2012-08-23 16:12:33 -05:00
Yury Delendik
da861bef30 Merge pull request #2009 from kkujala/dev
Correct gjslint warnings in builder.js.
2012-08-22 05:16:16 -07:00
Kalervo Kujala
7bbf65f56e Correct gjslint warnings in builder.js. 2012-08-22 12:48:47 +03:00
Kalervo Kujala
2ffd3ae1c7 Create crlfchecker module and use it in make.js.
Provide names of the files that contain crlf in the output.
Exit(1) is used instead of throw.
2012-08-20 20:42:21 +03:00
Brendan Dahl
e0a6b233dc Move builder/preprocessor into its own file. 2012-08-01 14:27:42 -07:00
Yury Delendik
89156cec89 Fallback locale string for JS code; simplify locale embedding for the extension 2012-05-04 08:37:08 -05:00
Yury Delendik
7f98f77354 Allow fallback on langauge group; change localized text 2012-05-02 15:03:06 -05:00
Yury Delendik
32e9eb35fe Using web browsers locale in the extension mode 2012-05-01 20:37:03 -05:00
Yury Delendik
00543a1c89 Embed locale.properties in the viewer.html for extension 2012-04-30 21:55:21 -05:00
Yury Delendik
29bde9d528 Merge remote-tracking branch 'mozilla/master' into l10n-1
Conflicts:
	web/viewer.html
2012-04-30 18:32:37 -05:00
Yury Delendik
7859ba89c3 Missing webL10n library files 2012-04-30 15:33:37 -05:00
Yury Delendik
244ce870c3 Updates jpgjs libary to the latest: component order fix 2012-04-28 08:59:05 -05:00
Brendan Dahl
e18a2c512e Use test.py for unit tests too. 2012-04-19 12:32:24 -07:00
Artur Adib
c0289497ec bumping ShellJS 2012-03-28 18:03:31 -04:00
Artur Adib
a0a5c58894 Upgrading ShellJS, introducing 'makeref' 2012-03-26 16:33:00 -04:00
Artur Adib
c3bdf1e037 adding new find() commands 2012-03-14 17:50:49 -04:00
Artur Adib
f6ba3843bd Using ShellJS 2012-03-03 14:01:31 -05:00
Kalervo Kujala
9962d9abe4 Remove now obsolete jasmine files related to unit_test.html. 2011-12-12 22:37:26 +02:00
Kalervo Kujala
1a119bcb08 Make unit tests runnable from command line. 2011-11-24 00:03:17 +02:00
Brendan Dahl
faa202df1e Merge upstream and change test pdf file. 2011-11-22 10:39:26 -08:00
Brendan Dahl
b64b7d55b1 Use the updated jpgjs with faster transform. 2011-11-22 09:32:20 -08:00
Brendan Dahl
7a5556ca91 Add license. 2011-11-21 09:35:36 -08:00
Kalervo Kujala
1b0ccad5b0 Add jasmine license file. 2011-11-20 21:29:54 +02:00
Kalervo Kujala
624a7a74ea Add jasmine files to external-directory. 2011-11-20 21:16:47 +02:00