[pull] master from mozilla:master#415
Merged
Merged
Conversation
…ata` This removes a little bit of code duplication, which only exist since the `src/display/canvas.js` code pre-dates the helper function by many years. Note: Given that `OffscreenCanvas` is enabled by default there's currently not a lot of test coverage for this code-path, hence the added browser-test.
Currently when opening a PDF document the following code is used, where `checkFirstPage`/`checkLastPage` helps detect XRef corruption; note https://github.com/mozilla/pdf.js/blob/86a18bd5fec4261f28485f3ac854f118d04a5671/src/core/worker.js#L167-L176 However when merging a PDF into an existing document the parsing is only "partial"; note https://github.com/mozilla/pdf.js/blob/86a18bd5fec4261f28485f3ac854f118d04a5671/src/core/worker.js#L632-L634 It seems a little strange to not support corrupt PDFs in a consistent manner in the code-base, hence this patch adds a new `BasePdfManager` helper that handles all the relevant parsing/checking and re-uses that when merging PDFs.
Add an integration-test for merging a corrupt PDF
Looking at the coverage data the password-handling part of the merge functionality wasn't being tested; see https://app.codecov.io/gh/mozilla/pdf.js/commit/e75a7cfd62a9dc14c5bbcd2808894d4761268d14/blob/src/core/worker.js#L652
The "Merge PDF" integration-tests will (indirectly) invoke `PDFViewerApplication.open` as part of loading the new PDF document, which will end up creating a new `PDFWorker` instance. Currently worker coverage is only collected at the end of each integration-test, which means that in these cases we miss the coverage data from any "previous" workers.
Add an integration-test for merging a password-protected PDF
…rtRGBToRGBA Use the `convertRGBToRGBA` helper with RGB images in `putBinaryImageData`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )