pdfjs-dist 2.0.487 → 2.1.266
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.
- package/bower.json +1 -1
- package/build/pdf.js +15564 -9476
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +46644 -36309
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/external/url/url-lib.js +627 -0
- package/image_decoders/pdf.image_decoders.js +11430 -0
- package/image_decoders/pdf.image_decoders.js.map +1 -0
- package/image_decoders/pdf.image_decoders.min.js +1 -0
- package/lib/core/annotation.js +406 -131
- package/lib/core/arithmetic_decoder.js +275 -245
- package/lib/core/bidi.js +65 -6
- package/lib/core/ccitt.js +173 -18
- package/lib/core/ccitt_stream.js +15 -6
- package/lib/core/cff_parser.js +376 -53
- package/lib/core/charsets.js +5 -4
- package/lib/core/chunked_stream.js +387 -149
- package/lib/core/cmap.js +310 -75
- package/lib/core/colorspace.js +874 -594
- package/lib/core/crypto.js +290 -45
- package/lib/core/document.js +545 -260
- package/lib/core/encodings.js +19 -10
- package/lib/core/evaluator.js +725 -147
- package/lib/core/font_renderer.js +360 -91
- package/lib/core/fonts.js +791 -186
- package/lib/core/function.js +284 -71
- package/lib/core/glyphlist.js +3 -2
- package/lib/core/image.js +168 -61
- package/lib/core/jbig2.js +479 -66
- package/lib/core/jbig2_stream.js +19 -8
- package/lib/core/jpeg_stream.js +38 -13
- package/lib/core/jpg.js +252 -29
- package/lib/core/jpx.js +396 -6
- package/lib/core/jpx_stream.js +18 -6
- package/lib/core/metrics.js +4 -4
- package/lib/core/murmurhash3.js +24 -6
- package/lib/core/obj.js +1137 -475
- package/lib/core/operator_list.js +108 -6
- package/lib/core/parser.js +321 -68
- package/lib/core/pattern.js +145 -13
- package/lib/core/pdf_manager.js +321 -133
- package/lib/core/primitives.js +75 -22
- package/lib/core/ps_parser.js +134 -45
- package/lib/core/standard_fonts.js +10 -10
- package/lib/core/stream.js +313 -34
- package/lib/core/type1_parser.js +143 -13
- package/lib/core/unicode.js +31 -4
- package/lib/core/worker.js +210 -66
- package/lib/display/annotation_layer.js +361 -123
- package/lib/display/api.js +1454 -729
- package/lib/display/api_compatibility.js +11 -13
- package/lib/display/canvas.js +324 -29
- package/lib/display/content_disposition.js +83 -32
- package/lib/display/dom_utils.js +226 -41
- package/lib/display/fetch_stream.js +208 -84
- package/lib/display/font_loader.js +465 -236
- package/lib/display/metadata.js +38 -16
- package/lib/display/network.js +216 -51
- package/lib/display/network_utils.js +32 -19
- package/lib/display/node_stream.js +352 -169
- package/lib/display/pattern_helper.js +58 -7
- package/lib/display/svg.js +242 -29
- package/lib/display/text_layer.js +132 -18
- package/lib/display/transport_stream.js +171 -42
- package/lib/display/webgl.js +64 -18
- package/lib/display/worker_options.js +5 -4
- package/lib/display/xml_parser.js +166 -53
- package/lib/examples/node/domstubs.js +57 -4
- package/lib/pdf.js +21 -4
- package/lib/pdf.worker.js +5 -3
- package/lib/shared/compatibility.js +158 -564
- package/lib/shared/global_scope.js +2 -2
- package/lib/shared/is_node.js +4 -4
- package/lib/shared/message_handler.js +521 -0
- package/lib/shared/streams_polyfill.js +21 -17
- package/lib/shared/url_polyfill.js +56 -0
- package/lib/shared/util.js +295 -650
- package/lib/test/unit/annotation_spec.js +629 -345
- package/lib/test/unit/api_spec.js +555 -253
- package/lib/test/unit/bidi_spec.js +7 -7
- package/lib/test/unit/cff_parser_spec.js +40 -11
- package/lib/test/unit/clitests_helper.js +9 -7
- package/lib/test/unit/cmap_spec.js +80 -26
- package/lib/test/unit/colorspace_spec.js +99 -52
- package/lib/test/unit/crypto_spec.js +17 -5
- package/lib/test/unit/custom_spec.js +41 -53
- package/lib/test/unit/display_svg_spec.js +33 -17
- package/lib/test/unit/document_spec.js +3 -3
- package/lib/test/unit/dom_utils_spec.js +9 -9
- package/lib/test/unit/encodings_spec.js +25 -45
- package/lib/test/unit/evaluator_spec.js +34 -9
- package/lib/test/unit/function_spec.js +17 -5
- package/lib/test/unit/jasmine-boot.js +31 -18
- package/lib/test/unit/{util_stream_spec.js → message_handler_spec.js} +41 -69
- package/lib/test/unit/metadata_spec.js +71 -11
- package/lib/test/unit/murmurhash3_spec.js +3 -3
- package/lib/test/unit/network_spec.js +20 -5
- package/lib/test/unit/network_utils_spec.js +41 -14
- package/lib/test/unit/node_stream_spec.js +51 -27
- package/lib/test/unit/parser_spec.js +35 -8
- package/lib/test/unit/pdf_find_controller_spec.js +230 -0
- package/lib/test/unit/pdf_find_utils_spec.js +63 -0
- package/lib/test/unit/pdf_history_spec.js +21 -9
- package/lib/test/unit/primitives_spec.js +24 -4
- package/lib/test/unit/stream_spec.js +12 -4
- package/lib/test/unit/test_utils.js +90 -27
- package/lib/test/unit/testreporter.js +21 -3
- package/lib/test/unit/type1_parser_spec.js +8 -6
- package/lib/test/unit/ui_utils_spec.js +452 -14
- package/lib/test/unit/unicode_spec.js +14 -11
- package/lib/test/unit/util_spec.js +131 -9
- package/lib/web/annotation_layer_builder.js +39 -22
- package/lib/web/app.js +1240 -582
- package/lib/web/app_options.js +71 -41
- package/lib/web/base_viewer.js +508 -179
- package/lib/web/chromecom.js +261 -117
- package/lib/web/debugger.js +166 -22
- package/lib/web/download_manager.js +31 -13
- package/lib/web/firefox_print_service.js +17 -9
- package/lib/web/firefoxcom.js +283 -79
- package/lib/web/genericcom.js +89 -30
- package/lib/web/genericl10n.js +142 -30
- package/lib/web/grab_to_pan.js +26 -4
- package/lib/web/interfaces.js +170 -47
- package/lib/web/overlay_manager.js +235 -85
- package/lib/web/password_prompt.js +21 -13
- package/lib/web/pdf_attachment_viewer.js +38 -18
- package/lib/web/pdf_cursor_tools.js +39 -16
- package/lib/web/pdf_document_properties.js +80 -30
- package/lib/web/pdf_find_bar.js +84 -40
- package/lib/web/pdf_find_controller.js +495 -184
- package/lib/web/pdf_find_utils.js +111 -0
- package/lib/web/pdf_history.js +190 -53
- package/lib/web/pdf_link_service.js +137 -76
- package/lib/web/pdf_outline_viewer.js +73 -22
- package/lib/web/pdf_page_view.js +196 -63
- package/lib/web/pdf_presentation_mode.js +99 -34
- package/lib/web/pdf_print_service.js +57 -11
- package/lib/web/pdf_rendering_queue.js +27 -5
- package/lib/web/pdf_sidebar.js +120 -67
- package/lib/web/pdf_sidebar_resizer.js +42 -16
- package/lib/web/pdf_single_page_viewer.js +74 -66
- package/lib/web/pdf_thumbnail_view.js +103 -32
- package/lib/web/pdf_thumbnail_viewer.js +64 -24
- package/lib/web/pdf_viewer.component.js +112 -32
- package/lib/web/pdf_viewer.js +91 -52
- package/lib/web/preferences.js +275 -80
- package/lib/web/secondary_toolbar.js +165 -40
- package/lib/web/text_layer_builder.js +162 -65
- package/lib/web/toolbar.js +78 -43
- package/lib/web/ui_utils.js +462 -136
- package/lib/web/view_history.js +215 -67
- package/lib/web/viewer_compatibility.js +4 -13
- package/package.json +5 -4
- package/web/pdf_viewer.css +58 -1
- package/web/pdf_viewer.js +6346 -3919
- package/web/pdf_viewer.js.map +1 -1
- package/lib/test/unit/fonts_spec.js +0 -81
- 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
|
5
|
+
* Copyright 2018 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,32 +19,45 @@
|
|
19
19
|
* @licend The above is the entire license notice for the
|
20
20
|
* Javascript code in this page
|
21
21
|
*/
|
22
|
-
|
22
|
+
"use strict";
|
23
23
|
|
24
24
|
Object.defineProperty(exports, "__esModule", {
|
25
25
|
value: true
|
26
26
|
});
|
27
|
-
exports.PDFFetchStream =
|
27
|
+
exports.PDFFetchStream = void 0;
|
28
28
|
|
29
|
-
var
|
29
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
30
30
|
|
31
|
-
var _util = require(
|
31
|
+
var _util = require("../shared/util");
|
32
32
|
|
33
|
-
var _network_utils = require(
|
33
|
+
var _network_utils = require("./network_utils");
|
34
|
+
|
35
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
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); }); }; }
|
34
40
|
|
35
41
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36
42
|
|
37
|
-
function
|
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
|
+
|
47
|
+
function createFetchOptions(headers, withCredentials, abortController) {
|
38
48
|
return {
|
39
49
|
method: 'GET',
|
40
50
|
headers: headers,
|
51
|
+
signal: abortController && abortController.signal,
|
41
52
|
mode: 'cors',
|
42
53
|
credentials: withCredentials ? 'include' : 'same-origin',
|
43
54
|
redirect: 'follow'
|
44
55
|
};
|
45
56
|
}
|
46
57
|
|
47
|
-
var PDFFetchStream =
|
58
|
+
var PDFFetchStream =
|
59
|
+
/*#__PURE__*/
|
60
|
+
function () {
|
48
61
|
function PDFFetchStream(source) {
|
49
62
|
_classCallCheck(this, PDFFetchStream);
|
50
63
|
|
@@ -56,26 +69,30 @@ var PDFFetchStream = function () {
|
|
56
69
|
}
|
57
70
|
|
58
71
|
_createClass(PDFFetchStream, [{
|
59
|
-
key:
|
72
|
+
key: "getFullReader",
|
60
73
|
value: function getFullReader() {
|
61
74
|
(0, _util.assert)(!this._fullRequestReader);
|
62
75
|
this._fullRequestReader = new PDFFetchStreamReader(this);
|
63
76
|
return this._fullRequestReader;
|
64
77
|
}
|
65
78
|
}, {
|
66
|
-
key:
|
79
|
+
key: "getRangeReader",
|
67
80
|
value: function getRangeReader(begin, end) {
|
68
81
|
var reader = new PDFFetchStreamRangeReader(this, begin, end);
|
82
|
+
|
69
83
|
this._rangeRequestReaders.push(reader);
|
84
|
+
|
70
85
|
return reader;
|
71
86
|
}
|
72
87
|
}, {
|
73
|
-
key:
|
88
|
+
key: "cancelAllRequests",
|
74
89
|
value: function cancelAllRequests(reason) {
|
75
90
|
if (this._fullRequestReader) {
|
76
91
|
this._fullRequestReader.cancel(reason);
|
77
92
|
}
|
93
|
+
|
78
94
|
var readers = this._rangeRequestReaders.slice(0);
|
95
|
+
|
79
96
|
readers.forEach(function (reader) {
|
80
97
|
reader.cancel(reason);
|
81
98
|
});
|
@@ -85,7 +102,11 @@ var PDFFetchStream = function () {
|
|
85
102
|
return PDFFetchStream;
|
86
103
|
}();
|
87
104
|
|
88
|
-
|
105
|
+
exports.PDFFetchStream = PDFFetchStream;
|
106
|
+
|
107
|
+
var PDFFetchStreamReader =
|
108
|
+
/*#__PURE__*/
|
109
|
+
function () {
|
89
110
|
function PDFFetchStreamReader(stream) {
|
90
111
|
var _this = this;
|
91
112
|
|
@@ -101,26 +122,39 @@ var PDFFetchStreamReader = function () {
|
|
101
122
|
this._headersCapability = (0, _util.createPromiseCapability)();
|
102
123
|
this._disableRange = source.disableRange || false;
|
103
124
|
this._rangeChunkSize = source.rangeChunkSize;
|
125
|
+
|
104
126
|
if (!this._rangeChunkSize && !this._disableRange) {
|
105
127
|
this._disableRange = true;
|
106
128
|
}
|
129
|
+
|
130
|
+
if (typeof AbortController !== 'undefined') {
|
131
|
+
this._abortController = new AbortController();
|
132
|
+
}
|
133
|
+
|
107
134
|
this._isStreamingSupported = !source.disableStream;
|
108
135
|
this._isRangeSupported = !source.disableRange;
|
109
136
|
this._headers = new Headers();
|
137
|
+
|
110
138
|
for (var property in this._stream.httpHeaders) {
|
111
139
|
var value = this._stream.httpHeaders[property];
|
140
|
+
|
112
141
|
if (typeof value === 'undefined') {
|
113
142
|
continue;
|
114
143
|
}
|
144
|
+
|
115
145
|
this._headers.append(property, value);
|
116
146
|
}
|
147
|
+
|
117
148
|
var url = source.url;
|
118
|
-
fetch(url, createFetchOptions(this._headers, this._withCredentials)).then(function (response) {
|
149
|
+
fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(function (response) {
|
119
150
|
if (!(0, _network_utils.validateResponseStatus)(response.status)) {
|
120
151
|
throw (0, _network_utils.createResponseStatusError)(response.status, url);
|
121
152
|
}
|
153
|
+
|
122
154
|
_this._reader = response.body.getReader();
|
155
|
+
|
123
156
|
_this._headersCapability.resolve();
|
157
|
+
|
124
158
|
var getResponseHeader = function getResponseHeader(name) {
|
125
159
|
return response.headers.get(name);
|
126
160
|
};
|
@@ -137,6 +171,7 @@ var PDFFetchStreamReader = function () {
|
|
137
171
|
_this._isRangeSupported = allowRangeRequests;
|
138
172
|
_this._contentLength = suggestedLength || _this._contentLength;
|
139
173
|
_this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
|
174
|
+
|
140
175
|
if (!_this._isStreamingSupported && _this._isRangeSupported) {
|
141
176
|
_this.cancel(new _util.AbortException('streaming is disabled'));
|
142
177
|
}
|
@@ -145,65 +180,102 @@ var PDFFetchStreamReader = function () {
|
|
145
180
|
}
|
146
181
|
|
147
182
|
_createClass(PDFFetchStreamReader, [{
|
148
|
-
key:
|
149
|
-
value: function
|
150
|
-
var
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
183
|
+
key: "read",
|
184
|
+
value: function () {
|
185
|
+
var _read = _asyncToGenerator(
|
186
|
+
/*#__PURE__*/
|
187
|
+
_regenerator.default.mark(function _callee() {
|
188
|
+
var _ref, value, done, buffer;
|
189
|
+
|
190
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
191
|
+
while (1) {
|
192
|
+
switch (_context.prev = _context.next) {
|
193
|
+
case 0:
|
194
|
+
_context.next = 2;
|
195
|
+
return this._headersCapability.promise;
|
196
|
+
|
197
|
+
case 2:
|
198
|
+
_context.next = 4;
|
199
|
+
return this._reader.read();
|
200
|
+
|
201
|
+
case 4:
|
202
|
+
_ref = _context.sent;
|
203
|
+
value = _ref.value;
|
204
|
+
done = _ref.done;
|
205
|
+
|
206
|
+
if (!done) {
|
207
|
+
_context.next = 9;
|
208
|
+
break;
|
209
|
+
}
|
210
|
+
|
211
|
+
return _context.abrupt("return", {
|
212
|
+
value: value,
|
213
|
+
done: done
|
214
|
+
});
|
215
|
+
|
216
|
+
case 9:
|
217
|
+
this._loaded += value.byteLength;
|
218
|
+
|
219
|
+
if (this.onProgress) {
|
220
|
+
this.onProgress({
|
221
|
+
loaded: this._loaded,
|
222
|
+
total: this._contentLength
|
223
|
+
});
|
224
|
+
}
|
225
|
+
|
226
|
+
buffer = new Uint8Array(value).buffer;
|
227
|
+
return _context.abrupt("return", {
|
228
|
+
value: buffer,
|
229
|
+
done: false
|
230
|
+
});
|
231
|
+
|
232
|
+
case 13:
|
233
|
+
case "end":
|
234
|
+
return _context.stop();
|
235
|
+
}
|
169
236
|
}
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
237
|
+
}, _callee, this);
|
238
|
+
}));
|
239
|
+
|
240
|
+
function read() {
|
241
|
+
return _read.apply(this, arguments);
|
242
|
+
}
|
243
|
+
|
244
|
+
return read;
|
245
|
+
}()
|
178
246
|
}, {
|
179
|
-
key:
|
247
|
+
key: "cancel",
|
180
248
|
value: function cancel(reason) {
|
181
249
|
if (this._reader) {
|
182
250
|
this._reader.cancel(reason);
|
183
251
|
}
|
252
|
+
|
253
|
+
if (this._abortController) {
|
254
|
+
this._abortController.abort();
|
255
|
+
}
|
184
256
|
}
|
185
257
|
}, {
|
186
|
-
key:
|
258
|
+
key: "headersReady",
|
187
259
|
get: function get() {
|
188
260
|
return this._headersCapability.promise;
|
189
261
|
}
|
190
262
|
}, {
|
191
|
-
key:
|
263
|
+
key: "filename",
|
192
264
|
get: function get() {
|
193
265
|
return this._filename;
|
194
266
|
}
|
195
267
|
}, {
|
196
|
-
key:
|
268
|
+
key: "contentLength",
|
197
269
|
get: function get() {
|
198
270
|
return this._contentLength;
|
199
271
|
}
|
200
272
|
}, {
|
201
|
-
key:
|
273
|
+
key: "isRangeSupported",
|
202
274
|
get: function get() {
|
203
275
|
return this._isRangeSupported;
|
204
276
|
}
|
205
277
|
}, {
|
206
|
-
key:
|
278
|
+
key: "isStreamingSupported",
|
207
279
|
get: function get() {
|
208
280
|
return this._isStreamingSupported;
|
209
281
|
}
|
@@ -212,9 +284,11 @@ var PDFFetchStreamReader = function () {
|
|
212
284
|
return PDFFetchStreamReader;
|
213
285
|
}();
|
214
286
|
|
215
|
-
var PDFFetchStreamRangeReader =
|
287
|
+
var PDFFetchStreamRangeReader =
|
288
|
+
/*#__PURE__*/
|
289
|
+
function () {
|
216
290
|
function PDFFetchStreamRangeReader(stream, begin, end) {
|
217
|
-
var
|
291
|
+
var _this2 = this;
|
218
292
|
|
219
293
|
_classCallCheck(this, PDFFetchStreamRangeReader);
|
220
294
|
|
@@ -225,70 +299,120 @@ var PDFFetchStreamRangeReader = function () {
|
|
225
299
|
this._withCredentials = source.withCredentials;
|
226
300
|
this._readCapability = (0, _util.createPromiseCapability)();
|
227
301
|
this._isStreamingSupported = !source.disableStream;
|
302
|
+
|
303
|
+
if (typeof AbortController !== 'undefined') {
|
304
|
+
this._abortController = new AbortController();
|
305
|
+
}
|
306
|
+
|
228
307
|
this._headers = new Headers();
|
308
|
+
|
229
309
|
for (var property in this._stream.httpHeaders) {
|
230
310
|
var value = this._stream.httpHeaders[property];
|
311
|
+
|
231
312
|
if (typeof value === 'undefined') {
|
232
313
|
continue;
|
233
314
|
}
|
315
|
+
|
234
316
|
this._headers.append(property, value);
|
235
317
|
}
|
318
|
+
|
236
319
|
var rangeStr = begin + '-' + (end - 1);
|
320
|
+
|
237
321
|
this._headers.append('Range', 'bytes=' + rangeStr);
|
322
|
+
|
238
323
|
var url = source.url;
|
239
|
-
fetch(url, createFetchOptions(this._headers, this._withCredentials)).then(function (response) {
|
324
|
+
fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(function (response) {
|
240
325
|
if (!(0, _network_utils.validateResponseStatus)(response.status)) {
|
241
326
|
throw (0, _network_utils.createResponseStatusError)(response.status, url);
|
242
327
|
}
|
243
|
-
|
244
|
-
|
328
|
+
|
329
|
+
_this2._readCapability.resolve();
|
330
|
+
|
331
|
+
_this2._reader = response.body.getReader();
|
245
332
|
});
|
246
333
|
this.onProgress = null;
|
247
334
|
}
|
248
335
|
|
249
336
|
_createClass(PDFFetchStreamRangeReader, [{
|
250
|
-
key:
|
251
|
-
value: function
|
252
|
-
var
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
337
|
+
key: "read",
|
338
|
+
value: function () {
|
339
|
+
var _read2 = _asyncToGenerator(
|
340
|
+
/*#__PURE__*/
|
341
|
+
_regenerator.default.mark(function _callee2() {
|
342
|
+
var _ref2, value, done, buffer;
|
343
|
+
|
344
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
345
|
+
while (1) {
|
346
|
+
switch (_context2.prev = _context2.next) {
|
347
|
+
case 0:
|
348
|
+
_context2.next = 2;
|
349
|
+
return this._readCapability.promise;
|
350
|
+
|
351
|
+
case 2:
|
352
|
+
_context2.next = 4;
|
353
|
+
return this._reader.read();
|
354
|
+
|
355
|
+
case 4:
|
356
|
+
_ref2 = _context2.sent;
|
357
|
+
value = _ref2.value;
|
358
|
+
done = _ref2.done;
|
359
|
+
|
360
|
+
if (!done) {
|
361
|
+
_context2.next = 9;
|
362
|
+
break;
|
363
|
+
}
|
364
|
+
|
365
|
+
return _context2.abrupt("return", {
|
366
|
+
value: value,
|
367
|
+
done: done
|
368
|
+
});
|
369
|
+
|
370
|
+
case 9:
|
371
|
+
this._loaded += value.byteLength;
|
372
|
+
|
373
|
+
if (this.onProgress) {
|
374
|
+
this.onProgress({
|
375
|
+
loaded: this._loaded
|
376
|
+
});
|
377
|
+
}
|
378
|
+
|
379
|
+
buffer = new Uint8Array(value).buffer;
|
380
|
+
return _context2.abrupt("return", {
|
381
|
+
value: buffer,
|
382
|
+
done: false
|
383
|
+
});
|
384
|
+
|
385
|
+
case 13:
|
386
|
+
case "end":
|
387
|
+
return _context2.stop();
|
388
|
+
}
|
268
389
|
}
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
390
|
+
}, _callee2, this);
|
391
|
+
}));
|
392
|
+
|
393
|
+
function read() {
|
394
|
+
return _read2.apply(this, arguments);
|
395
|
+
}
|
396
|
+
|
397
|
+
return read;
|
398
|
+
}()
|
277
399
|
}, {
|
278
|
-
key:
|
400
|
+
key: "cancel",
|
279
401
|
value: function cancel(reason) {
|
280
402
|
if (this._reader) {
|
281
403
|
this._reader.cancel(reason);
|
282
404
|
}
|
405
|
+
|
406
|
+
if (this._abortController) {
|
407
|
+
this._abortController.abort();
|
408
|
+
}
|
283
409
|
}
|
284
410
|
}, {
|
285
|
-
key:
|
411
|
+
key: "isStreamingSupported",
|
286
412
|
get: function get() {
|
287
413
|
return this._isStreamingSupported;
|
288
414
|
}
|
289
415
|
}]);
|
290
416
|
|
291
417
|
return PDFFetchStreamRangeReader;
|
292
|
-
}();
|
293
|
-
|
294
|
-
exports.PDFFetchStream = PDFFetchStream;
|
418
|
+
}();
|