Skip to content

Commit

Permalink
Disables fetch when ReadableStream is not available.
Browse files Browse the repository at this point in the history
  • Loading branch information
yurydelendik committed Aug 30, 2017
1 parent 3cff7da commit cd95b42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion test/unit/jasmine-boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cd95b42

Please sign in to comment.