pdfjs-dist 2.0.550 → 2.3.200

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pdfjs-dist might be problematic. Click here for more details.

Files changed (168) hide show
  1. package/CODE_OF_CONDUCT.md +15 -0
  2. package/bower.json +1 -1
  3. package/build/pdf.js +21618 -14369
  4. package/build/pdf.js.map +1 -1
  5. package/build/pdf.min.js +1 -1
  6. package/build/pdf.worker.js +22758 -11399
  7. package/build/pdf.worker.js.map +1 -1
  8. package/build/pdf.worker.min.js +1 -1
  9. package/image_decoders/pdf.image_decoders.js +11500 -0
  10. package/image_decoders/pdf.image_decoders.js.map +1 -0
  11. package/image_decoders/pdf.image_decoders.min.js +1 -0
  12. package/lib/core/annotation.js +767 -258
  13. package/lib/core/arithmetic_decoder.js +275 -245
  14. package/lib/core/bidi.js +65 -6
  15. package/lib/core/ccitt.js +173 -18
  16. package/lib/core/ccitt_stream.js +15 -6
  17. package/lib/core/cff_parser.js +433 -61
  18. package/lib/core/charsets.js +5 -4
  19. package/lib/core/chunked_stream.js +428 -157
  20. package/lib/core/cmap.js +326 -87
  21. package/lib/core/colorspace.js +874 -594
  22. package/lib/core/core_utils.js +173 -0
  23. package/lib/core/crypto.js +290 -45
  24. package/lib/core/document.js +575 -272
  25. package/lib/core/encodings.js +19 -10
  26. package/lib/core/evaluator.js +1032 -351
  27. package/lib/core/font_renderer.js +331 -97
  28. package/lib/core/fonts.js +813 -196
  29. package/lib/core/function.js +253 -27
  30. package/lib/core/glyphlist.js +5 -3
  31. package/lib/core/image.js +169 -62
  32. package/lib/core/image_utils.js +111 -0
  33. package/lib/core/jbig2.js +502 -72
  34. package/lib/core/jbig2_stream.js +19 -8
  35. package/lib/core/jpeg_stream.js +38 -13
  36. package/lib/core/jpg.js +293 -52
  37. package/lib/core/jpx.js +419 -12
  38. package/lib/core/jpx_stream.js +18 -6
  39. package/lib/core/metrics.js +15 -15
  40. package/lib/core/murmurhash3.js +56 -34
  41. package/lib/core/obj.js +1368 -500
  42. package/lib/core/operator_list.js +159 -43
  43. package/lib/core/parser.js +544 -199
  44. package/lib/core/pattern.js +170 -21
  45. package/lib/core/pdf_manager.js +324 -134
  46. package/lib/core/primitives.js +169 -61
  47. package/lib/core/ps_parser.js +134 -45
  48. package/lib/core/standard_fonts.js +17 -17
  49. package/lib/core/stream.js +327 -34
  50. package/lib/core/type1_parser.js +148 -8
  51. package/lib/core/unicode.js +32 -5
  52. package/lib/core/worker.js +215 -229
  53. package/lib/core/worker_stream.js +277 -0
  54. package/lib/display/annotation_layer.js +618 -192
  55. package/lib/display/api.js +1798 -882
  56. package/lib/display/api_compatibility.js +5 -10
  57. package/lib/display/canvas.js +366 -45
  58. package/lib/display/content_disposition.js +71 -24
  59. package/lib/display/display_utils.js +777 -0
  60. package/lib/display/fetch_stream.js +205 -87
  61. package/lib/display/font_loader.js +468 -236
  62. package/lib/display/metadata.js +38 -16
  63. package/lib/display/network.js +635 -428
  64. package/lib/display/network_utils.js +38 -19
  65. package/lib/display/node_stream.js +367 -175
  66. package/lib/display/pattern_helper.js +103 -36
  67. package/lib/display/svg.js +1232 -519
  68. package/lib/display/text_layer.js +208 -75
  69. package/lib/display/transport_stream.js +345 -94
  70. package/lib/display/webgl.js +64 -18
  71. package/lib/display/worker_options.js +5 -4
  72. package/lib/display/xml_parser.js +166 -53
  73. package/lib/examples/node/domstubs.js +60 -4
  74. package/lib/pdf.js +35 -14
  75. package/lib/pdf.worker.js +5 -3
  76. package/lib/shared/compatibility.js +170 -572
  77. package/lib/shared/global_scope.js +2 -2
  78. package/lib/shared/is_node.js +4 -4
  79. package/lib/shared/message_handler.js +216 -163
  80. package/lib/shared/streams_polyfill.js +21 -17
  81. package/lib/shared/util.js +495 -385
  82. package/lib/test/unit/annotation_spec.js +1464 -401
  83. package/lib/test/unit/api_spec.js +718 -361
  84. package/lib/test/unit/bidi_spec.js +7 -7
  85. package/lib/test/unit/cff_parser_spec.js +54 -11
  86. package/lib/test/unit/clitests_helper.js +9 -10
  87. package/lib/test/unit/cmap_spec.js +95 -41
  88. package/lib/test/unit/colorspace_spec.js +115 -63
  89. package/lib/test/unit/core_utils_spec.js +191 -0
  90. package/lib/test/unit/crypto_spec.js +17 -5
  91. package/lib/test/unit/custom_spec.js +43 -55
  92. package/lib/test/unit/display_svg_spec.js +34 -18
  93. package/lib/test/unit/display_utils_spec.js +273 -0
  94. package/lib/test/unit/document_spec.js +8 -13
  95. package/lib/test/unit/encodings_spec.js +25 -45
  96. package/lib/test/unit/evaluator_spec.js +59 -20
  97. package/lib/test/unit/fetch_stream_spec.js +111 -0
  98. package/lib/test/unit/function_spec.js +17 -5
  99. package/lib/test/unit/jasmine-boot.js +33 -20
  100. package/lib/test/unit/message_handler_spec.js +30 -13
  101. package/lib/test/unit/metadata_spec.js +71 -11
  102. package/lib/test/unit/murmurhash3_spec.js +3 -3
  103. package/lib/test/unit/network_spec.js +22 -55
  104. package/lib/test/unit/network_utils_spec.js +105 -14
  105. package/lib/test/unit/node_stream_spec.js +58 -34
  106. package/lib/test/unit/parser_spec.js +162 -71
  107. package/lib/test/unit/pdf_find_controller_spec.js +230 -0
  108. package/lib/test/unit/pdf_find_utils_spec.js +63 -0
  109. package/lib/test/unit/pdf_history_spec.js +21 -9
  110. package/lib/test/unit/primitives_spec.js +55 -22
  111. package/lib/test/unit/stream_spec.js +12 -4
  112. package/lib/test/unit/test_utils.js +273 -56
  113. package/lib/test/unit/testreporter.js +21 -3
  114. package/lib/test/unit/type1_parser_spec.js +9 -7
  115. package/lib/test/unit/ui_utils_spec.js +236 -36
  116. package/lib/test/unit/unicode_spec.js +18 -15
  117. package/lib/test/unit/util_spec.js +87 -128
  118. package/lib/web/annotation_layer_builder.js +39 -22
  119. package/lib/web/app.js +1252 -609
  120. package/lib/web/app_options.js +103 -65
  121. package/lib/web/base_viewer.js +522 -242
  122. package/lib/web/chromecom.js +259 -117
  123. package/lib/web/debugger.js +166 -22
  124. package/lib/web/download_manager.js +31 -12
  125. package/lib/web/firefox_print_service.js +27 -14
  126. package/lib/web/firefoxcom.js +318 -78
  127. package/lib/web/genericcom.js +89 -30
  128. package/lib/web/genericl10n.js +142 -30
  129. package/lib/web/grab_to_pan.js +28 -4
  130. package/lib/web/interfaces.js +174 -47
  131. package/lib/web/overlay_manager.js +235 -85
  132. package/lib/web/password_prompt.js +22 -14
  133. package/lib/web/pdf_attachment_viewer.js +38 -18
  134. package/lib/web/pdf_cursor_tools.js +39 -16
  135. package/lib/web/pdf_document_properties.js +255 -136
  136. package/lib/web/pdf_find_bar.js +84 -40
  137. package/lib/web/pdf_find_controller.js +495 -184
  138. package/lib/web/pdf_find_utils.js +111 -0
  139. package/lib/web/pdf_history.js +190 -53
  140. package/lib/web/pdf_link_service.js +144 -79
  141. package/lib/web/pdf_outline_viewer.js +124 -47
  142. package/lib/web/pdf_page_view.js +194 -74
  143. package/lib/web/pdf_presentation_mode.js +99 -34
  144. package/lib/web/pdf_print_service.js +59 -13
  145. package/lib/web/pdf_rendering_queue.js +28 -9
  146. package/lib/web/pdf_sidebar.js +144 -81
  147. package/lib/web/pdf_sidebar_resizer.js +42 -16
  148. package/lib/web/pdf_single_page_viewer.js +74 -66
  149. package/lib/web/pdf_thumbnail_view.js +104 -33
  150. package/lib/web/pdf_thumbnail_viewer.js +66 -26
  151. package/lib/web/pdf_viewer.component.js +112 -32
  152. package/lib/web/pdf_viewer.js +82 -87
  153. package/lib/web/preferences.js +284 -91
  154. package/lib/web/secondary_toolbar.js +132 -59
  155. package/lib/web/text_layer_builder.js +134 -59
  156. package/lib/web/toolbar.js +80 -43
  157. package/lib/web/ui_utils.js +400 -134
  158. package/lib/web/view_history.js +215 -67
  159. package/lib/web/viewer_compatibility.js +3 -8
  160. package/package.json +3 -2
  161. package/web/pdf_viewer.css +23 -15
  162. package/web/pdf_viewer.js +3429 -1245
  163. package/web/pdf_viewer.js.map +1 -1
  164. package/external/streams/streams-lib.js +0 -3962
  165. package/lib/display/dom_utils.js +0 -429
  166. package/lib/test/unit/dom_utils_spec.js +0 -89
  167. package/lib/test/unit/fonts_spec.js +0 -81
  168. package/lib/web/dom_events.js +0 -137
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2017 Mozilla Foundation
5
+ * Copyright 2019 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -19,482 +19,689 @@
19
19
  * @licend The above is the entire license notice for the
20
20
  * Javascript code in this page
21
21
  */
22
- 'use strict';
22
+ "use strict";
23
23
 
24
24
  Object.defineProperty(exports, "__esModule", {
25
25
  value: true
26
26
  });
27
- exports.NetworkManager = exports.PDFNetworkStream = undefined;
27
+ exports.PDFNetworkStream = void 0;
28
28
 
29
- var _util = require('../shared/util');
29
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
30
30
 
31
- var _network_utils = require('./network_utils');
31
+ var _util = require("../shared/util");
32
32
 
33
- var _global_scope = require('../shared/global_scope');
34
-
35
- var _global_scope2 = _interopRequireDefault(_global_scope);
33
+ var _network_utils = require("./network_utils");
36
34
 
37
35
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38
36
 
37
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
38
+
39
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
40
+
41
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
42
+
43
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
44
+
45
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
46
+
39
47
  ;
40
48
  var OK_RESPONSE = 200;
41
49
  var PARTIAL_CONTENT_RESPONSE = 206;
42
- function NetworkManager(url, args) {
43
- this.url = url;
44
- args = args || {};
45
- this.isHttp = /^https?:/i.test(url);
46
- this.httpHeaders = this.isHttp && args.httpHeaders || {};
47
- this.withCredentials = args.withCredentials || false;
48
- this.getXhr = args.getXhr || function NetworkManager_getXhr() {
49
- return new XMLHttpRequest();
50
- };
51
- this.currXhrId = 0;
52
- this.pendingRequests = Object.create(null);
53
- this.loadedRequests = Object.create(null);
54
- }
50
+
55
51
  function getArrayBuffer(xhr) {
56
52
  var data = xhr.response;
53
+
57
54
  if (typeof data !== 'string') {
58
55
  return data;
59
56
  }
57
+
60
58
  var array = (0, _util.stringToBytes)(data);
61
59
  return array.buffer;
62
60
  }
63
- var supportsMozChunked = function supportsMozChunkedClosure() {
64
- try {
65
- var x = new XMLHttpRequest();
66
- x.open('GET', _global_scope2.default.location.href);
67
- x.responseType = 'moz-chunked-arraybuffer';
68
- return x.responseType === 'moz-chunked-arraybuffer';
69
- } catch (e) {
70
- return false;
71
- }
72
- }();
73
- NetworkManager.prototype = {
74
- requestRange: function NetworkManager_requestRange(begin, end, listeners) {
75
- var args = {
76
- begin: begin,
77
- end: end
61
+
62
+ var NetworkManager =
63
+ /*#__PURE__*/
64
+ function () {
65
+ function NetworkManager(url, args) {
66
+ _classCallCheck(this, NetworkManager);
67
+
68
+ this.url = url;
69
+ args = args || {};
70
+ this.isHttp = /^https?:/i.test(url);
71
+ this.httpHeaders = this.isHttp && args.httpHeaders || {};
72
+ this.withCredentials = args.withCredentials || false;
73
+
74
+ this.getXhr = args.getXhr || function NetworkManager_getXhr() {
75
+ return new XMLHttpRequest();
78
76
  };
79
- for (var prop in listeners) {
80
- args[prop] = listeners[prop];
81
- }
82
- return this.request(args);
83
- },
84
- requestFull: function NetworkManager_requestFull(listeners) {
85
- return this.request(listeners);
86
- },
87
- request: function NetworkManager_request(args) {
88
- var xhr = this.getXhr();
89
- var xhrId = this.currXhrId++;
90
- var pendingRequest = this.pendingRequests[xhrId] = { xhr: xhr };
91
- xhr.open('GET', this.url);
92
- xhr.withCredentials = this.withCredentials;
93
- for (var property in this.httpHeaders) {
94
- var value = this.httpHeaders[property];
95
- if (typeof value === 'undefined') {
96
- continue;
77
+
78
+ this.currXhrId = 0;
79
+ this.pendingRequests = Object.create(null);
80
+ }
81
+
82
+ _createClass(NetworkManager, [{
83
+ key: "requestRange",
84
+ value: function requestRange(begin, end, listeners) {
85
+ var args = {
86
+ begin: begin,
87
+ end: end
88
+ };
89
+
90
+ for (var prop in listeners) {
91
+ args[prop] = listeners[prop];
97
92
  }
98
- xhr.setRequestHeader(property, value);
99
- }
100
- if (this.isHttp && 'begin' in args && 'end' in args) {
101
- var rangeStr = args.begin + '-' + (args.end - 1);
102
- xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
103
- pendingRequest.expectedStatus = 206;
104
- } else {
105
- pendingRequest.expectedStatus = 200;
106
- }
107
- var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
108
- if (useMozChunkedLoading) {
109
- xhr.responseType = 'moz-chunked-arraybuffer';
110
- pendingRequest.onProgressiveData = args.onProgressiveData;
111
- pendingRequest.mozChunked = true;
112
- } else {
113
- xhr.responseType = 'arraybuffer';
114
- }
115
- if (args.onError) {
116
- xhr.onerror = function (evt) {
117
- args.onError(xhr.status);
93
+
94
+ return this.request(args);
95
+ }
96
+ }, {
97
+ key: "requestFull",
98
+ value: function requestFull(listeners) {
99
+ return this.request(listeners);
100
+ }
101
+ }, {
102
+ key: "request",
103
+ value: function request(args) {
104
+ var xhr = this.getXhr();
105
+ var xhrId = this.currXhrId++;
106
+ var pendingRequest = this.pendingRequests[xhrId] = {
107
+ xhr: xhr
118
108
  };
119
- }
120
- xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
121
- xhr.onprogress = this.onProgress.bind(this, xhrId);
122
- pendingRequest.onHeadersReceived = args.onHeadersReceived;
123
- pendingRequest.onDone = args.onDone;
124
- pendingRequest.onError = args.onError;
125
- pendingRequest.onProgress = args.onProgress;
126
- xhr.send(null);
127
- return xhrId;
128
- },
129
- onProgress: function NetworkManager_onProgress(xhrId, evt) {
130
- var pendingRequest = this.pendingRequests[xhrId];
131
- if (!pendingRequest) {
132
- return;
133
- }
134
- if (pendingRequest.mozChunked) {
135
- var chunk = getArrayBuffer(pendingRequest.xhr);
136
- pendingRequest.onProgressiveData(chunk);
137
- }
138
- var onProgress = pendingRequest.onProgress;
139
- if (onProgress) {
140
- onProgress(evt);
141
- }
142
- },
143
- onStateChange: function NetworkManager_onStateChange(xhrId, evt) {
144
- var pendingRequest = this.pendingRequests[xhrId];
145
- if (!pendingRequest) {
146
- return;
147
- }
148
- var xhr = pendingRequest.xhr;
149
- if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
150
- pendingRequest.onHeadersReceived();
151
- delete pendingRequest.onHeadersReceived;
152
- }
153
- if (xhr.readyState !== 4) {
154
- return;
155
- }
156
- if (!(xhrId in this.pendingRequests)) {
157
- return;
158
- }
159
- delete this.pendingRequests[xhrId];
160
- if (xhr.status === 0 && this.isHttp) {
161
- if (pendingRequest.onError) {
162
- pendingRequest.onError(xhr.status);
109
+ xhr.open('GET', this.url);
110
+ xhr.withCredentials = this.withCredentials;
111
+
112
+ for (var property in this.httpHeaders) {
113
+ var value = this.httpHeaders[property];
114
+
115
+ if (typeof value === 'undefined') {
116
+ continue;
117
+ }
118
+
119
+ xhr.setRequestHeader(property, value);
120
+ }
121
+
122
+ if (this.isHttp && 'begin' in args && 'end' in args) {
123
+ xhr.setRequestHeader('Range', "bytes=".concat(args.begin, "-").concat(args.end - 1));
124
+ pendingRequest.expectedStatus = PARTIAL_CONTENT_RESPONSE;
125
+ } else {
126
+ pendingRequest.expectedStatus = OK_RESPONSE;
127
+ }
128
+
129
+ xhr.responseType = 'arraybuffer';
130
+
131
+ if (args.onError) {
132
+ xhr.onerror = function (evt) {
133
+ args.onError(xhr.status);
134
+ };
135
+ }
136
+
137
+ xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
138
+ xhr.onprogress = this.onProgress.bind(this, xhrId);
139
+ pendingRequest.onHeadersReceived = args.onHeadersReceived;
140
+ pendingRequest.onDone = args.onDone;
141
+ pendingRequest.onError = args.onError;
142
+ pendingRequest.onProgress = args.onProgress;
143
+ xhr.send(null);
144
+ return xhrId;
145
+ }
146
+ }, {
147
+ key: "onProgress",
148
+ value: function onProgress(xhrId, evt) {
149
+ var pendingRequest = this.pendingRequests[xhrId];
150
+
151
+ if (!pendingRequest) {
152
+ return;
153
+ }
154
+
155
+ if (pendingRequest.onProgress) {
156
+ pendingRequest.onProgress(evt);
163
157
  }
164
- return;
165
158
  }
166
- var xhrStatus = xhr.status || OK_RESPONSE;
167
- var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
168
- if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
169
- if (pendingRequest.onError) {
159
+ }, {
160
+ key: "onStateChange",
161
+ value: function onStateChange(xhrId, evt) {
162
+ var pendingRequest = this.pendingRequests[xhrId];
163
+
164
+ if (!pendingRequest) {
165
+ return;
166
+ }
167
+
168
+ var xhr = pendingRequest.xhr;
169
+
170
+ if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
171
+ pendingRequest.onHeadersReceived();
172
+ delete pendingRequest.onHeadersReceived;
173
+ }
174
+
175
+ if (xhr.readyState !== 4) {
176
+ return;
177
+ }
178
+
179
+ if (!(xhrId in this.pendingRequests)) {
180
+ return;
181
+ }
182
+
183
+ delete this.pendingRequests[xhrId];
184
+
185
+ if (xhr.status === 0 && this.isHttp) {
186
+ if (pendingRequest.onError) {
187
+ pendingRequest.onError(xhr.status);
188
+ }
189
+
190
+ return;
191
+ }
192
+
193
+ var xhrStatus = xhr.status || OK_RESPONSE;
194
+ var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
195
+
196
+ if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
197
+ if (pendingRequest.onError) {
198
+ pendingRequest.onError(xhr.status);
199
+ }
200
+
201
+ return;
202
+ }
203
+
204
+ var chunk = getArrayBuffer(xhr);
205
+
206
+ if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
207
+ var rangeHeader = xhr.getResponseHeader('Content-Range');
208
+ var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
209
+ pendingRequest.onDone({
210
+ begin: parseInt(matches[1], 10),
211
+ chunk: chunk
212
+ });
213
+ } else if (chunk) {
214
+ pendingRequest.onDone({
215
+ begin: 0,
216
+ chunk: chunk
217
+ });
218
+ } else if (pendingRequest.onError) {
170
219
  pendingRequest.onError(xhr.status);
171
220
  }
172
- return;
173
221
  }
174
- this.loadedRequests[xhrId] = true;
175
- var chunk = getArrayBuffer(xhr);
176
- if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
177
- var rangeHeader = xhr.getResponseHeader('Content-Range');
178
- var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
179
- var begin = parseInt(matches[1], 10);
180
- pendingRequest.onDone({
181
- begin: begin,
182
- chunk: chunk
183
- });
184
- } else if (pendingRequest.onProgressiveData) {
185
- pendingRequest.onDone(null);
186
- } else if (chunk) {
187
- pendingRequest.onDone({
188
- begin: 0,
189
- chunk: chunk
190
- });
191
- } else if (pendingRequest.onError) {
192
- pendingRequest.onError(xhr.status);
193
- }
194
- },
195
- hasPendingRequests: function NetworkManager_hasPendingRequests() {
196
- for (var xhrId in this.pendingRequests) {
197
- return true;
198
- }
199
- return false;
200
- },
201
- getRequestXhr: function NetworkManager_getXhr(xhrId) {
202
- return this.pendingRequests[xhrId].xhr;
203
- },
204
- isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {
205
- return !!this.pendingRequests[xhrId].onProgressiveData;
206
- },
207
- isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {
208
- return xhrId in this.pendingRequests;
209
- },
210
- isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {
211
- return xhrId in this.loadedRequests;
212
- },
213
- abortAllRequests: function NetworkManager_abortAllRequests() {
214
- for (var xhrId in this.pendingRequests) {
215
- this.abortRequest(xhrId | 0);
216
- }
217
- },
218
- abortRequest: function NetworkManager_abortRequest(xhrId) {
219
- var xhr = this.pendingRequests[xhrId].xhr;
220
- delete this.pendingRequests[xhrId];
221
- xhr.abort();
222
- }
223
- };
224
- function PDFNetworkStream(source) {
225
- this._source = source;
226
- this._manager = new NetworkManager(source.url, {
227
- httpHeaders: source.httpHeaders,
228
- withCredentials: source.withCredentials
229
- });
230
- this._rangeChunkSize = source.rangeChunkSize;
231
- this._fullRequestReader = null;
232
- this._rangeRequestReaders = [];
233
- }
234
- PDFNetworkStream.prototype = {
235
- _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) {
236
- var i = this._rangeRequestReaders.indexOf(reader);
237
- if (i >= 0) {
238
- this._rangeRequestReaders.splice(i, 1);
222
+ }, {
223
+ key: "hasPendingRequests",
224
+ value: function hasPendingRequests() {
225
+ for (var xhrId in this.pendingRequests) {
226
+ return true;
227
+ }
228
+
229
+ return false;
230
+ }
231
+ }, {
232
+ key: "getRequestXhr",
233
+ value: function getRequestXhr(xhrId) {
234
+ return this.pendingRequests[xhrId].xhr;
235
+ }
236
+ }, {
237
+ key: "isPendingRequest",
238
+ value: function isPendingRequest(xhrId) {
239
+ return xhrId in this.pendingRequests;
240
+ }
241
+ }, {
242
+ key: "abortAllRequests",
243
+ value: function abortAllRequests() {
244
+ for (var xhrId in this.pendingRequests) {
245
+ this.abortRequest(xhrId | 0);
246
+ }
239
247
  }
240
- },
241
- getFullReader: function PDFNetworkStream_getFullReader() {
242
- (0, _util.assert)(!this._fullRequestReader);
243
- this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source);
244
- return this._fullRequestReader;
245
- },
246
- getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) {
247
- var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
248
- reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
249
- this._rangeRequestReaders.push(reader);
250
- return reader;
251
- },
252
- cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) {
253
- if (this._fullRequestReader) {
254
- this._fullRequestReader.cancel(reason);
248
+ }, {
249
+ key: "abortRequest",
250
+ value: function abortRequest(xhrId) {
251
+ var xhr = this.pendingRequests[xhrId].xhr;
252
+ delete this.pendingRequests[xhrId];
253
+ xhr.abort();
255
254
  }
256
- var readers = this._rangeRequestReaders.slice(0);
257
- readers.forEach(function (reader) {
258
- reader.cancel(reason);
255
+ }]);
256
+
257
+ return NetworkManager;
258
+ }();
259
+
260
+ var PDFNetworkStream =
261
+ /*#__PURE__*/
262
+ function () {
263
+ function PDFNetworkStream(source) {
264
+ _classCallCheck(this, PDFNetworkStream);
265
+
266
+ this._source = source;
267
+ this._manager = new NetworkManager(source.url, {
268
+ httpHeaders: source.httpHeaders,
269
+ withCredentials: source.withCredentials
259
270
  });
271
+ this._rangeChunkSize = source.rangeChunkSize;
272
+ this._fullRequestReader = null;
273
+ this._rangeRequestReaders = [];
260
274
  }
261
- };
262
- function PDFNetworkStreamFullRequestReader(manager, source) {
263
- this._manager = manager;
264
- var args = {
265
- onHeadersReceived: this._onHeadersReceived.bind(this),
266
- onProgressiveData: source.disableStream ? null : this._onProgressiveData.bind(this),
267
- onDone: this._onDone.bind(this),
268
- onError: this._onError.bind(this),
269
- onProgress: this._onProgress.bind(this)
270
- };
271
- this._url = source.url;
272
- this._fullRequestId = manager.requestFull(args);
273
- this._headersReceivedCapability = (0, _util.createPromiseCapability)();
274
- this._disableRange = source.disableRange || false;
275
- this._contentLength = source.length;
276
- this._rangeChunkSize = source.rangeChunkSize;
277
- if (!this._rangeChunkSize && !this._disableRange) {
278
- this._disableRange = true;
279
- }
280
- this._isStreamingSupported = false;
281
- this._isRangeSupported = false;
282
- this._cachedChunks = [];
283
- this._requests = [];
284
- this._done = false;
285
- this._storedError = undefined;
286
- this._filename = null;
287
- this.onProgress = null;
288
- }
289
- PDFNetworkStreamFullRequestReader.prototype = {
290
- _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
291
- var fullRequestXhrId = this._fullRequestId;
292
- var fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);
293
- var getResponseHeader = function getResponseHeader(name) {
294
- return fullRequestXhr.getResponseHeader(name);
295
- };
296
275
 
297
- var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
298
- getResponseHeader: getResponseHeader,
299
- isHttp: this._manager.isHttp,
300
- rangeChunkSize: this._rangeChunkSize,
301
- disableRange: this._disableRange
302
- }),
303
- allowRangeRequests = _validateRangeRequest.allowRangeRequests,
304
- suggestedLength = _validateRangeRequest.suggestedLength;
305
-
306
- if (allowRangeRequests) {
307
- this._isRangeSupported = true;
276
+ _createClass(PDFNetworkStream, [{
277
+ key: "_onRangeRequestReaderClosed",
278
+ value: function _onRangeRequestReaderClosed(reader) {
279
+ var i = this._rangeRequestReaders.indexOf(reader);
280
+
281
+ if (i >= 0) {
282
+ this._rangeRequestReaders.splice(i, 1);
283
+ }
308
284
  }
309
- this._contentLength = suggestedLength || this._contentLength;
310
- this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
311
- var networkManager = this._manager;
312
- if (networkManager.isStreamingRequest(fullRequestXhrId)) {
313
- this._isStreamingSupported = true;
314
- } else if (this._isRangeSupported) {
315
- networkManager.abortRequest(fullRequestXhrId);
285
+ }, {
286
+ key: "getFullReader",
287
+ value: function getFullReader() {
288
+ (0, _util.assert)(!this._fullRequestReader);
289
+ this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source);
290
+ return this._fullRequestReader;
291
+ }
292
+ }, {
293
+ key: "getRangeReader",
294
+ value: function getRangeReader(begin, end) {
295
+ var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
296
+ reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
297
+
298
+ this._rangeRequestReaders.push(reader);
299
+
300
+ return reader;
316
301
  }
317
- this._headersReceivedCapability.resolve();
318
- },
319
- _onProgressiveData: function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) {
320
- if (this._requests.length > 0) {
321
- var requestCapability = this._requests.shift();
322
- requestCapability.resolve({
323
- value: chunk,
324
- done: false
302
+ }, {
303
+ key: "cancelAllRequests",
304
+ value: function cancelAllRequests(reason) {
305
+ if (this._fullRequestReader) {
306
+ this._fullRequestReader.cancel(reason);
307
+ }
308
+
309
+ var readers = this._rangeRequestReaders.slice(0);
310
+
311
+ readers.forEach(function (reader) {
312
+ reader.cancel(reason);
325
313
  });
326
- } else {
327
- this._cachedChunks.push(chunk);
328
- }
329
- },
330
- _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) {
331
- if (args) {
332
- this._onProgressiveData(args.chunk);
333
314
  }
334
- this._done = true;
335
- if (this._cachedChunks.length > 0) {
336
- return;
315
+ }]);
316
+
317
+ return PDFNetworkStream;
318
+ }();
319
+
320
+ exports.PDFNetworkStream = PDFNetworkStream;
321
+
322
+ var PDFNetworkStreamFullRequestReader =
323
+ /*#__PURE__*/
324
+ function () {
325
+ function PDFNetworkStreamFullRequestReader(manager, source) {
326
+ _classCallCheck(this, PDFNetworkStreamFullRequestReader);
327
+
328
+ this._manager = manager;
329
+ var args = {
330
+ onHeadersReceived: this._onHeadersReceived.bind(this),
331
+ onDone: this._onDone.bind(this),
332
+ onError: this._onError.bind(this),
333
+ onProgress: this._onProgress.bind(this)
334
+ };
335
+ this._url = source.url;
336
+ this._fullRequestId = manager.requestFull(args);
337
+ this._headersReceivedCapability = (0, _util.createPromiseCapability)();
338
+ this._disableRange = source.disableRange || false;
339
+ this._contentLength = source.length;
340
+ this._rangeChunkSize = source.rangeChunkSize;
341
+
342
+ if (!this._rangeChunkSize && !this._disableRange) {
343
+ this._disableRange = true;
337
344
  }
338
- this._requests.forEach(function (requestCapability) {
339
- requestCapability.resolve({
340
- value: undefined,
341
- done: true
342
- });
343
- });
344
- this._requests = [];
345
- },
346
- _onError: function PDFNetworkStreamFullRequestReader_onError(status) {
347
- var url = this._url;
348
- var exception = (0, _network_utils.createResponseStatusError)(status, url);
349
- this._storedError = exception;
350
- this._headersReceivedCapability.reject(exception);
351
- this._requests.forEach(function (requestCapability) {
352
- requestCapability.reject(exception);
353
- });
354
- this._requests = [];
345
+
346
+ this._isStreamingSupported = false;
347
+ this._isRangeSupported = false;
355
348
  this._cachedChunks = [];
356
- },
357
- _onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) {
358
- if (this.onProgress) {
359
- this.onProgress({
360
- loaded: data.loaded,
361
- total: data.lengthComputable ? data.total : this._contentLength
362
- });
363
- }
364
- },
365
- get filename() {
366
- return this._filename;
367
- },
368
- get isRangeSupported() {
369
- return this._isRangeSupported;
370
- },
371
- get isStreamingSupported() {
372
- return this._isStreamingSupported;
373
- },
374
- get contentLength() {
375
- return this._contentLength;
376
- },
377
- get headersReady() {
378
- return this._headersReceivedCapability.promise;
379
- },
380
- read: function PDFNetworkStreamFullRequestReader_read() {
381
- if (this._storedError) {
382
- return Promise.reject(this._storedError);
383
- }
384
- if (this._cachedChunks.length > 0) {
385
- var chunk = this._cachedChunks.shift();
386
- return Promise.resolve({
387
- value: chunk,
388
- done: false
389
- });
390
- }
391
- if (this._done) {
392
- return Promise.resolve({
393
- value: undefined,
394
- done: true
395
- });
396
- }
397
- var requestCapability = (0, _util.createPromiseCapability)();
398
- this._requests.push(requestCapability);
399
- return requestCapability.promise;
400
- },
401
- cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) {
402
- this._done = true;
403
- this._headersReceivedCapability.reject(reason);
404
- this._requests.forEach(function (requestCapability) {
405
- requestCapability.resolve({
406
- value: undefined,
407
- done: true
408
- });
409
- });
410
349
  this._requests = [];
411
- if (this._manager.isPendingRequest(this._fullRequestId)) {
412
- this._manager.abortRequest(this._fullRequestId);
413
- }
414
- this._fullRequestReader = null;
350
+ this._done = false;
351
+ this._storedError = undefined;
352
+ this._filename = null;
353
+ this.onProgress = null;
415
354
  }
416
- };
417
- function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
418
- this._manager = manager;
419
- var args = {
420
- onDone: this._onDone.bind(this),
421
- onProgress: this._onProgress.bind(this)
422
- };
423
- this._requestId = manager.requestRange(begin, end, args);
424
- this._requests = [];
425
- this._queuedChunk = null;
426
- this._done = false;
427
- this.onProgress = null;
428
- this.onClosed = null;
429
- }
430
- PDFNetworkStreamRangeRequestReader.prototype = {
431
- _close: function PDFNetworkStreamRangeRequestReader_close() {
432
- if (this.onClosed) {
433
- this.onClosed(this);
434
- }
435
- },
436
- _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) {
437
- var chunk = data.chunk;
438
- if (this._requests.length > 0) {
439
- var requestCapability = this._requests.shift();
440
- requestCapability.resolve({
441
- value: chunk,
442
- done: false
355
+
356
+ _createClass(PDFNetworkStreamFullRequestReader, [{
357
+ key: "_onHeadersReceived",
358
+ value: function _onHeadersReceived() {
359
+ var fullRequestXhrId = this._fullRequestId;
360
+
361
+ var fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);
362
+
363
+ var getResponseHeader = function getResponseHeader(name) {
364
+ return fullRequestXhr.getResponseHeader(name);
365
+ };
366
+
367
+ var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
368
+ getResponseHeader: getResponseHeader,
369
+ isHttp: this._manager.isHttp,
370
+ rangeChunkSize: this._rangeChunkSize,
371
+ disableRange: this._disableRange
372
+ }),
373
+ allowRangeRequests = _validateRangeRequest.allowRangeRequests,
374
+ suggestedLength = _validateRangeRequest.suggestedLength;
375
+
376
+ if (allowRangeRequests) {
377
+ this._isRangeSupported = true;
378
+ }
379
+
380
+ this._contentLength = suggestedLength || this._contentLength;
381
+ this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
382
+
383
+ if (this._isRangeSupported) {
384
+ this._manager.abortRequest(fullRequestXhrId);
385
+ }
386
+
387
+ this._headersReceivedCapability.resolve();
388
+ }
389
+ }, {
390
+ key: "_onDone",
391
+ value: function _onDone(args) {
392
+ if (args) {
393
+ if (this._requests.length > 0) {
394
+ var requestCapability = this._requests.shift();
395
+
396
+ requestCapability.resolve({
397
+ value: args.chunk,
398
+ done: false
399
+ });
400
+ } else {
401
+ this._cachedChunks.push(args.chunk);
402
+ }
403
+ }
404
+
405
+ this._done = true;
406
+
407
+ if (this._cachedChunks.length > 0) {
408
+ return;
409
+ }
410
+
411
+ this._requests.forEach(function (requestCapability) {
412
+ requestCapability.resolve({
413
+ value: undefined,
414
+ done: true
415
+ });
443
416
  });
444
- } else {
445
- this._queuedChunk = chunk;
417
+
418
+ this._requests = [];
419
+ }
420
+ }, {
421
+ key: "_onError",
422
+ value: function _onError(status) {
423
+ var url = this._url;
424
+ var exception = (0, _network_utils.createResponseStatusError)(status, url);
425
+ this._storedError = exception;
426
+
427
+ this._headersReceivedCapability.reject(exception);
428
+
429
+ this._requests.forEach(function (requestCapability) {
430
+ requestCapability.reject(exception);
431
+ });
432
+
433
+ this._requests = [];
434
+ this._cachedChunks = [];
435
+ }
436
+ }, {
437
+ key: "_onProgress",
438
+ value: function _onProgress(data) {
439
+ if (this.onProgress) {
440
+ this.onProgress({
441
+ loaded: data.loaded,
442
+ total: data.lengthComputable ? data.total : this._contentLength
443
+ });
444
+ }
446
445
  }
447
- this._done = true;
448
- this._requests.forEach(function (requestCapability) {
449
- requestCapability.resolve({
450
- value: undefined,
451
- done: true
446
+ }, {
447
+ key: "read",
448
+ value: function () {
449
+ var _read = _asyncToGenerator(
450
+ /*#__PURE__*/
451
+ _regenerator["default"].mark(function _callee() {
452
+ var chunk, requestCapability;
453
+ return _regenerator["default"].wrap(function _callee$(_context) {
454
+ while (1) {
455
+ switch (_context.prev = _context.next) {
456
+ case 0:
457
+ if (!this._storedError) {
458
+ _context.next = 2;
459
+ break;
460
+ }
461
+
462
+ throw this._storedError;
463
+
464
+ case 2:
465
+ if (!(this._cachedChunks.length > 0)) {
466
+ _context.next = 5;
467
+ break;
468
+ }
469
+
470
+ chunk = this._cachedChunks.shift();
471
+ return _context.abrupt("return", {
472
+ value: chunk,
473
+ done: false
474
+ });
475
+
476
+ case 5:
477
+ if (!this._done) {
478
+ _context.next = 7;
479
+ break;
480
+ }
481
+
482
+ return _context.abrupt("return", {
483
+ value: undefined,
484
+ done: true
485
+ });
486
+
487
+ case 7:
488
+ requestCapability = (0, _util.createPromiseCapability)();
489
+
490
+ this._requests.push(requestCapability);
491
+
492
+ return _context.abrupt("return", requestCapability.promise);
493
+
494
+ case 10:
495
+ case "end":
496
+ return _context.stop();
497
+ }
498
+ }
499
+ }, _callee, this);
500
+ }));
501
+
502
+ function read() {
503
+ return _read.apply(this, arguments);
504
+ }
505
+
506
+ return read;
507
+ }()
508
+ }, {
509
+ key: "cancel",
510
+ value: function cancel(reason) {
511
+ this._done = true;
512
+
513
+ this._headersReceivedCapability.reject(reason);
514
+
515
+ this._requests.forEach(function (requestCapability) {
516
+ requestCapability.resolve({
517
+ value: undefined,
518
+ done: true
519
+ });
452
520
  });
453
- });
521
+
522
+ this._requests = [];
523
+
524
+ if (this._manager.isPendingRequest(this._fullRequestId)) {
525
+ this._manager.abortRequest(this._fullRequestId);
526
+ }
527
+
528
+ this._fullRequestReader = null;
529
+ }
530
+ }, {
531
+ key: "filename",
532
+ get: function get() {
533
+ return this._filename;
534
+ }
535
+ }, {
536
+ key: "isRangeSupported",
537
+ get: function get() {
538
+ return this._isRangeSupported;
539
+ }
540
+ }, {
541
+ key: "isStreamingSupported",
542
+ get: function get() {
543
+ return this._isStreamingSupported;
544
+ }
545
+ }, {
546
+ key: "contentLength",
547
+ get: function get() {
548
+ return this._contentLength;
549
+ }
550
+ }, {
551
+ key: "headersReady",
552
+ get: function get() {
553
+ return this._headersReceivedCapability.promise;
554
+ }
555
+ }]);
556
+
557
+ return PDFNetworkStreamFullRequestReader;
558
+ }();
559
+
560
+ var PDFNetworkStreamRangeRequestReader =
561
+ /*#__PURE__*/
562
+ function () {
563
+ function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
564
+ _classCallCheck(this, PDFNetworkStreamRangeRequestReader);
565
+
566
+ this._manager = manager;
567
+ var args = {
568
+ onDone: this._onDone.bind(this),
569
+ onProgress: this._onProgress.bind(this)
570
+ };
571
+ this._requestId = manager.requestRange(begin, end, args);
454
572
  this._requests = [];
455
- this._close();
456
- },
457
- _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) {
458
- if (!this.isStreamingSupported && this.onProgress) {
459
- this.onProgress({ loaded: evt.loaded });
573
+ this._queuedChunk = null;
574
+ this._done = false;
575
+ this.onProgress = null;
576
+ this.onClosed = null;
577
+ }
578
+
579
+ _createClass(PDFNetworkStreamRangeRequestReader, [{
580
+ key: "_close",
581
+ value: function _close() {
582
+ if (this.onClosed) {
583
+ this.onClosed(this);
584
+ }
460
585
  }
461
- },
462
- get isStreamingSupported() {
463
- return false;
464
- },
465
- read: function PDFNetworkStreamRangeRequestReader_read() {
466
- if (this._queuedChunk !== null) {
467
- var chunk = this._queuedChunk;
468
- this._queuedChunk = null;
469
- return Promise.resolve({
470
- value: chunk,
471
- done: false
586
+ }, {
587
+ key: "_onDone",
588
+ value: function _onDone(data) {
589
+ var chunk = data.chunk;
590
+
591
+ if (this._requests.length > 0) {
592
+ var requestCapability = this._requests.shift();
593
+
594
+ requestCapability.resolve({
595
+ value: chunk,
596
+ done: false
597
+ });
598
+ } else {
599
+ this._queuedChunk = chunk;
600
+ }
601
+
602
+ this._done = true;
603
+
604
+ this._requests.forEach(function (requestCapability) {
605
+ requestCapability.resolve({
606
+ value: undefined,
607
+ done: true
608
+ });
472
609
  });
610
+
611
+ this._requests = [];
612
+
613
+ this._close();
614
+ }
615
+ }, {
616
+ key: "_onProgress",
617
+ value: function _onProgress(evt) {
618
+ if (!this.isStreamingSupported && this.onProgress) {
619
+ this.onProgress({
620
+ loaded: evt.loaded
621
+ });
622
+ }
473
623
  }
474
- if (this._done) {
475
- return Promise.resolve({
476
- value: undefined,
477
- done: true
624
+ }, {
625
+ key: "read",
626
+ value: function () {
627
+ var _read2 = _asyncToGenerator(
628
+ /*#__PURE__*/
629
+ _regenerator["default"].mark(function _callee2() {
630
+ var chunk, requestCapability;
631
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
632
+ while (1) {
633
+ switch (_context2.prev = _context2.next) {
634
+ case 0:
635
+ if (!(this._queuedChunk !== null)) {
636
+ _context2.next = 4;
637
+ break;
638
+ }
639
+
640
+ chunk = this._queuedChunk;
641
+ this._queuedChunk = null;
642
+ return _context2.abrupt("return", {
643
+ value: chunk,
644
+ done: false
645
+ });
646
+
647
+ case 4:
648
+ if (!this._done) {
649
+ _context2.next = 6;
650
+ break;
651
+ }
652
+
653
+ return _context2.abrupt("return", {
654
+ value: undefined,
655
+ done: true
656
+ });
657
+
658
+ case 6:
659
+ requestCapability = (0, _util.createPromiseCapability)();
660
+
661
+ this._requests.push(requestCapability);
662
+
663
+ return _context2.abrupt("return", requestCapability.promise);
664
+
665
+ case 9:
666
+ case "end":
667
+ return _context2.stop();
668
+ }
669
+ }
670
+ }, _callee2, this);
671
+ }));
672
+
673
+ function read() {
674
+ return _read2.apply(this, arguments);
675
+ }
676
+
677
+ return read;
678
+ }()
679
+ }, {
680
+ key: "cancel",
681
+ value: function cancel(reason) {
682
+ this._done = true;
683
+
684
+ this._requests.forEach(function (requestCapability) {
685
+ requestCapability.resolve({
686
+ value: undefined,
687
+ done: true
688
+ });
478
689
  });
690
+
691
+ this._requests = [];
692
+
693
+ if (this._manager.isPendingRequest(this._requestId)) {
694
+ this._manager.abortRequest(this._requestId);
695
+ }
696
+
697
+ this._close();
479
698
  }
480
- var requestCapability = (0, _util.createPromiseCapability)();
481
- this._requests.push(requestCapability);
482
- return requestCapability.promise;
483
- },
484
- cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) {
485
- this._done = true;
486
- this._requests.forEach(function (requestCapability) {
487
- requestCapability.resolve({
488
- value: undefined,
489
- done: true
490
- });
491
- });
492
- this._requests = [];
493
- if (this._manager.isPendingRequest(this._requestId)) {
494
- this._manager.abortRequest(this._requestId);
699
+ }, {
700
+ key: "isStreamingSupported",
701
+ get: function get() {
702
+ return false;
495
703
  }
496
- this._close();
497
- }
498
- };
499
- exports.PDFNetworkStream = PDFNetworkStream;
500
- exports.NetworkManager = NetworkManager;
704
+ }]);
705
+
706
+ return PDFNetworkStreamRangeRequestReader;
707
+ }();