mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Ensure that PDFImage.buildImage
won't accidentally swallow errors, e.g. from ColorSpace parsing (issue 6707, PR 11601 follow-up)
Because of a really stupid `Promise`-related mistake on my part, when re-factoring `PDFImage.buildImage` during the `NativeImageDecoder` removal, we're no longer re-throwing errors occuring during image parsing/decoding as intended. The result is that some (fairly) corrupt documents will never finish loading, and unfortunately there were apparently no sufficiently corrupt images in the test-suite to catch this.
This commit is contained in:
parent
c809f00b3b
commit
4b51bcc733
4 changed files with 21 additions and 13 deletions
|
@ -248,7 +248,7 @@ var PDFImage = (function PDFImageClosure() {
|
|||
* Handles processing of image data and returns the Promise that is resolved
|
||||
* with a PDFImage when the image is ready to be used.
|
||||
*/
|
||||
PDFImage.buildImage = function ({
|
||||
PDFImage.buildImage = async function ({
|
||||
xref,
|
||||
res,
|
||||
image,
|
||||
|
@ -271,17 +271,16 @@ var PDFImage = (function PDFImageClosure() {
|
|||
warn("Unsupported mask format.");
|
||||
}
|
||||
}
|
||||
return Promise.resolve(
|
||||
new PDFImage({
|
||||
xref,
|
||||
res,
|
||||
image: imageData,
|
||||
isInline,
|
||||
smask: smaskData,
|
||||
mask: maskData,
|
||||
pdfFunctionFactory,
|
||||
})
|
||||
);
|
||||
|
||||
return new PDFImage({
|
||||
xref,
|
||||
res,
|
||||
image: imageData,
|
||||
isInline,
|
||||
smask: smaskData,
|
||||
mask: maskData,
|
||||
pdfFunctionFactory,
|
||||
});
|
||||
};
|
||||
|
||||
PDFImage.createMask = function ({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue