Commit Graph

9776 Commits

Author SHA1 Message Date
Jonas Jenwald
95660a2ab3 Update l10n files 2017-05-18 12:41:01 +02: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
Jonas Jenwald
658fb03db1 Merge pull request #8420 from mozilla/revert-8390-bug-1319111
Revert "Upstream changes from: Bug 1319111 - Expose result principal URL ("final channel URL") on LoadInfo, convert current consumers of LOAD_REPLACE"
2017-05-18 12:22:02 +02:00
Jonas Jenwald
cbba74f474 Revert "Upstream changes from: Bug 1319111 - Expose result principal URL ("final channel URL") on LoadInfo, convert current consumers of LOAD_REPLACE" 2017-05-18 12:08:05 +02:00
Yury Delendik
5dc8dcdc0f Merge pull request #8388 from Snuffleupagus/issue-8380
Cache JPEG images, just as we do for other image formats, in `evaluator.js` (issue 8380)
2017-05-17 17:25:51 -05:00
Jonas Jenwald
5958dafd8c Merge pull request #8413 from MRMBRAND/set-canvas-background-color
Adds additional parameter so background color of canvas can be set
2017-05-18 00:18:25 +02:00
chris.greening
cfc2f36f5c Adds additional parameter so background color of canvas can be set 2017-05-17 17:06:44 +01:00
Jonas Jenwald
ca3cf6e744 Merge pull request #8417 from Standard8/eslint-cleanup-globals
Use eslint-plugin-mozilla and the webextensions environment to avoid defining globals in each file.
2017-05-17 16:43:54 +02:00
Mark Banner
2e9ae50a3a Use eslint-plugin-mozilla and the webextensions environment to avoid defining globals in each file. 2017-05-17 10:30:46 +01:00
Tim van der Meij
e9cbfbccb4 Merge pull request #8411 from Snuffleupagus/web-page-thumbnail-rm-self
Replace unnecessary `var self = this` statements with arrow functions in `web/pdf_page_view.js` and `web/pdf_thumbnail_view.js`
2017-05-16 23:32:48 +02:00
Jonas Jenwald
a9e5bc91fb Replace unnecessary var self = this statements with arrow functions in web/pdf_page_view.js and web/pdf_thumbnail_view.js
Also replaces `var` with `let` in code that's touched in the patch. Please note that this should be completely safe, for two separate reasons, since trying to access let in a scope where it's not defined is first of all a runtime error and second of all an ESLint error (thanks to the `no-undef` rule).
2017-05-16 13:48:27 +02:00
Tim van der Meij
08f8b68f12 Merge pull request #8406 from Rob--W/babel-cache-error-handling
Gracefully ignore transaction failure in plugin-babel-cached
2017-05-14 21:14:03 +02:00
Rob Wu
b3bd2f3b38 Gracefully ignore transaction failure in plugin-babel-cached 2017-05-14 16:01:32 +02:00
Tim van der Meij
63597cc556 Merge pull request #8258 from Snuffleupagus/api-unit-tests-travis
Enable running a subset of the API unit-tests on Travis
2017-05-13 23:56:59 +02:00
Jonas Jenwald
bbe8c3d8ed Enable running a subset of the API unit-tests on Travis
Notably, this patch skips all canvas rendering tests in Node.js.
2017-05-12 11:48:27 +02:00
Jonas Jenwald
028d3421ac Merge pull request #8398 from Snuffleupagus/es6-dom-utils-factories
Convert the `DOMCMapReaderFactory` and `DOMCanvasFactory` to ES6 classes
2017-05-11 23:10:44 +02:00
Jonas Jenwald
c5f73edcd2 Convert the DOMCanvasFactory to an ES6 class
For consistency, also updates the `pdf2png.js` example to use the slightly less verbose `canvasAndContext` parameter name.
2017-05-11 20:15:22 +02:00
Jonas Jenwald
32baa6af7a Convert the DOMCMapReaderFactory to an ES6 class
Given that we only create *one* instance of this class per `getDocument` call, this shouldn't matter performance wise.
2017-05-11 20:15:19 +02:00
Yury Delendik
15425d5b9b Merge pull request #8400 from Snuffleupagus/ref-tests-wait-on-destroy
Wait for previous pdfDocument(s) to be destroyed before running the next reference test
2017-05-11 11:59:20 -05:00
Yury Delendik
372fec61c7 Merge pull request #8399 from Snuffleupagus/unit-tests-wait-on-destroy
Wait until `PDFDocumentLoadingTask.destroy` is resolved before calling `done` in the API unit-tests
2017-05-11 11:55:21 -05:00
Jonas Jenwald
b5775af716 Wait for previous pdfDocument(s) to be destroyed before running the next reference test
Refactors `Driver._cleanup` to return a `Promise` which is resolved once all opened documents have been destroyed.
This is then used in `Driver._nextTask` to ensure that we wait for everything to be cleaned up, such that the tests run sequentially.
2017-05-11 12:56:45 +02:00
Jonas Jenwald
7a040c05d7 Wait until PDFDocumentLoadingTask.destroy is resolved before calling done in the API unit-tests
Try to ensure that everything, including workers, are properly destroyed before running the next test-case.
2017-05-11 12:17:54 +02:00
Jonas Jenwald
52998c5fe1 Merge pull request #8397 from Snuffleupagus/extractText-refactor
Simplify `extractText`, and replace unnecessary `var self = this` statements with arrow functions, in `web/pdf_find_controller.js`
2017-05-10 17:05:37 +02:00
Jonas Jenwald
9efd11c5c9 Replace unnecessary var self = this statements with arrow functions in web/pdf_find_controller.js 2017-05-10 14:09:20 +02:00
Jonas Jenwald
c750514903 Simplify extractText in web/pdf_find_controller.js
Currently this method first uses a loop to build a temporary array to hold Promises, which are then resolved from a recursive helper function once the textContent is fetched for each page.

To me, this is unncessarily complicated, since we can do everything within one loop by simply chaining the asynchronous calls to retrieve the textContent. (Note that this guarantees that the textContent of the pages is still fetched sequentially.)
2017-05-10 14:09:15 +02:00
Yury Delendik
9bfbf27f94 Merge pull request #8350 from ydfzgyj/fix-svg-image
Fix svg image render
2017-05-09 10:53:34 -05:00
Yury Delendik
595ee1232d Merge pull request #8391 from timvandermeij/es6-web
Convert the hand tool, interfaces and secondary toolbar to ES6 syntax
2017-05-09 07:53:27 -05:00
Yury Delendik
3923c4a6fa Merge pull request #8393 from Snuffleupagus/web-app-rm-self
Replace unnecessary `var self = this` statements with arrow functions in `web/app.js`
2017-05-09 07:48:29 -05:00
Jonas Jenwald
240a3926f4 Replace unnecessary var self = this statements with arrow functions in web/app.js
Also replaces `var` with `let` in the functions/methods that are touched in the patch. Please note that this should be completely safe, for two separate reasons, since trying to access `let` in a scope where it's not defined is first of all a runtime error and second of all an ESLint error (thanks to the `no-undef` rule).
2017-05-09 13:46:54 +02:00
巴里切罗
8d5d97264e fix(svg) adjust strategy for decoding JPEG images 2017-05-08 11:32:44 +08:00
Tim van der Meij
0dbc68a6d6 Merge pull request #8390 from Snuffleupagus/bug-1319111
Upstream changes from: Bug 1319111 - Expose result principal URL ("final channel URL") on LoadInfo, convert current consumers of LOAD_REPLACE
2017-05-07 22:07:20 +02:00
Tim van der Meij
8d9596480c
Convert the interfaces to ES6 syntax 2017-05-07 22:01:49 +02:00
Tim van der Meij
67049602c5
Convert the secondary toolbar to ES6 syntax 2017-05-07 21:43:50 +02:00
Honza Bambas :mayhemer
20aa8d74e9 Upstream changes from: Bug 1319111 - Expose result principal URL ("final channel URL") on LoadInfo, convert current consumers of LOAD_REPLACE
This is a downstream change introduced in [1]. That mozilla bug is adding a new property to channel's loadinfo object (nsILoadInfo) that protocol handlers has to set on channels when originalURI on the result channel is set to a different URI than the channel has been created for.

Existence of the new property on nsILoadInfo depends on landing [1].

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1319111
2017-05-07 21:38:10 +02:00
Tim van der Meij
bc49524ac7
Convert the hand tool to ES6 syntax 2017-05-07 21:30:07 +02:00
Yury Delendik
7015c88ce9 Merge pull request #8387 from evadne/issue-8386-webkit-subtle-crypto
amends Babel cache (#8364) implementation to also work on Safari
2017-05-07 13:13:20 -05:00
Evadne Wu
50af2284aa
amends Babel cache (#8364) implementation to disable caching on Safari
- the viewer was not loading in development mode on Safari, due to Safari
  having crypto.webkitSubtle instead of crypto.subtle.

- the isCachingPossible check was amended to check for crypro.subtle
  which is currently not in Safari but in Firefox and Chrome. This
  essentially works around the issue by disabling caching for Safari
  in development mode.

- maintainer sentiment: people who develop on Safari can get this speedup
  once Safari drops prefix for SubtleCrypto.

- note: at time of writing Safari Version 10.1 (12603.1.30.0.34) has an
  issue where caching can be enabled for PDF.js but must to be disabled for
  worker, otherwise the two sides do not communicate.

- https://github.com/mozilla/pdf.js/pull/8387#issuecomment-299709961
- https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
2017-05-07 18:00:30 +01:00
Tim van der Meij
b3e4361d7b Merge pull request #8381 from Snuffleupagus/document-properties-reset
Re-factor `PDFDocumentProperties` such that it's properly reset when a new PDF file is opened (issue 8371)
2017-05-07 17:43:23 +02:00
Jonas Jenwald
0c2ebda31c Cache JPEG images, just as we do for other image formats, in evaluator.js (issue 8380)
For some reason, we're putting all kind of images *except* JPEG into the `imageCache` in `evaluator.js`.[1]
This means that in the PDF file in issue 8380, we'll keep sending the *same* two small images[2] to the main-thread and decoding them over and over. This is obviously hugely inefficient!

As can be seen from the discussion in the issue, the performance becomes *extremely* bad if the user has the addon "Adblock Plus" installed. However, even in a clean Firefox profile, the performance isn't that great.

This patch not only addresses the performance implications of the "Adblock Plus" addon together with that particular PDF file, but it *also* improves the rendering times considerably for *all* users.
Locally, with a clean profile, the rendering times are reduced from `~2000 ms` to `~500 ms` for my setup!

Obviously, the general structure of the PDF file and its operator sequence is still hugely inefficient, however I'd say that the performance with this patch is good enough to consider the issue (as it stands) resolved.[3]

Fixes 8380.

---
[1] Not technically true, since inline images are cached from `parser.js`, but whatever :-)

[2] The two JPEG images have dimensions 1x2, respectively 4x2.

[3] To make this even more efficient, a new state would have to be added to the `QueueOptimizer`. Given that PDF files this stupid fortunately aren't too common, I'm not convinced that it's worth doing.
2017-05-07 13:07:41 +02:00
Jonas Jenwald
7780fd5b98 Re-factor PDFDocumentProperties such that it's properly reset when a new PDF file is opened (issue 8371)
This patch contains the following improvements:
 - Only fetch the various document properties *once* per PDF file opened, and cache the result (in a frozen object).
 - Always update the *entire* dialog at once, to prevent inconsistent UI state (issue 8371).
 - Ensure that the dialog, and all its internal properties, are reset when `PDFViewerApplication.close` is called.
 - Inline, and re-factor, the `getProperties` method in `open`, since that's the only call-site.
 - Always overwrite the fileSize with the value obtained from `pdfDocument.getDownloadInfo`, to ensure that it's correct.
 - ES6-ify the code that's touched in this patch.

Fixes 8371.
2017-05-07 10:16:03 +02:00
Jonas Jenwald
50d026fbda Merge pull request #8385 from tobytailor/master
Fix typo in LoopbackPort export
2017-05-06 10:35:49 +02:00
Tobias Schneider
e1a3e46cba Fix typo 2017-05-05 19:10:00 -07:00
Yury Delendik
deae2d8cb8 Merge pull request #8368 from yurydelendik/sourcemap
Enables source maps for webpack generated files.
2017-05-05 09:32:27 -05:00
Yury Delendik
996805f953 Produces source maps for built files. 2017-05-05 08:15:21 -05:00
Yury Delendik
c3cfcbe72f Merge pull request #8340 from ydfzgyj/fix-svg-spacing
Fix char spacing bug in SVG mode
2017-05-05 07:41:25 -05:00
巴里切罗
d58040aa29 fix(svg) char spacing bug 2017-05-05 12:11:20 +08:00
Yury Delendik
206ad8d8b2 Merge pull request #8378 from Snuffleupagus/es6-modules-src-shared
Convert the files in the `/src/shared` folder to ES6 modules
2017-05-04 14:35:09 -05:00
Jonas Jenwald
60b14f526e Convert the files in the /src/shared folder to ES6 modules 2017-05-04 21:07:59 +02:00
Yury Delendik
b0a796ced3 Merge pull request #8377 from Snuffleupagus/web-rm-bind
Replace unnecessary `bind(this)` statements with arrow functions in `web/` files
2017-05-04 12:08:05 -05:00
Jonas Jenwald
f27b5013e2 Replace unnecessary bind(this) statements with arrow functions in web/ files
By using `let`, which is block-scoped, instead of `var` in a couple of places we're able to get rid of additional `bind` calls.
2017-05-04 17:13:09 +02:00