Commit Graph

153 Commits

Author SHA1 Message Date
Tim van der Meij
a816ee5c25
Upgrade to Webpack 4 2018-06-02 20:28:36 +02:00
Tim van der Meij
32de419a88
Remove the gulp extension build target 2018-06-02 19:56:09 +02:00
Brendan Dahl
548b4ca208 Fix webpack exclude path on windows. 2018-05-29 17:43:02 -07:00
Abhimanyu Vashisht
58612f869a Replace deprecated new Buffer(string) constructor with Buffer.from(string) 2018-05-20 20:42:50 +05:30
Wojciech Maj
acd1fa4c4f Configure Autoprefixer 2018-04-04 23:02:26 +02:00
Wojciech Maj
ed67c1d6aa Introduce autoprefixer to gulp process 2018-04-04 00:26:01 +02:00
Brendan Dahl
121e43685f Remove the Firefox extension building code.
Firefox no longer supports this legacy extension and it is a pain to
sync changes from here and mozilla central.
2018-03-30 16:27:50 -07:00
Tim van der Meij
6cc0efe1cc
Merge pull request #9576 from timvandermeij/versions
Update packages
2018-03-25 17:52:26 +02:00
Tim van der Meij
95de23e6e3
Update packages
Jasmine had a major version bump and required a few minor changes in our
booting code. Most notably, using `pending` in a `describe` block is no
longer supported, so we can only return early there. On the positive
side, the unit tests now run in a random order by default, which
eliminates any dependencies between unit tests.

Note that upgrading to Webpack 4 is out of scope for this patch since
the bots cannot work well with the newly generated bundles (both
browsers on both bots do not react within 120 seconds). Webpack 4 is not
faster for us than Webpack 3, so for now there is no need to upgrade.
2018-03-25 16:59:50 +02:00
Brendan Dahl
0aa31a493b Add new line to default preferences. 2018-03-20 16:36:37 -07:00
Brendan Dahl
63c7aee112
Merge pull request #9565 from brendandahl/new-name
Rename the globals to shorter names.
2018-03-20 13:49:04 -07:00
Brendan Dahl
01bff1a81d Rename the globals to shorter names.
pdfjsDistBuildPdf=pdfjsLib
pdfjsDistWebPdfViewer=pdfjsViewer
pdfjsDistBuildPdfWorker=pdfjsWorker
2018-03-16 11:08:56 -07:00
Jonas Jenwald
76250b923f [Firefox addon] Refactor bundling of the default_preferences.json file 2018-03-16 16:46:57 +01:00
Jonas Jenwald
b8606abbc1 [api-major] Completely remove the global PDFJS object 2018-03-01 18:13:27 +01:00
Rob Wu
9d55a1edc7 Ignore managed prefs documented as "Deprecated."
Deprecated keys are removed from web/default_preferences.json,
but still maintained in managed_preferences.json.
2018-02-22 14:40:30 +01:00
Jonas Jenwald
c56f3f04dd [api-major] Remove the SINGLE_FILE build target
Please note that this build target, and the resulting `build/pdf.combined.js` file, is equivalent to setting the `PDFJS.disableWorker` option to `true` which is a performance footgun.
2018-01-29 14:44:44 +01:00
Jonas Jenwald
0e1b5589e7 Restore the btoa/atob polyfills for Node.js
These were removed in PR 9170, since they were unused in the browsers that we'll support in PDF.js version `2.0`.
However looking at the output of Travis, where a subset of the unit-tests are run using Node.js, there's warnings about `btoa` being undefined. This doesn't appear to cause any errors, which probably explains why we didn't notice this before (despite PR 9201).
2018-01-13 01:31:05 +01:00
Tim van der Meij
d688b8ea31
Stop using the deprecated gulp-util module
The `gulp-util` module is now deprecated and authors are asked to stop
using it (refer to https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5 for
more information).

PDF.js does not rely on it that much, fortunately, so it's relatively
easy for us to remove the dependency. This patch does that by making the
following changes:

- Require `gulp-zip` version 4.1.0 or higher since they already removed
  their `gulp-util` dependency in that version.
- Replace `gulp-util.log` with the `fancylog` module as recommended in
  the article above.
- Replace `gulp-util.File` with the `Vinyl` module as recommended in the
  article above.

The only change I had to make for Vinyl is removing the `base` and `cwd`
lines since they may not be empty strings anymore. This way we fall back
to the defaults Vinyl provides, which for us doesn't matter since we
move the file afterwards anyway. Moreover, I used `vfs` for `vinyl-fs`
in the `Gulpfile` to avoid confusion with `vinyl` (which is also how the
documentation names the variable).

This is all we can do on our side; the other modules that still use
`gulp-util` must be updated upstream.
2017-12-30 20:13:52 +01:00
Soumya Himanish Mohapatra
95ad956f68 PDFjs now compatible with Librejs 2017-12-19 15:13:50 +05:30
Michaël De Boey
e3324d45bc
'worker-loader' requires 'webpack' as peerDependency 2017-12-07 23:10:12 +01:00
Jonas Jenwald
f0c98a7ab0 [api-major] Stop bundling, and also remove, the web/compatibility.js file in pdfjs-dist
As suggested in PR 8102.
2017-10-31 22:32:43 +01:00
Yury Delendik
b4e25fb2e8 Merge remote-tracking branch 'mozilla/version-2.0' into v2 2017-10-27 14:01:45 -05:00
Tim van der Meij
7d7edd9cc6
[api-major] Remove the PDFJS_NEXT option
Nothing uses this option anymore, so setting it is a no-op now. We can
safely remove it.

Use `SKIP_BABEL` (instead of `PDFJS_NEXT`) now if you want to skip Babel
translation for a build.
2017-10-16 23:16:51 +02:00
Jonas Jenwald
04b46831c1 Enable the --report-unused-disable-directives ESLint command line option
This option was added in [version `4.8.0` of ESLint](https://github.com/eslint/eslint/releases/tag/v4.8.0), which is already listed as the minimum version in our `package.json` file; please refer to https://eslint.org/docs/user-guide/command-line-interface#--report-unused-disable-directives for additional details.

Despite the caveat listed in the link above, I still think that using this option makes sense since it will help ensure that no longer necessary disable statements are removed.
2017-10-15 13:45:12 +02:00
Tim van der Meij
0733b54e10
Update all packages to the most recent version
To support this, the following changes have to be made as well:

- Ignore `package-lock.json` since NPM creates it, but we should not
  have it in the repository.
- Switch from `babel-preset-es2015` to `babel-preset-env` to resolve
  the deprecation warning in the test logs. The latter is more recent
  and flexible, but should be the same functionality-wise.
- `transform` now needs to have the `utf-8` encoding option provided.
  If not given, it will call the callback with a `Buffer` object,
  which results in an unhandled promise rejection since what is
  returned from the callback is a string, not a `Buffer`.
2017-09-30 16:26:24 +02:00
Jonas Jenwald
1a3c6f7d9a Simplify the disabling of Node polyfills, in gulpfile.js, since we're now using Webpack 3.x
Webpack was updated a while back, but we apparently forgot to update `gulpfile.js` as well.
2017-09-29 21:45:14 +02: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
Jonas Jenwald
70e80322da Update the gulp minified command to use uglify-es
By updating to uglify-es, rather than uglify-js, the minifier *itself* now supports ES6 code. This means that it's now possible to minify code built with `PDFJS_NEXT = true` set, i.e. with Babel transpilation disabled, which wasn't the case previously.

Note that uglify-es is based on the API of uglify-js v3, which differs from the one that we previously used.
Of particular importance is the fact that it's no longer possible to provide a path to a file for minification, but one must instead directly provide the source of the file.

For more information, please see https://github.com/mishoo/UglifyJS2/tree/harmony
2017-08-27 15:31:04 +02:00
Yury Delendik
4e6ae18f19 Disable node libs in pdfjs-dist package.json 2017-08-24 10:57:18 -05:00
Yury Delendik
57bc3296f4 Moves global scope out of shared/util. 2017-08-22 18:20:52 -05:00
Yury Delendik
01b47d9012 Use streams-lib as polyfill 2017-07-28 11:54:33 -05:00
Rob Wu
01f03fe393 Optimize PNG compression in SVG backend on Node.js
Use the environment's zlib implementation if available to get
reasonably-sized SVG files when an XObject image is converted to PNG.
The generated PNG is not optimal because we do not use a PNG predictor.
Futher, when our SVG backend is run in a browser, the generated PNG
images will still be unnecessarily large (though the use of blob:-URLs
when available should reduce the impact on memory usage). If we want to
optimize PNG images in browsers too, we can either try to use a DEFLATE
library such as pako, or re-use our XObject image painting logic in
src/display/canvas.js. This potential improvement is not implemented by
this commit

Tested with:

- Node.js 8.1.3 (uses zlib)
- Node.js 0.11.12 (uses zlib)
- Node.js 0.10.48 (falls back to inferior existing implementation).
- Chrome 59.0.3071.86
- Firefox 54.0

Tests:

Unit test on Node.js:

```
$ gulp lib
$ JASMINE_CONFIG_PATH=test/unit/clitests.json node ./node_modules/.bin/jasmine --filter=SVG
```

Unit test in browser: Run `gulp server` and open
http://localhost:8888/test/unit/unit_test.html?spec=SVGGraphics

To verify that the patch works as desired,

```
$ node examples/node/pdf2svg.js test/pdfs/xobject-image.pdf
$ du -b svgdump/xobject-image-1.svg
 # ^ Calculates the file size. Confirm that the size is small
 #   (784 instead of 80664 bytes).
```
2017-07-10 18:56:57 +02: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
Yury Delendik
a18caa730d Adds gulp dist-install command; using pdfjs-dist package in examples. 2017-06-12 10:22:16 -05:00
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
Jonas Jenwald
7d3a3252b5 Allow specifying the PDFJS_NEXT build flag via an environment variable when running the various gulp commands
After PR 8459, the run-time of the various `gulp` test commands has regressed quite badly on Windows. For me, `gulp test` now takes approximately *twice* as long when run locally on Windows.
The problem seems to be the Babel transpilation step, which takes well over five minutes to run.[1]

For someone like me, who runs tests a lot locally, this slowdown is really hurting the overall development experience.
To get around this I tested setting `PDFJS_NEXT = true` in `gulpfile.js`, since the transpilation step isn't necessary when testing in a modern browser.

However, having to edit `gulpfile.js` every time that I need to run tests isn't very practical. Hence this patch, which adds an environment variable that allows you to disable the transpilation simply by using e.g. `PDFJS_NEXT=true gulp test`.

I hope that this can be considered an acceptable solution, such that I don't need to maintain this patch locally (or worse, edit `gulpfile.js` locally before testing).

---
[1] This can also be observed on the Windows bot, but it seems fine on Linux.
2017-05-31 14:50:49 +02:00
Yury Delendik
66c8893815 Removes last UMDs from the modules. 2017-05-31 07:14:17 -05:00
Yury Delendik
b66b705ed7 Using pre-built code for testing. 2017-05-30 22:06:21 +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
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
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
2ac410625b Fixes shell parameters quoting after #8349 2017-05-03 08:17:31 -05:00
Tim van der Meij
0c99429291 Merge pull request #8349 from timvandermeij/remove-make
Migrate `make.js` to `gulpfile.js`
2017-05-02 01:12:56 +02:00
Tim van der Meij
f748407b26
Remove make.js and the target fetching in gulpfile.js
Note that we have to use `fs.writeFileSync` since `.to()` is not
available anymore. Moreover, introduce `safeSpawnSync` to make sure that
we check the return codes of the spawned processes properly.
2017-05-02 01:00:52 +02:00
Tim van der Meij
145c0cea39
Remove unused Gulp target for testing
To run the regression tests, developers use `gulp browsertest` and the
bot uses `gulp bottest`. We're not passing the `noreftest` option
anywhere in the code (probably because the `bottest` command takes care
of this already), so we should remove this.
2017-05-02 00:47:53 +02:00
Tim van der Meij
19cc9bcded
Port the mozcentraldiff target to Gulp 2017-05-02 00:47:51 +02:00
Tim van der Meij
74854fb4cc
Port the mozcentralbaseline target to Gulp
The baseline fix is dead code since three years, so we can safely remove
it.
2017-05-02 00:45:52 +02: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
Yury Delendik
9276d1dcd9 Allow older versions on node.js to run gulpfile. 2017-04-28 09:20:21 -05:00
Jonas Jenwald
b3582ccbad Add the commit hash to the README.mozilla file (issue 8347) 2017-04-27 23:01:22 +02:00
Jonas Jenwald
ae04cf1c37 Enable running the ui_utils unit-tests on Travis
With the exception of just one test-case, all the current `ui_utils` unit-tests can run successfully on Node.js (since most of them doesn't rely on the DOM).

To get this working, I had to first of all add a new `LIB` build flag such that `gulp lib` produces a `web/pdfjs.js` file that is able to load `pdf.js` successfully.
Second of all, since neither `document` nor `navigator` is available in Node.js, `web/ui_utils.js` was adjusted slightly to avoid errors.
2017-04-25 13:37:56 +02:00
Jonas Jenwald
a77130a0c2 Remove the signchromium target from make.js
According to the IRC discussion starting at http://logs.glob.uno/?c=mozilla%23pdfjs&s=18+Apr+2017&e=18+Apr+2017#c59676, and in particular http://logs.glob.uno/?c=mozilla%23pdfjs&s=18+Apr+2017&e=18+Apr+2017#c59682, this build target is unused and can thus be removed.
2017-04-19 23:13:16 +02:00
Yury Delendik
1d30cea914 Moves dist and minifiedpost tragets from make.js. 2017-04-18 14:00:53 -05:00
Tim van der Meij
27c3c33eec Merge pull request #8288 from yurydelendik/mv-make-web
Moves 'web' target to the gulpfile.
2017-04-15 00:03:29 +02:00
Yury Delendik
89df5ef033 Moves 'web' target to the gulpfile. 2017-04-14 16:57:53 -05:00
Yury Delendik
5855c0a8be Allow to convert (some of) ES6 code to ES5. 2017-04-14 14:39:25 -05: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
Georg Fritzsche
4e8cd2b7d3 Rename PdfJsTelemetry-addon.jsm to PdfJsTelemetry-stub.jsm
And remove unused linting comments.
2017-04-12 13:11:04 +02:00
Yury Delendik
31f8875614 Merge pull request #8157 from Snuffleupagus/api-RenderTask-cancel-Error
[api-minor] Reject the `RenderTask` with an actual `Error`, instead of just a `string`, when rendering is cancelled
2017-04-04 09:38:47 -05:00
Andrew McCreight
d804881151 Split bootstrap script.
pdfjschildbootstrap.js will always be run, but
pdfjschildbootstrap-enabled.js will only be run if PdfJs.enabled is
true. This will let us avoid some work in the child process in the
next patch.

This will need to be landed in the mozilla-central repository at the
same time as a change to nsBrowserGlue.js. See bug 1352218.
2017-03-31 13:22:39 -07:00
Yury Delendik
25873e92f0 Enable babel translation to enable ES module support. 2017-03-27 07:25:09 -05:00
Jonas Jenwald
6d672c4ba6 [api-minor] Add a pdfjsNext parameter, and PDFJS_NEXT build flag, to allow backwards incompatible API changes 2017-03-13 18:43:43 +01: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
Jonas Jenwald
af44ef15f7 Don't include web/compatibility.js in the output for gulp lib (PR 8120 follow-up)
First of all, `compatibility.js` is already available in `lib/shared/compatibility.js`. Second of all, as can be seen in 9142301f35 (diff-9432ebaa58e10ab02874fcb86f689caa), the `lib/web/compatibility.js` file cannot work since the `require` statement isn't compatible with the output of `gulp lib`.
2017-03-04 18:34:28 +01:00
Yury Delendik
39e8ad24f7 Creates 'lib' for the 'dist' build target. 2017-03-03 16:37:58 -06:00
Brendan Dahl
8be4db1c34 Add gulp task to generate refs. 2017-02-24 16:59:01 -08:00
Yury Delendik
facefb0c79 Move compatibility code to the shared/compatibility.js. 2017-02-23 19:18:44 -06:00
Tim van der Meij
cada411af4 Merge pull request #8091 from timvandermeij/gulp-baseline
Gulp: migrate `baseline` target from `make.js`
2017-02-22 00:31:43 +01:00
Tim van der Meij
0f4e6fdb9d
Gulp: migrate baseline target from make.js 2017-02-21 23:50:57 +01:00
Jonas Jenwald
2aaeb17037 Include the pdfjschildbootstrap.js file in the output for gulp mozcentral builds (PR 8023 follow-up)
*Yet another thing that I unfortunately missed during review of PR 8023.*

Note that previously, in `make.js` this file was being preprocessed, however as far as I can tell that wasn't actually necessary. Hence this patch just copies the file to the proper output directory.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1338395#c8.
2017-02-13 23:25:54 +01:00
Jonas Jenwald
991c7c196d Write the l10n files to the correct destination for gulp mozcentral builds (PR 8023 follow-up)
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1338395#c2.
2017-02-10 11:46:14 +01:00
Yury Delendik
0759066be0 Saving old-style JS module name of dist libraries. 2017-02-08 16:48:37 -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
Yury Delendik
a5ad2b166b Moves sed processing into the preprocessing tasks and merging tasks. 2017-02-07 08:53:33 -06:00
Jonas Jenwald
bc736fdc7d Adjust the brace-style ESLint rule to disallow single lines (and also enable no-iterator)
See http://eslint.org/docs/rules/brace-style.
Having the opening/closing braces on the same line can often make the code slightly more difficult to read, in particular for `if`/`else if` statements, compared to using new lines.

This patch also, for consistency with `mozilla-central`, enables the [`no-iterator`](http://eslint.org/docs/rules/no-iterator) rule. Note that this rule didn't require a single code change.
2017-02-04 15:53:08 +01:00
Yury Delendik
2049cf01db Moves preprocessor stuff to the gulpfile. 2017-02-04 08:19:46 -06:00
Yury Delendik
f1abd834d8 Moves locale and cmaps tasks to gulpfile. 2017-01-10 11:50:38 -06:00
Yury Delendik
c45300e06c Enables some unit tests on travis. 2017-01-09 15:43:45 -06:00
porlan1
d9e1cb7955 unit test files as UMD modules 2017-01-09 11:40:57 -05: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
3820946301 Fix (most) errors reported by the no-multi-spaces ESLint rule
http://eslint.org/docs/rules/no-multi-spaces
2016-12-12 20:35:51 +01: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
Yury Delendik
85db146525 Run 'firefox' and 'chromium' task in-sequences 2016-10-17 08:05:16 -05:00
Tim van der Meij
224e3a42a2 Gulp: port the all, extension and jsdoc targets
This requires the `run-sequence` dependency because Gulp does not have a
way to run sequences of tasks inside a Gulp task. Gulp 4.0 will have
support for this, but until that is released this is the recommended way
to implement it.
2016-10-16 22:17:25 +02:00
Yury Delendik
0576c9c6c6 Replaces all preprocessor directives with PDFJSDev calls. 2016-10-14 10:57:53 -05:00
Yury Delendik
c09f634bb6 Removes mozPrintCallback polyfill, converts canvas to PNG. 2016-10-11 10:08:13 -05:00
Yury Delendik
24a7a58da7 Moves mozPrintCallback specific code to firefox_printservice.js 2016-10-08 07:33:07 -05:00
Rob Wu
724308c57a Add opt-out telemetry to the Chrome extension
Privacy policy: https://github.com/Rob--W/pdfjs-telemetry#privacy-policy

Unit tests (offline):

```
node test/chromium/test-telemetry.js
```

Server tests (requires that Nginx is installed):

```
git clone https://github.com/Rob--W/pdfjs-telemetry.git
cd pdfjs-telemetry/
python testserver.py TestHttp TestHttps
```

Integration test (extension + server):

- Build the extension
- Edit build/chromium/telemetry.js and remove the check for
  chrome.runtime.id.
- Start Chrome (preferably a new profile):
  chromium --user-data-dir=/tmp/pdftest --no-first-run
- Open chrome://net-internals#events
- Visit chrome://extensions and enable Developer mode.
- Load unpacked extension, select build/chromium.
- Go to the chrome://net-internals tab and filter on pdfjs.robwu.nl.
- Click on URL_REQUEST and verify that the server replied with 204.
- Reload the extension.
- Verify that chrome://net-internals did not contain a new log request.
2016-06-03 20:36:57 +02:00
Yury Delendik
df10513e10 Moves DEFAULT_PREFENCES into JSON format. 2016-05-11 17:58:17 -05:00
Yury Delendik
fe6001363d Moves all testing into gulpfile. 2016-05-02 09:58:29 -05:00
Tim van der Meij
5166b46a1c Port the publish target to Gulp 2016-04-27 12:54:57 +02:00
Yury Delendik
cca0e40aa2 Makes defines parameter non-optional in createBundle. 2016-04-26 07:54:07 -05:00
Yury Delendik
5568a19ee3 Moves bundle target/task to gulpfile.js 2016-04-24 08:37:39 -05:00
Yury Delendik
76aa687548 Makes importl10n and server async gulp functions. 2016-04-22 17:23:25 -05:00