Disables fetch when ReadableStream is not available.

This commit is contained in:
Yury Delendik 2017-08-30 10:53:59 -05:00
parent 3cff7da0e7
commit cd95b426c7
2 changed files with 4 additions and 2 deletions

View File

@ -34,7 +34,8 @@ if (typeof PDFJSDev === 'undefined' ||
if (pdfjsSharedUtil.isNodeJS()) {
var PDFNodeStream = require('./display/node_stream.js').PDFNodeStream;
pdfjsDisplayAPI.setPDFNetworkStreamClass(PDFNodeStream);
} else if (typeof Response !== 'undefined' && 'body' in Response.prototype) {
} else if (typeof Response !== 'undefined' && 'body' in Response.prototype &&
typeof ReadableStream !== 'undefined') {
var PDFFetchStream = require('./display/fetch_stream.js').PDFFetchStream;
pdfjsDisplayAPI.setPDFNetworkStreamClass(PDFFetchStream);
} else {

View File

@ -80,7 +80,8 @@ function initializePDFJS(callback) {
var PDFFetchStream = modules[3].PDFFetchStream;
// Set network stream class for unit tests.
if (typeof Response !== 'undefined' && 'body' in Response.prototype) {
if (typeof Response !== 'undefined' && 'body' in Response.prototype &&
typeof ReadableStream !== 'undefined') {
displayApi.setPDFNetworkStreamClass(PDFFetchStream);
} else {
displayApi.setPDFNetworkStreamClass(PDFNetworkStream);