Commit Graph

9785 Commits

Author SHA1 Message Date
Yury Delendik
7fd2084796 Merge pull request #8346 from Snuffleupagus/issue-8344
Restore the `URL.createObjectURL` check to the `createObjectURL` utility function (issue 8344)
2017-04-27 15:42:53 -05:00
Jonas Jenwald
ee09336f32 Restore the URL.createObjectURL check to the createObjectURL utility function (issue 8344)
This is a regression from commit 3888a993b1.

It turns out the even though we have a `URL` polyfill, it's still dependent on the existence of native `URL.{createObjectURL, revokeObjectURL}` functions.
Since no such thing exists in Node.js, our `createObjectURL` utility function breaks there.
2017-04-27 20:57:15 +02:00
Yury Delendik
acdfc2d860 Merge pull request #8345 from timvandermeij/bot-prefs
Bots: disable the default browser test and enable E10s
2017-04-27 13:51:44 -05:00
Tim van der Meij
ee86a81a50
Bots: disable the default browser test and enable E10s
The test runner is automated, so if the default browser test is
performed, the browser hangs waiting for user input it never gets.
Disable the test to fix that.

Moreover, enable E10s now that it is mature. This may help with the
performance of the test runner as well.
2017-04-27 20:39:57 +02:00
Yury Delendik
e3d0cd4913 Fixes stable version number 2017-04-27 12:07:42 -05:00
Jonas Jenwald
afc74b0178 Enable the object-shorthand ESLint rule in src/shared
Please see http://eslint.org/docs/rules/object-shorthand.

For the most part, these changes are of the search-and-replace kind, and the previously enabled `no-undef` rule should complement the tests in helping ensure that no stupid errors crept into to the patch.
2017-04-27 17:29:40 +02:00
Tim van der Meij
f91d01cad3 Merge pull request #8332 from Snuffleupagus/eslint_object-shorthand-src-shared-display
Enable the `object-shorthand` ESLint rule in `src/shared` and `src/display`
2017-04-27 16:43:37 +02:00
Tim van der Meij
32c0ea5909 Merge pull request #8324 from timvandermeij/es6-annotation-presentation-rendering
Convert the annotation layer builder, presentation mode and rendering queue to ES6 syntax
2017-04-27 16:30:07 +02:00
Tim van der Meij
24d44b2a34
Convert the rendering queue to ES6 syntax 2017-04-27 16:23:30 +02:00
Tim van der Meij
ccdc7ba3c8
Convert presentation mode to ES6 syntax 2017-04-27 16:23:29 +02:00
Tim van der Meij
3554a93c2b
Convert the annotation layer builder to ES6 syntax 2017-04-27 16:23:29 +02:00
Tim van der Meij
f4690a3c93 Merge pull request #8331 from Snuffleupagus/ui-utils-unit-tests-travis
Enable running the `ui_utils` unit-tests on Travis
2017-04-27 15:33:32 +02:00
Tim van der Meij
19af5952c0 Merge pull request #8339 from Snuffleupagus/es6-ViewHistory
Convert the `ViewHistory` to an ES6 class, and re-factor it to make it properly asynchronous
2017-04-27 15:24:01 +02:00
Jonas Jenwald
09edfb3dc0 Re-factor ViewHistory to make it properly asynchronous
Rather than having to manually use `initializedPromise`, which really ought to be a private property, to ensure that setting/getting values in the `ViewHistory` works as intended, this re-factoring simply changes all of its methods to be asynchronous.

Furthermore, a `getMultiple` method (mirroring the existing `setMultiple` one) is also added to `ViewHistory`.

Finally, this patch also addresses an existing issue, where certain preferences (e.g. the default zoom level) would be ignored when calling `setInitialView` if reading from the `ViewHistory` fails for some reason.
2017-04-27 11:49:35 +02:00
Jani Pehkonen
64deb6c700 Subtract the X/Y offsets when decoding refinement regions of JBIG2 images (issue 7145, 7308, 7401, 7850, 8270)
Please refer to the JBIG2 standard, see https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-T.88-200002-I!!PDF-E&type=items.
In particular, section "6.3.5.3 Fixed templates and adaptive templates" mentions that the offsets should be *subtracted*; where the offsets are defined according to "Table 6" under section "6.3.2 Input parameters".

Fixes 7145.
Fixes 7308.
Fixes 7401.
Fixes 7850.
Fixes 8270.
2017-04-26 16:06:15 +02:00
Jonas Jenwald
16b4132ebf Convert the ViewHistory to an ES6 class 2017-04-26 11:49:06 +02:00
Jonas Jenwald
07b5574006 Enable the object-shorthand ESLint rule in src/display
Please see http://eslint.org/docs/rules/object-shorthand.

For the most part, these changes are of the search-and-replace kind, and the previously enabled `no-undef` rule should complement the tests in helping ensure that no stupid errors crept into to the patch.
2017-04-25 16:17:18 +02:00
Jonas Jenwald
7bee0c2aa3 Enable the object-shorthand ESLint rule in src/shared
Please see http://eslint.org/docs/rules/object-shorthand.

For the most part, these changes are of the search-and-replace kind, and the previously enabled `no-undef` rule should complement the tests in helping ensure that no stupid errors crept into to the patch.
2017-04-25 16:07:59 +02:00
Jonas Jenwald
366277d180 Merge pull request #8328 from timvandermeij/remove-mozcentralcheck
Makefile: remove unused `mozcentralcheck` target
2017-04-25 14:15:10 +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
Tim van der Meij
6d374f15c0
Makefile: remove unused mozcentralcheck target
It is not used by upstream anymore, since they create a diff and
manually review it before submitting it.
2017-04-24 23:00:57 +02:00
Tim van der Meij
5fe26bb9da Merge pull request #8303 from Snuffleupagus/es6-preferences
Convert the `Preferences` to an ES6 class
2017-04-23 21:55:36 +02:00
Jonas Jenwald
c5f9193777 Convert the Preferences to an ES6 class 2017-04-23 21:14:58 +02:00
Tim van der Meij
99d35a1039 Merge pull request #8306 from timvandermeij/es6-sidebar
Convert the sidebar to ES6 syntax
2017-04-23 17:18:25 +02:00
Tim van der Meij
26ad82f5c2
Convert the sidebar to ES6 syntax 2017-04-23 17:13:51 +02:00
Jonas Jenwald
ece24dfe61 Merge pull request #8302 from timvandermeij/es6-attachments-outline
Convert the attachments/outline view to ES6 syntax
2017-04-23 16:57:00 +02:00
Tim van der Meij
93520172f6
Convert the attachments/outline view to ES6 syntax 2017-04-23 16:06:15 +02:00
Tim van der Meij
0e8f020e2e Merge pull request #8323 from Snuffleupagus/importl10n-beta
Change the `importl10n` script to use the Beta channel, since Aurora is being removed
2017-04-22 19:50:05 +02:00
Jonas Jenwald
9e9676e54e Update l10n files 2017-04-22 16:29:37 +02: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
Tim van der Meij
96cb599e93 Merge pull request #8322 from Snuffleupagus/rm-window-FirefoxCom
[Firefox addon] Remove the `window.FirefoxCom` hack from `web/viewer.js`, since it was made redunant by the `setExternalLocalizerServices` refactoring (PR 7202 follow-up)
2017-04-21 00:15:10 +02:00
Jonas Jenwald
c44fd3d6e2 Merge pull request #8321 from Snuffleupagus/issue-8263
Change `getPDFFileNameFromURL` to ignore `data:` URLs for performance reasons (issue 8263)
2017-04-20 19:46:29 +02:00
Jonas Jenwald
7bd8b97dba Change PDFAttachmentViewer to only open PDF attachments in the viewer, instead of downloading them, when PDFJS.disableCreateObjectURL = false
This prevents issues with the filename detection being skipped, when trying to download the opened PDF attachment, since `getPDFFileNameFromURL` ignores `data:` URLs for performance reasons.
2017-04-20 18:21:41 +02:00
Jonas Jenwald
84472b30ee Change getPDFFileNameFromURL to ignore data: URLs for performance reasons (issue 8263)
The patch also changes the `defaultFilename` to use the ES6 default parameter notation, and fixes the formatting of the JSDoc comment.

Finally, since `getPDFFileNameFromURL` currently has no unit-tests, a few basic ones are added to avoid regressions.
2017-04-20 18:21:27 +02:00
Jonas Jenwald
d76f299b6b [Firefox addon] Remove the window.FirefoxCom hack from web/viewer.js, since it was made redundant by the setExternalLocalizerServices re-factoring (PR 7202 follow-up)
After PR 7202, there are no remaining references to `FirefoxCom` in the `/extensions/firefox/tools/l10n.js` file.
2017-04-20 17:23:30 +02:00
Jonas Jenwald
3888a993b1 Remove the URL checks in the createObjectURL utility function, since the URL polyfill have made them redundant
Also, this changes `createBlob` to throw when `Blob` isn't supported.
2017-04-20 10:16:06 +02:00
Tim van der Meij
2928578164 Merge pull request #8313 from Snuffleupagus/bug-1346616
[Firefox addon] Upstream changes from: Bug 1346616 - Migrate callsites that are retrieving requested locale from pref, to use LocaleService::GetRequestedLocales
2017-04-19 23:20:08 +02:00
Tim van der Meij
93f345483a Merge pull request #8315 from Snuffleupagus/rm-signchromium
Remove the `signchromium` target from `make.js`
2017-04-19 23:18:00 +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
Jonas Jenwald
3b59169ffc [Firefox addon] Upstream changes from: Bug 1346616 - Migrate callsites that are retrieving requested locale from pref, to use LocaleService::GetRequestedLocales
With [bug 1346616](https://bugzilla.mozilla.org/show_bug.cgi?id=1346616) and [this commit](https://hg.mozilla.org/mozilla-central/rev/39a903b099a6#l7.2), it's apparently no longer recommended to check the `general.useragent.locale` pref directly, but instead the `Services.locale.getRequestedLocale()` function should be used.

In this case, it's at least really easy to feature detect this properly :-)
2017-04-18 23:34:48 +02:00
Jonas Jenwald
19321937da Merge pull request #8312 from yurydelendik/mv-dist-gulpfile
Moves dist and minifiedpost tragets from make.js.
2017-04-18 21:31:58 +02:00
Yury Delendik
bc20181a1e Merge pull request #8311 from Snuffleupagus/bug-1356569
[Firefox addon] Upstream changes from: Bug 1356569 - Remove optional trailing parameters (issue 8310)
2017-04-18 14:19:21 -05:00
Yury Delendik
1d30cea914 Moves dist and minifiedpost tragets from make.js. 2017-04-18 14:00:53 -05:00
Jonas Jenwald
cf87c9bba2 [Firefox addon] Upstream changes from: Bug 1356569 - Remove optional trailing parameters (issue 8310)
In https://bugzilla.mozilla.org/show_bug.cgi?id=1355216, the *third* parameter of `Services.obs.addObserver` was made optional.
However, omitting it in Firefox versions *without* that patch causes failures that completely prevents the addon from working (it won't even load).

As far as I can tell, there isn't *any* way to detect ahead of time if the third parameter can be safely omitted, hence we're forced to fallback to manually checking the version number :-(

*Note:* Since the `PdfJs.jsm` file is only used in the `MOZCENTRAL` build, we at least don't need to add any compatibility hacks there.
2017-04-18 20:51:17 +02:00
Vladimir Bloshchitsyn
319ea0f350 Allow use versions for pdf.js script (i.e. - pdf.js?2412313) 2017-04-18 15:07:09 +03:00
Yury Delendik
5ad3611cc4 Merge pull request #8300 from Snuffleupagus/GENERIC-DownloadManager-creation
Refactor the `DownloadManager` initialization in `GENERIC`/`CHROME` builds again (PR 8203 follow-up)
2017-04-17 07:34:13 -05:00
Yury Delendik
7812b3cfb2 Merge pull request #8299 from Snuffleupagus/domEvents-getGlobalEventBus-import
Import `getGlobalEventBus` correctly from `web/dom_events.js` in various `/web` files, to un-break e.g. the viewer components (PR 8203 follow-up)
2017-04-17 07:32:04 -05:00
Jonas Jenwald
594e8c05ef Refactor the DownloadManager initialization in GENERIC/CHROME builds again (PR 8203 follow-up)
In the first commit in PR 8203, I changed how the `DownloadManager` was included/initialized in `GENERIC`/`CHROME` builds.
The change was prompted by the fact that you cannot have conditional `import`s with ES6 modules, and I wanted to avoid bundling the general `DownloadManager` into the various Firefox specific build targets.

What I completely missed though, is that the new code meant that `download_manager.js` will now be pulling in the *entire* viewer (through `app.js`).
This is a *really* stupid mistake on my part, since it causes the `dist/build/pdf_viewer.js` used with the viewer components to now include basically the entire default viewer.

The simplest solution that I could come up with, is to add a `genericcom.js` file (similar to the `firefoxcom.js`/`chromecom.js` files) which will be responsible for importing/initializing the `DownloadManager`.
2017-04-17 13:34:30 +02:00
Jonas Jenwald
79e0745a12 Import getGlobalEventBus correctly from web/dom_events.js in various /web files, to un-break e.g. the viewer components (PR 8203 follow-up)
In PR 8203, I somehow managed to mess up the import of `getGlobalEventBus` in *all* files where it's present; my sincere apologies for this!
2017-04-17 00:54:29 +02:00
Tim van der Meij
bd0e4dc4e3 Merge pull request #8297 from timvandermeij/es6-find-bar
Convert the find bar to ES6 syntax
2017-04-16 23:46:25 +02:00