Commit Graph

9462 Commits

Author SHA1 Message Date
Jonas Jenwald
4626fc8342 Enable the spaced-comment ESLint rule
Please see http://eslint.org/docs/rules/spaced-comment.

Note that the exceptions added for `line` comments are intended to still allow use of the old preprocessor without linting errors.
Also, I took the opportunity to improve the grammar slightly (w.r.t. capitalization and punctuation) for comments touched in the patch.
2017-01-19 16:41:59 +01:00
Tim van der Meij
a917443ae6 Merge pull request #7965 from Snuffleupagus/bug-1331081
[Bug 1331081] omit addEventListener/removeEventListener's third parameter when it's false
2017-01-17 22:26:26 +01:00
Jonas Jenwald
70c1a6b120 [Bug 1331081] omit addEventListener/removeEventListener's third parameter when it's false
Upstream changes from https://bugzilla.mozilla.org/show_bug.cgi?id=1331081; this patch also covers one file, `pdf_print_service.js`, that's not present in mozilla-central.

Fixes 7962.
2017-01-17 17:50:21 +01:00
Tim van der Meij
c1703e977d Merge pull request #7960 from Snuffleupagus/eslint_space-unary-ops
Adjust the `space-unary-ops` ESLint rule to comply with mozilla-central lint rules
2017-01-16 22:18:39 +01:00
Jonas Jenwald
0dff8f3600 Adjust the space-unary-ops ESLint rule to comply with mozilla-central lint rules
See http://eslint.org/docs/rules/space-unary-ops; a *very* small part of issue 7957.
2017-01-16 17:19:25 +01:00
Jonas Jenwald
c0a47fddcc Update l10n files 2017-01-16 09:54:50 +01:00
Yury Delendik
9b111c9157 Merge pull request #7956 from Snuffleupagus/bug-1330147
[Bug 1330147] removeObserver calls should not supply a third parameter
2017-01-13 08:06:18 -06:00
Jonas Jenwald
54a64863e2 [Bug 1330147] removeObserver calls should not supply a third parameter
*This is yet another very recent change that we were not notified about.*

Upstream changes from https://bugzilla.mozilla.org/show_bug.cgi?id=1330147, specifically https://hg.mozilla.org/mozilla-central/rev/8e0b7bc5fd71.
2017-01-13 11:34:26 +01:00
Yury Delendik
76b4c8fae1 Merge pull request #7954 from yurydelendik/bug1329182
[Bug 1329182] remove trailing newURI null parameters
2017-01-12 19:41:44 -06:00
Yury Delendik
1f424e561d [Bug 1329182] remove trailing newURI null parameters 2017-01-12 19:40:51 -06:00
Yury Delendik
b8cd14336e Merge pull request #7913 from Snuffleupagus/addon-minimum-firefox45
[Firefox addon] Change the minimum supported version to Firefox 45, i.e. the current ESR version, and remove no longer necessary fallback code
2017-01-12 15:12:27 -06:00
Tim van der Meij
1fda987a4c Merge pull request #7904 from Snuffleupagus/issue-7901
Further adjust the heuristics used to detect OpenType font files with CFF data, to ensure that all Type0 fonts are handled the same way regardless of font Subtype (issue 7901)
2017-01-12 21:55:57 +01:00
Yury Delendik
c0d7029039 Merge pull request #7951 from Snuffleupagus/FileAttachmentAnnotation-simplified-unittest
Rename `annotation_layer_spec.js` to `annotation_spec.js` to better describe what is actually tested, and simplify the `FileAttachmentAnnotation` unit-test to avoid having to use the entire API in the test
2017-01-12 12:27:26 -06:00
Jonas Jenwald
e88c9c75db Simplify the FileAttachmentAnnotation unit-test to avoid having to use the entire API in the test
Every other unit-test in `annotation_spec.js` is already only testing the annotation code. Hence it seems unnecessarily convoluted to make use of the API here, when we can (fairly) simply provide the necessary data explicitly as in all the other annotation unit-test.
2017-01-12 19:10:37 +01:00
Jonas Jenwald
7c3a63bae0 Rename annotation_layer_spec.js to annotation_spec.js since the unit-tests only cover src/core/annotation.js functionality 2017-01-12 19:08:57 +01:00
Yury Delendik
1af35a6d88 Merge pull request #7948 from Skaty/fix-bidi-fraction
Fix inverted calculation of RTL text percentage in bidi
2017-01-12 10:40:08 -06:00
Syed Abdullah
857a5da8f1 Fix inverted calculation of RTL text percentage in bidi. 2017-01-12 23:54:06 +08:00
Jonas Jenwald
00ab0abd4e Merge pull request #7945 from yurydelendik/mv-locale-cmaps
Moves locale and cmaps tasks to gulpfile.
2017-01-11 14:05:21 +01:00
Yury Delendik
393740e2ae Merge pull request #7869 from PedroPachecoInf/master
Fixes issue #6071 - TIFF with 1 bit-depth
2017-01-10 12:37:26 -06:00
Yury Delendik
f1abd834d8 Moves locale and cmaps tasks to gulpfile. 2017-01-10 11:50:38 -06:00
jazzchipc
493853031b Fixes issue #6071.
Corrects readBlockTiff() case for 1-bit depth and 1 color TIFF images incorporated in the PDF.

Adds reference test for PDF used to fix this issue.
2017-01-10 16:42:43 +00:00
Jonas Jenwald
e5cea05881 Merge pull request #7944 from yurydelendik/rm-defpref
Removes Promise usage from preferences.js
2017-01-10 17:19:26 +01:00
Yury Delendik
cf7a9f99c8 Merge pull request #7943 from Snuffleupagus/fixtures-test-fixes
Various fixes for the `external/builder/test*.js` files
2017-01-10 08:58:37 -06:00
Yury Delendik
930a28d879 Better DOMContentLoaded handling. 2017-01-10 08:49:08 -06:00
Yury Delendik
ac2d4abf39 Removes web/default_preferences.js file. 2017-01-10 08:33:32 -06: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
Jonas Jenwald
ca0ebdfa56 Merge pull request #7942 from yurydelendik/rm-deadcode
Fixes preprocessor testing and adds deadcode removal.
2017-01-10 13:31:47 +01:00
Yury Delendik
77b7b84d1e Removes rest of 'no-else-return' comments. 2017-01-09 19:13:36 -06:00
Yury Delendik
6265bb6038 Fixes preprocessor testing and adds deadcode removal. 2017-01-09 19:05:36 -06:00
Tim van der Meij
f828f07ccd Merge pull request #7941 from Snuffleupagus/Page-idFactory
Replace direct lookup of `uniquePrefix`/`idCounters`, in `Page` instances, with an `idFactory` containing an `createObjId` method instead
2017-01-10 00:25:48 +01:00
Jonas Jenwald
642d8621ef Replace direct lookup of uniquePrefix/idCounters, in Page instances, with an idFactory containing an createObjId method instead
We're currently making use of `uniquePrefix`/`idCounters` in multiple files, to create unique object id's, and adding a new occurrence of them requires some care to ensure that an object id isn't accidentally reused.
Furthermore, having to pass around multiple parameters as we currently do seem like something you want to avoid.

Instead, this patch adds a factory which means that there's only *one* thing that needs to be passed around. And since it's now only necessary to call a method in order to obtain a unique object id, the details are thus abstracted away at the call-sites which avoids accidental reuse of object id's.

To test that this works as expected a very simple `Page` unit-test is added, and the existing `Annotation layer` tests are also adjusted slightly.
2017-01-09 23:16:25 +01:00
Tim van der Meij
e259bc2c16 Merge pull request #7939 from yurydelendik/unittesttravis
Enables some unit tests on travis.
2017-01-09 23:14:17 +01:00
Tim van der Meij
098acb1269 Merge pull request #7935 from Snuffleupagus/eslint_no-else-return
Enable the `no-else-return` ESLint rule
2017-01-09 23:03:48 +01:00
Yury Delendik
c45300e06c Enables some unit tests on travis. 2017-01-09 15:43:45 -06:00
Jonas Jenwald
4046d67fde Enable the no-else-return ESLint rule
Using `else` after `return` is not necessary, and can often lead to unnecessarily cluttered code. By using the `no-else-return` rule in ESLint we can avoid this pattern, see http://eslint.org/docs/rules/no-else-return.
2017-01-09 20:27:39 +01:00
Yury Delendik
049d7fa277 Merge pull request #7934 from porlan1/master
Unit test files as modules
2017-01-09 11:27:31 -06:00
porlan1
d9e1cb7955 unit test files as UMD modules 2017-01-09 11:40:57 -05:00
Jonas Jenwald
15f75a5585 [Firefox addon] Remove the registerAddonHistogram fallback code for Firefox versions 36 (and below) from PdfJsTelemetry-addon.jsm
Given that the addon doesn't even work in Firefox versions prior to 38, this is just dead code that can now be removed.
2017-01-07 12:19:42 +01:00
Jonas Jenwald
9434c023ab [Firefox addon] Change the minimum supported version to Firefox 45, i.e. the current ESR version, and remove no longer necessary fallback code
According to https://wiki.mozilla.org/RapidRelease/Calendar#Past_branch_dates: The *last* ESR version of Firefox 38 was released in April this year, and since June the only available ESR version has been based on Firefox 45.

Now that Seamonkey has *finally* released a new version, i.e. 2.46 which should correspond to Firefox 49, there doesn't seem to be any reason to keep the fallback code around in the addon anymore.
2017-01-07 12:19:42 +01:00
Jonas Jenwald
aabfb7788a Merge pull request #7926 from Snuffleupagus/api-onPassword-abort/throw-Promise
[api-minor] Ensure that the `getDocument` Promise is rejected if the `loadingTask` is destroyed, or an `Error` is thrown, inside of the `onPassword` callback (issue 7806)
2017-01-04 10:44:18 +01:00
Jonas Jenwald
14b8523314 Refactor the password handling so that it's stored in the PdfManagers, instead of in the XRef
We're already passing in a, currently unused, `PdfManager` instance when initializing the `XRef`. To avoid having to pass a single `password` parameter around, we could thus simply get the `password` through the `PdfManager` instance instead.
2017-01-03 20:29:52 +01:00
Jonas Jenwald
27513cd23b [api-minor] Ensure that the getDocument Promise is rejected if the loadingTask is destroyed, or an Error is thrown, inside of the onPassword callback (issue 7806)
This patch also removes the `UpdatePassword` message, in favour of using the `sendWithPromise` method of `MessageHandler`.
Furthermore, the patch also refactors the `BasePdfManager_updatePassword`/`BasePdfManager_passwordChanged` methods (in pdf_manager.js), and the `pdfManagerReady` function (in worker.js).
2017-01-03 20:29:46 +01:00
Jonas Jenwald
4e62562a36 Update l10n files 2017-01-02 13:26:09 +01:00
Jonas Jenwald
59afb4b9f0 Merge pull request #7920 from Snuffleupagus/bug-1157493-followup
Improve the handling of `Encoding` dictionary, with `Differences` array, in `PartialEvaluator_preEvaluateFont`
2016-12-29 10:52:31 +01:00
Jonas Jenwald
ddea9a6b04 Improve the handling of Encoding dictionary, with Differences array, in PartialEvaluator_preEvaluateFont
I recently happened to look at the code I wrote for PR 5964, which fixed [bug 1157493](https://bugzilla.mozilla.org/show_bug.cgi?id=1157493), and I quickly realized that the solution is way too simplistic.
The fact that only using the `length` of a `Differences` array worked seems more like a happy accident for a particular set of font data, but could just as easily be incorrect for other PDF files.

Note that in practice, the case where the `Encoding` entry is a regular `Dict` (and not a `Ref` or `Name`) is very rare, hence I don't think that we really need to worry about having to reparse this data.
Also, the performance of this code-block is quite a bit better by updating the `hash` with the data from the *entire* `Differences` array, instead of at every loop iteration.
2016-12-28 21:32:54 +01:00
Tim van der Meij
22f0a04df0 Merge pull request #7829 from Snuffleupagus/finishPaintTask-promise
Let `finishPaintTask` in pdf_page_view.js return a promise instead, to avoid having to throw in the `paintTask.promise` rejection handler, and don't reject the `PDFPageView_draw` promise when rendering is `cancelled`
2016-12-27 23:51:06 +01:00
Jonas Jenwald
e963971244 Further adjust the heuristics used to detect OpenType font files with CFF data, to ensure that all Type0 fonts are handled the same way regardless of font Subtype (issue 7901)
Changing this particular code makes me somewhat nervous about regressions, since PR 5770 necessitated the follow-up PR 6270.
However, the patch passes all tests added in those PRs (and obviously all other tests). Furthermore, I've manually checked all the issues/bugs referenced in PRs 5770 and 6270 without finding any issues.

**Please note:** This patch fixes *only* the font bug, not the SVG conversion, present on pages two and three of the PDF file in issue 7901.
2016-12-20 17:03:51 +01:00
Yury Delendik
3b3a179486 Merge pull request #7879 from rossj/highlight-fix
Make use of textAdvanceScale consistent during combineTextItems. Fix for #7878.
2016-12-19 09:18:13 -06:00