Skip to content
This repository has been archived by the owner on Mar 23, 2019. It is now read-only.

Merge PDFJS upstream v1.9.426 and fix some PDF loading errors #3

Merged
merged 399 commits into from
Sep 12, 2017

Conversation

diracdeltas
Copy link
Member

brendandahl and others added 30 commits May 22, 2017 11:38
Remove the special handling for `nameddest`s that look like standard pageNumbers
…ility

Remove the reference to `compatibility.js` from the README, since it's included by default in `GENERIC` builds
…e 8424)

*This patch follows a similar pattern as previous ones, by skipping certain problematic Unicode locations.*

According to http://searchfox.org/mozilla-central/rev/6c2dbacbba1d58b8679cee700fd0a54189e0cf1b/gfx/harfbuzz/src/hb-unicode-private.hh#136, it seems that the HANGUL FILLER (0x3164) location is "special".

Fixes 8424.
Don't map glyphs to the HANGUL FILLER (0x3164) Unicode location (issue 8424)
Resets canvas 2d context to the default state.
…ng on length, since `Array.prototype.indexOf` can be extremely inefficient for very large arrays (issue 8372)

Fixes 8372.
Add different code-paths to `{CMap, ToUnicodeMap}.charCodeOf` depending on length, since `Array.prototype.indexOf` can be extremely inefficient for very large arrays (issue 8372)
…rvice-navigateTo

Refactor and ES6-ify `PDFLinkService.navigateTo`
Update webpack.js to support browsers that do not have the Web Workers API
Please note that the `glyphlist.js` and `unicode.js` files are converted to CommonJS modules instead, since Babel cannot handle files that large and they are thus excluded from transpilation.
Convert the files in the `/src/core` folder to ES6 modules
… factory, in preparation for ES6 conversion of the thumbnail related code

This patch intends to simplify future ES6 refactoring of the thumbnail code, since the current code isn't going to work well together with proper `Class`es.
…geFactory

Refactor the `getTempCanvas` function in `pdf_thumbnail_view.js` to a factory, in preparation for ES6 conversion of the thumbnail related code
Removes last UMDs from the modules.
…ble 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.
Allow specifying the `PDFJS_NEXT` build flag via an environment variable when running the various `gulp` commands
Adds streams-lib polyfill and exports ReadableStream from shared/util.
Wraps mozL10n to async calls; splits firefox and generic l10n libs.
It appears that this was simply forgotten in PR 8394.
…lServices-createL10n

Add a stub `createL10n` to `DefaultExternalServices` in app.js
Snuffleupagus and others added 23 commits August 4, 2017 14:11
More robust getPage() error handling.
ES6-ify the code in `web/dom_events.js`
…es in evaluator.js

From looking at blame, it seems that these checks became obsolete with PR 692 (which landed close to six years ago). Note how, after that PR, there's no longer anything being assigned to the `code` property of an Object.
…ject-rm-code-property

Remove leftover `args[0].code` checks from the `OPS.paintXObject` cases in evaluator.js
…t `properties` object in `PartialEvaluator.translateFont`

This appears to simply have been forgotten in the re-factoring in PR 4815, where the `coded` property was renamed to the *much* more descriptive `isType3Font` property.
Fallback to plain object for globalScope.
…Type3Font

Replace the `coded` property with `isType3Font` when building the font `properties` object in `PartialEvaluator.translateFont`
…r-class

Convert `DownloadManager` to an ES6 class
… mode

At this point, the default viewer is already not usable in older browsers in `gulp server` mode, since we only run the code through Babel as part of the build step.
Hence there shouldn't be much point in manually loading `compatibility.js` in `viewer.html` the way that we've been doing, especially considering that it's already being loaded by `src/shared/util.js`.
…ing in `src/core/jpg.js` (issue 4901)

This patch removes the `clamp0to255` helper function, as well as manual clamping code in `src/core/jpg.js`.
The adjusted constants in `_convertCmykToRgb` were taken from CMYK to RGB conversion code found in `src/core/colorspace.js`.

*Please note:* There will be some very slight movement in a number of existing test-cases, since `Uint8ClampedArray` appears to use `Math.round` (or equivalent) and the old code used (basically) `Math.floor`.
Use `Uint8ClampedArray`, when returning data, and remove manual clamping in `src/core/jpg.js` (issue 4901)
This appears to fix the 'Bad end offset errors' when loading some PDFs.
See mozilla#7616
Fix brave/browser-laptop#10867
Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ on upstream merge and root cause fix (b119354)

@bsclifton bsclifton merged commit 73aa2d9 into master Sep 12, 2017
@bsclifton bsclifton deleted the merge/1.9.426 branch September 12, 2017 21:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.