1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-21 15:48:06 +02:00

Merge pull request #10675 from Snuffleupagus/PDFDataTransportStream-disableRange

[Firefox regression] Fix `disableRange=true` bug in `PDFDataTransportStream`
This commit is contained in:
Tim van der Meij 2019-04-04 23:07:45 +02:00 committed by GitHub
commit 072c5864fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 6 deletions

View file

@ -1526,5 +1526,30 @@ describe('api', function() {
});
}).catch(done.fail);
});
it('should fetch document info and page, without range, ' +
'using complete initialData', function(done) {
let fetches = 0, loadingTask;
dataPromise.then(function(data) {
const transport =
new PDFDataRangeTransport(data.length, data,
/* progressiveDone = */ true);
transport.requestDataRange = function(begin, end) {
fetches++;
};
loadingTask = getDocument({ disableRange: true, range: transport, });
return loadingTask.promise;
}).then(function(pdfDocument) {
expect(pdfDocument.numPages).toEqual(14);
return pdfDocument.getPage(10);
}).then(function(pdfPage) {
expect(pdfPage.rotate).toEqual(0);
expect(fetches).toEqual(0);
loadingTask.destroy().then(done);
}).catch(done.fail);
});
});
});