Skip to content

Commit

Permalink
enable read with stream
Browse files Browse the repository at this point in the history
improved indentation

changes done as required
  • Loading branch information
shikhar-scs committed Dec 13, 2017
1 parent 6ac9e1c commit 2626cf0
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions test/unit/network_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,15 @@ describe('network', function() {

it('read with streaming', function(done) {
var userAgent = window.navigator.userAgent;
// The test is valid for FF only: the XHR has support of the
// 'moz-chunked-array' response type.
// TODO enable for other browsers, e.g. when fetch/streams API is supported.
var m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(userAgent);
if (!m || m[1] < 9) {
expect(true).toEqual(true);
done();
return;
let isFirefoxWithMozChunkedEncodingSupport =
/Mozilla\/5.0.*?rv:(?:\d+).*? Gecko/.test(userAgent);
let isFetchWithStreamSupport = (typeof Response !== 'undefined' &&
'body' in Response.prototype &&
typeof ReadableStream !== 'undefined');

if (!isFirefoxWithMozChunkedEncodingSupport &&
!isFetchWithStreamSupport) {
pending('Streaming not supported by user agent');
}

var stream = new PDFNetworkStream({
Expand Down

0 comments on commit 2626cf0

Please sign in to comment.