1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Re-factor how parameters are passed to the network streams

*This patch is the result of me starting to look into moving parameters from `PDFJS` into `getDocument` and other API methods.*

When familiarizing myself with the code, the signatures of the various network streams seemed to be unnecessarily cumbersome since `disableRange` is currently handled separately from other parameters.
I'm assuming that the explanation for this is probably "for historical reasons", as is often the case. Hence I'd like to clean this up *before* we start the larger, and more invasive, `PDFJS` parameter re-factoring.
This commit is contained in:
Jonas Jenwald 2017-10-16 15:52:20 +02:00
parent 0052dc2b0d
commit 23699cef1c
6 changed files with 65 additions and 81 deletions

View file

@ -23,11 +23,9 @@ describe('network', function() {
it('read without stream and range', function(done) {
var stream = new PDFNetworkStream({
source: {
url: pdf1,
rangeChunkSize: 65536,
disableStream: true,
},
url: pdf1,
rangeChunkSize: 65536,
disableStream: true,
disableRange: true,
});
@ -77,11 +75,9 @@ describe('network', function() {
}
var stream = new PDFNetworkStream({
source: {
url: pdf2,
rangeChunkSize: 65536,
disableStream: false,
},
url: pdf2,
rangeChunkSize: 65536,
disableStream: false,
disableRange: false,
});
@ -123,12 +119,10 @@ describe('network', function() {
// requiring this test to pass.
var rangeSize = 32768;
var stream = new PDFNetworkStream({
source: {
url: pdf1,
length: pdf1Length,
rangeChunkSize: rangeSize,
disableStream: true,
},
url: pdf1,
length: pdf1Length,
rangeChunkSize: rangeSize,
disableStream: true,
disableRange: false,
});