pdfjs-dist 2.1.266 → 2.2.228

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 (166) hide show
  1. package/CODE_OF_CONDUCT.md +15 -0
  2. package/bower.json +1 -1
  3. package/build/pdf.js +3349 -2324
  4. package/build/pdf.js.map +1 -1
  5. package/build/pdf.min.js +1 -1
  6. package/build/pdf.worker.js +2804 -1975
  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 +431 -511
  10. package/image_decoders/pdf.image_decoders.js.map +1 -1
  11. package/image_decoders/pdf.image_decoders.min.js +1 -1
  12. package/lib/core/annotation.js +294 -224
  13. package/lib/core/arithmetic_decoder.js +1 -1
  14. package/lib/core/bidi.js +1 -1
  15. package/lib/core/ccitt.js +1 -1
  16. package/lib/core/ccitt_stream.js +1 -1
  17. package/lib/core/cff_parser.js +61 -12
  18. package/lib/core/charsets.js +1 -1
  19. package/lib/core/chunked_stream.js +24 -14
  20. package/lib/core/cmap.js +17 -13
  21. package/lib/core/colorspace.js +1 -1
  22. package/lib/core/core_utils.js +147 -0
  23. package/lib/core/crypto.js +1 -1
  24. package/lib/core/document.js +47 -40
  25. package/lib/core/encodings.js +1 -1
  26. package/lib/core/evaluator.js +346 -279
  27. package/lib/core/font_renderer.js +1 -1
  28. package/lib/core/fonts.js +23 -11
  29. package/lib/core/function.js +1 -1
  30. package/lib/core/glyphlist.js +2 -2
  31. package/lib/core/image.js +2 -2
  32. package/lib/core/image_utils.js +111 -0
  33. package/lib/core/jbig2.js +1 -1
  34. package/lib/core/jbig2_stream.js +1 -1
  35. package/lib/core/jpeg_stream.js +1 -1
  36. package/lib/core/jpg.js +2 -1
  37. package/lib/core/jpx.js +1 -1
  38. package/lib/core/jpx_stream.js +1 -1
  39. package/lib/core/metrics.js +13 -13
  40. package/lib/core/murmurhash3.js +37 -33
  41. package/lib/core/obj.js +245 -41
  42. package/lib/core/operator_list.js +43 -32
  43. package/lib/core/parser.js +228 -133
  44. package/lib/core/pattern.js +4 -2
  45. package/lib/core/pdf_manager.js +17 -15
  46. package/lib/core/primitives.js +40 -6
  47. package/lib/core/ps_parser.js +1 -1
  48. package/lib/core/standard_fonts.js +9 -9
  49. package/lib/core/stream.js +1 -1
  50. package/lib/core/type1_parser.js +1 -1
  51. package/lib/core/unicode.js +2 -2
  52. package/lib/core/worker.js +54 -171
  53. package/lib/core/worker_stream.js +277 -0
  54. package/lib/display/annotation_layer.js +112 -33
  55. package/lib/display/api.js +211 -123
  56. package/lib/display/api_compatibility.js +1 -1
  57. package/lib/display/canvas.js +40 -19
  58. package/lib/display/content_disposition.js +1 -1
  59. package/lib/display/display_utils.js +747 -0
  60. package/lib/display/fetch_stream.js +19 -12
  61. package/lib/display/font_loader.js +11 -8
  62. package/lib/display/metadata.js +1 -1
  63. package/lib/display/network.js +563 -521
  64. package/lib/display/network_utils.js +1 -1
  65. package/lib/display/node_stream.js +21 -12
  66. package/lib/display/pattern_helper.js +24 -25
  67. package/lib/display/svg.js +1068 -565
  68. package/lib/display/text_layer.js +24 -14
  69. package/lib/display/transport_stream.js +192 -70
  70. package/lib/display/webgl.js +1 -1
  71. package/lib/display/worker_options.js +1 -1
  72. package/lib/display/xml_parser.js +1 -1
  73. package/lib/examples/node/domstubs.js +4 -1
  74. package/lib/pdf.js +20 -15
  75. package/lib/pdf.worker.js +3 -3
  76. package/lib/shared/compatibility.js +6 -6
  77. package/lib/shared/global_scope.js +1 -1
  78. package/lib/shared/is_node.js +2 -2
  79. package/lib/shared/message_handler.js +7 -7
  80. package/lib/shared/streams_polyfill.js +1 -1
  81. package/lib/shared/url_polyfill.js +1 -1
  82. package/lib/shared/util.js +13 -125
  83. package/lib/test/unit/annotation_spec.js +278 -93
  84. package/lib/test/unit/api_spec.js +198 -188
  85. package/lib/test/unit/bidi_spec.js +1 -1
  86. package/lib/test/unit/cff_parser_spec.js +15 -1
  87. package/lib/test/unit/clitests_helper.js +3 -3
  88. package/lib/test/unit/cmap_spec.js +20 -20
  89. package/lib/test/unit/colorspace_spec.js +17 -12
  90. package/lib/test/unit/core_utils_spec.js +191 -0
  91. package/lib/test/unit/crypto_spec.js +1 -1
  92. package/lib/test/unit/custom_spec.js +8 -8
  93. package/lib/test/unit/display_svg_spec.js +8 -8
  94. package/lib/test/unit/display_utils_spec.js +273 -0
  95. package/lib/test/unit/document_spec.js +7 -12
  96. package/lib/test/unit/encodings_spec.js +5 -5
  97. package/lib/test/unit/evaluator_spec.js +8 -10
  98. package/lib/test/unit/fetch_stream_spec.js +109 -0
  99. package/lib/test/unit/function_spec.js +1 -1
  100. package/lib/test/unit/jasmine-boot.js +4 -4
  101. package/lib/test/unit/message_handler_spec.js +1 -1
  102. package/lib/test/unit/metadata_spec.js +1 -1
  103. package/lib/test/unit/murmurhash3_spec.js +1 -1
  104. package/lib/test/unit/network_spec.js +5 -55
  105. package/lib/test/unit/network_utils_spec.js +51 -1
  106. package/lib/test/unit/node_stream_spec.js +8 -8
  107. package/lib/test/unit/parser_spec.js +150 -86
  108. package/lib/test/unit/pdf_find_controller_spec.js +1 -1
  109. package/lib/test/unit/pdf_find_utils_spec.js +1 -1
  110. package/lib/test/unit/pdf_history_spec.js +1 -1
  111. package/lib/test/unit/primitives_spec.js +30 -17
  112. package/lib/test/unit/stream_spec.js +1 -1
  113. package/lib/test/unit/test_utils.js +197 -43
  114. package/lib/test/unit/testreporter.js +1 -1
  115. package/lib/test/unit/type1_parser_spec.js +1 -1
  116. package/lib/test/unit/ui_utils_spec.js +20 -20
  117. package/lib/test/unit/unicode_spec.js +5 -5
  118. package/lib/test/unit/util_spec.js +1 -164
  119. package/lib/web/annotation_layer_builder.js +1 -1
  120. package/lib/web/app.js +104 -60
  121. package/lib/web/app_options.js +45 -37
  122. package/lib/web/base_viewer.js +7 -7
  123. package/lib/web/chromecom.js +8 -8
  124. package/lib/web/debugger.js +7 -7
  125. package/lib/web/download_manager.js +3 -2
  126. package/lib/web/firefox_print_service.js +4 -2
  127. package/lib/web/firefoxcom.js +50 -19
  128. package/lib/web/genericcom.js +8 -8
  129. package/lib/web/genericl10n.js +10 -10
  130. package/lib/web/grab_to_pan.js +3 -1
  131. package/lib/web/interfaces.js +13 -13
  132. package/lib/web/overlay_manager.js +10 -10
  133. package/lib/web/password_prompt.js +2 -2
  134. package/lib/web/pdf_attachment_viewer.js +1 -1
  135. package/lib/web/pdf_cursor_tools.js +1 -1
  136. package/lib/web/pdf_document_properties.js +188 -119
  137. package/lib/web/pdf_find_bar.js +1 -1
  138. package/lib/web/pdf_find_controller.js +3 -3
  139. package/lib/web/pdf_find_utils.js +1 -1
  140. package/lib/web/pdf_history.js +1 -1
  141. package/lib/web/pdf_link_service.js +2 -2
  142. package/lib/web/pdf_outline_viewer.js +53 -28
  143. package/lib/web/pdf_page_view.js +9 -18
  144. package/lib/web/pdf_presentation_mode.js +1 -1
  145. package/lib/web/pdf_print_service.js +5 -3
  146. package/lib/web/pdf_rendering_queue.js +4 -7
  147. package/lib/web/pdf_sidebar.js +24 -17
  148. package/lib/web/pdf_sidebar_resizer.js +1 -1
  149. package/lib/web/pdf_single_page_viewer.js +1 -1
  150. package/lib/web/pdf_thumbnail_view.js +2 -2
  151. package/lib/web/pdf_thumbnail_viewer.js +3 -3
  152. package/lib/web/pdf_viewer.component.js +3 -3
  153. package/lib/web/pdf_viewer.js +3 -3
  154. package/lib/web/preferences.js +30 -30
  155. package/lib/web/secondary_toolbar.js +1 -1
  156. package/lib/web/text_layer_builder.js +23 -45
  157. package/lib/web/toolbar.js +1 -1
  158. package/lib/web/ui_utils.js +14 -14
  159. package/lib/web/view_history.js +15 -15
  160. package/lib/web/viewer_compatibility.js +1 -1
  161. package/package.json +1 -1
  162. package/web/pdf_viewer.css +21 -10
  163. package/web/pdf_viewer.js +126 -194
  164. package/web/pdf_viewer.js.map +1 -1
  165. package/lib/display/dom_utils.js +0 -494
  166. package/lib/test/unit/dom_utils_spec.js +0 -89
@@ -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 2018 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.
@@ -32,7 +32,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
32
32
 
33
33
  var _util = require("../shared/util");
34
34
 
35
- var _dom_utils = require("./dom_utils");
35
+ var _display_utils = require("./display_utils");
36
36
 
37
37
  var _font_loader = require("./font_loader");
38
38
 
@@ -206,7 +206,7 @@ function getDocument(src) {
206
206
  }
207
207
 
208
208
  params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE;
209
- params.CMapReaderFactory = params.CMapReaderFactory || _dom_utils.DOMCMapReaderFactory;
209
+ params.CMapReaderFactory = params.CMapReaderFactory || _display_utils.DOMCMapReaderFactory;
210
210
  params.ignoreErrors = params.stopAtErrors !== true;
211
211
  params.pdfBug = params.pdfBug === true;
212
212
  var NativeImageDecoderValues = Object.values(_util.NativeImageDecoding);
@@ -272,6 +272,7 @@ function getDocument(src) {
272
272
  networkStream = new _transport_stream.PDFDataTransportStream({
273
273
  length: params.length,
274
274
  initialData: params.initialData,
275
+ progressiveDone: params.progressiveDone,
275
276
  disableRange: params.disableRange,
276
277
  disableStream: params.disableStream
277
278
  }, rangeTransport);
@@ -293,7 +294,7 @@ function getDocument(src) {
293
294
  task._transport = transport;
294
295
  messageHandler.send('Ready', null);
295
296
  });
296
- }).catch(task._capability.reject);
297
+ })["catch"](task._capability.reject);
297
298
  return task;
298
299
  }
299
300
 
@@ -305,11 +306,12 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
305
306
  if (pdfDataRangeTransport) {
306
307
  source.length = pdfDataRangeTransport.length;
307
308
  source.initialData = pdfDataRangeTransport.initialData;
309
+ source.progressiveDone = pdfDataRangeTransport.progressiveDone;
308
310
  }
309
311
 
310
312
  return worker.messageHandler.sendWithPromise('GetDocRequest', {
311
313
  docId: docId,
312
- apiVersion: '2.1.266',
314
+ apiVersion: '2.2.228',
313
315
  source: {
314
316
  data: source.data,
315
317
  url: source.url,
@@ -374,7 +376,7 @@ var PDFDocumentLoadingTask = function PDFDocumentLoadingTaskClosure() {
374
376
  }, {
375
377
  key: "then",
376
378
  value: function then(onFulfilled, onRejected) {
377
- (0, _util.deprecated)('PDFDocumentLoadingTask.then method, ' + 'use the `promise` getter instead.');
379
+ (0, _display_utils.deprecated)('PDFDocumentLoadingTask.then method, ' + 'use the `promise` getter instead.');
378
380
  return this.promise.then.apply(this.promise, arguments);
379
381
  }
380
382
  }, {
@@ -394,13 +396,17 @@ var PDFDataRangeTransport =
394
396
  /*#__PURE__*/
395
397
  function () {
396
398
  function PDFDataRangeTransport(length, initialData) {
399
+ var progressiveDone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
400
+
397
401
  _classCallCheck(this, PDFDataRangeTransport);
398
402
 
399
403
  this.length = length;
400
404
  this.initialData = initialData;
405
+ this.progressiveDone = progressiveDone;
401
406
  this._rangeListeners = [];
402
407
  this._progressListeners = [];
403
408
  this._progressiveReadListeners = [];
409
+ this._progressiveDoneListeners = [];
404
410
  this._readyCapability = (0, _util.createPromiseCapability)();
405
411
  }
406
412
 
@@ -419,6 +425,11 @@ function () {
419
425
  value: function addProgressiveReadListener(listener) {
420
426
  this._progressiveReadListeners.push(listener);
421
427
  }
428
+ }, {
429
+ key: "addProgressiveDoneListener",
430
+ value: function addProgressiveDoneListener(listener) {
431
+ this._progressiveDoneListeners.push(listener);
432
+ }
422
433
  }, {
423
434
  key: "onDataRange",
424
435
  value: function onDataRange(begin, chunk) {
@@ -436,8 +447,8 @@ function () {
436
447
  _iteratorError = err;
437
448
  } finally {
438
449
  try {
439
- if (!_iteratorNormalCompletion && _iterator.return != null) {
440
- _iterator.return();
450
+ if (!_iteratorNormalCompletion && _iterator["return"] != null) {
451
+ _iterator["return"]();
441
452
  }
442
453
  } finally {
443
454
  if (_didIteratorError) {
@@ -448,7 +459,7 @@ function () {
448
459
  }
449
460
  }, {
450
461
  key: "onDataProgress",
451
- value: function onDataProgress(loaded) {
462
+ value: function onDataProgress(loaded, total) {
452
463
  var _this2 = this;
453
464
 
454
465
  this._readyCapability.promise.then(function () {
@@ -459,15 +470,15 @@ function () {
459
470
  try {
460
471
  for (var _iterator2 = _this2._progressListeners[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
461
472
  var listener = _step2.value;
462
- listener(loaded);
473
+ listener(loaded, total);
463
474
  }
464
475
  } catch (err) {
465
476
  _didIteratorError2 = true;
466
477
  _iteratorError2 = err;
467
478
  } finally {
468
479
  try {
469
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
470
- _iterator2.return();
480
+ if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
481
+ _iterator2["return"]();
471
482
  }
472
483
  } finally {
473
484
  if (_didIteratorError2) {
@@ -497,8 +508,8 @@ function () {
497
508
  _iteratorError3 = err;
498
509
  } finally {
499
510
  try {
500
- if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
501
- _iterator3.return();
511
+ if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) {
512
+ _iterator3["return"]();
502
513
  }
503
514
  } finally {
504
515
  if (_didIteratorError3) {
@@ -508,6 +519,37 @@ function () {
508
519
  }
509
520
  });
510
521
  }
522
+ }, {
523
+ key: "onDataProgressiveDone",
524
+ value: function onDataProgressiveDone() {
525
+ var _this4 = this;
526
+
527
+ this._readyCapability.promise.then(function () {
528
+ var _iteratorNormalCompletion4 = true;
529
+ var _didIteratorError4 = false;
530
+ var _iteratorError4 = undefined;
531
+
532
+ try {
533
+ for (var _iterator4 = _this4._progressiveDoneListeners[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
534
+ var listener = _step4.value;
535
+ listener();
536
+ }
537
+ } catch (err) {
538
+ _didIteratorError4 = true;
539
+ _iteratorError4 = err;
540
+ } finally {
541
+ try {
542
+ if (!_iteratorNormalCompletion4 && _iterator4["return"] != null) {
543
+ _iterator4["return"]();
544
+ }
545
+ } finally {
546
+ if (_didIteratorError4) {
547
+ throw _iteratorError4;
548
+ }
549
+ }
550
+ }
551
+ });
552
+ }
511
553
  }, {
512
554
  key: "transportReady",
513
555
  value: function transportReady() {
@@ -531,10 +573,9 @@ exports.PDFDataRangeTransport = PDFDataRangeTransport;
531
573
  var PDFDocumentProxy =
532
574
  /*#__PURE__*/
533
575
  function () {
534
- function PDFDocumentProxy(pdfInfo, transport, loadingTask) {
576
+ function PDFDocumentProxy(pdfInfo, transport) {
535
577
  _classCallCheck(this, PDFDocumentProxy);
536
578
 
537
- this.loadingTask = loadingTask;
538
579
  this._pdfInfo = pdfInfo;
539
580
  this._transport = transport;
540
581
  }
@@ -564,11 +605,21 @@ function () {
564
605
  value: function getPageLabels() {
565
606
  return this._transport.getPageLabels();
566
607
  }
608
+ }, {
609
+ key: "getPageLayout",
610
+ value: function getPageLayout() {
611
+ return this._transport.getPageLayout();
612
+ }
567
613
  }, {
568
614
  key: "getPageMode",
569
615
  value: function getPageMode() {
570
616
  return this._transport.getPageMode();
571
617
  }
618
+ }, {
619
+ key: "getViewerPreferences",
620
+ value: function getViewerPreferences() {
621
+ return this._transport.getViewerPreferences();
622
+ }
572
623
  }, {
573
624
  key: "getOpenActionDestination",
574
625
  value: function getOpenActionDestination() {
@@ -639,6 +690,11 @@ function () {
639
690
  get: function get() {
640
691
  return this._transport.loadingParams;
641
692
  }
693
+ }, {
694
+ key: "loadingTask",
695
+ get: function get() {
696
+ return this._transport.loadingTask;
697
+ }
642
698
  }]);
643
699
 
644
700
  return PDFDocumentProxy;
@@ -657,7 +713,7 @@ function () {
657
713
  this.pageIndex = pageIndex;
658
714
  this._pageInfo = pageInfo;
659
715
  this._transport = transport;
660
- this._stats = pdfBug ? new _dom_utils.StatTimer() : _dom_utils.DummyStatTimer;
716
+ this._stats = pdfBug ? new _display_utils.StatTimer() : _display_utils.DummyStatTimer;
661
717
  this._pdfBug = pdfBug;
662
718
  this.commonObjs = transport.commonObjs;
663
719
  this.objs = new PDFObjects();
@@ -678,13 +734,13 @@ function () {
678
734
  dontFlip = _ref$dontFlip === void 0 ? false : _ref$dontFlip;
679
735
 
680
736
  if (arguments.length > 1 || typeof arguments[0] === 'number') {
681
- (0, _util.deprecated)('getViewport is called with obsolete arguments.');
737
+ (0, _display_utils.deprecated)('getViewport is called with obsolete arguments.');
682
738
  scale = arguments[0];
683
739
  rotation = typeof arguments[1] === 'number' ? arguments[1] : this.rotate;
684
740
  dontFlip = typeof arguments[2] === 'boolean' ? arguments[2] : false;
685
741
  }
686
742
 
687
- return new _dom_utils.PageViewport({
743
+ return new _display_utils.PageViewport({
688
744
  viewBox: this.view,
689
745
  scale: scale,
690
746
  rotation: rotation,
@@ -708,7 +764,7 @@ function () {
708
764
  }, {
709
765
  key: "render",
710
766
  value: function render(_ref3) {
711
- var _this4 = this;
767
+ var _this5 = this;
712
768
 
713
769
  var canvasContext = _ref3.canvasContext,
714
770
  viewport = _ref3.viewport,
@@ -730,7 +786,7 @@ function () {
730
786
  stats.time('Overall');
731
787
  this.pendingCleanup = false;
732
788
  var renderingIntent = intent === 'print' ? 'print' : 'display';
733
- var canvasFactoryInstance = canvasFactory || new _dom_utils.DOMCanvasFactory();
789
+ var canvasFactoryInstance = canvasFactory || new _display_utils.DOMCanvasFactory();
734
790
  var webGLContext = new _webgl.WebGLContext({
735
791
  enable: enableWebGL
736
792
  });
@@ -765,11 +821,11 @@ function () {
765
821
  intentState.renderTasks.splice(i, 1);
766
822
  }
767
823
 
768
- if (_this4.cleanupAfterRender) {
769
- _this4.pendingCleanup = true;
824
+ if (_this5.cleanupAfterRender || renderingIntent === 'print') {
825
+ _this5.pendingCleanup = true;
770
826
  }
771
827
 
772
- _this4._tryCleanup();
828
+ _this5._tryCleanup();
773
829
 
774
830
  if (error) {
775
831
  internalRenderTask.capability.reject(error);
@@ -807,7 +863,7 @@ function () {
807
863
  intentState.renderTasks.push(internalRenderTask);
808
864
  var renderTask = internalRenderTask.task;
809
865
  intentState.displayReadyCapability.promise.then(function (transparency) {
810
- if (_this4.pendingCleanup) {
866
+ if (_this5.pendingCleanup) {
811
867
  complete();
812
868
  return;
813
869
  }
@@ -815,7 +871,7 @@ function () {
815
871
  stats.time('Rendering');
816
872
  internalRenderTask.initializeGraphics(transparency);
817
873
  internalRenderTask.operatorListChanged();
818
- }).catch(complete);
874
+ })["catch"](complete);
819
875
  return renderTask;
820
876
  }
821
877
  }, {
@@ -932,7 +988,7 @@ function () {
932
988
 
933
989
  var intentState = this.intentStates[intent];
934
990
  intentState.renderTasks.forEach(function (renderTask) {
935
- var renderCompleted = renderTask.capability.promise.catch(function () {});
991
+ var renderCompleted = renderTask.capability.promise["catch"](function () {});
936
992
  waitOn.push(renderCompleted);
937
993
  renderTask.cancel();
938
994
  });
@@ -968,8 +1024,8 @@ function () {
968
1024
  this.objs.clear();
969
1025
  this.annotationsPromise = null;
970
1026
 
971
- if (resetStats && this._stats instanceof _dom_utils.StatTimer) {
972
- this._stats = new _dom_utils.StatTimer();
1027
+ if (resetStats && this._stats instanceof _display_utils.StatTimer) {
1028
+ this._stats = new _display_utils.StatTimer();
973
1029
  }
974
1030
 
975
1031
  this.pendingCleanup = false;
@@ -1033,7 +1089,7 @@ function () {
1033
1089
  }, {
1034
1090
  key: "stats",
1035
1091
  get: function get() {
1036
- return this._stats instanceof _dom_utils.StatTimer ? this._stats : null;
1092
+ return this._stats instanceof _display_utils.StatTimer ? this._stats : null;
1037
1093
  }
1038
1094
  }]);
1039
1095
 
@@ -1058,7 +1114,7 @@ function () {
1058
1114
  _createClass(LoopbackPort, [{
1059
1115
  key: "postMessage",
1060
1116
  value: function postMessage(obj, transfers) {
1061
- var _this5 = this;
1117
+ var _this6 = this;
1062
1118
 
1063
1119
  function cloneValue(value) {
1064
1120
  if (_typeof(value) !== 'object' || value === null) {
@@ -1123,9 +1179,9 @@ function () {
1123
1179
  };
1124
1180
 
1125
1181
  this._deferred.then(function () {
1126
- _this5._listeners.forEach(function (listener) {
1182
+ _this6._listeners.forEach(function (listener) {
1127
1183
  listener.call(this, e);
1128
- }, _this5);
1184
+ }, _this6);
1129
1185
  });
1130
1186
  }
1131
1187
  }, {
@@ -1143,7 +1199,7 @@ function () {
1143
1199
  }, {
1144
1200
  key: "terminate",
1145
1201
  value: function terminate() {
1146
- this._listeners = [];
1202
+ this._listeners.length = 0;
1147
1203
  }
1148
1204
  }]);
1149
1205
 
@@ -1193,7 +1249,7 @@ var PDFWorker = function PDFWorkerClosure() {
1193
1249
  }
1194
1250
 
1195
1251
  var loader = fakeWorkerFilesLoader || function () {
1196
- return (0, _dom_utils.loadScript)(_getWorkerSrc()).then(function () {
1252
+ return (0, _display_utils.loadScript)(_getWorkerSrc()).then(function () {
1197
1253
  return window.pdfjsWorker.WorkerMessageHandler;
1198
1254
  });
1199
1255
  };
@@ -1260,7 +1316,7 @@ var PDFWorker = function PDFWorkerClosure() {
1260
1316
  }, {
1261
1317
  key: "_initialize",
1262
1318
  value: function _initialize() {
1263
- var _this6 = this;
1319
+ var _this7 = this;
1264
1320
 
1265
1321
  if (typeof Worker !== 'undefined' && !isWorkerDisabled && !getMainThreadWorkerMessageHandler()) {
1266
1322
  var workerSrc = _getWorkerSrc();
@@ -1278,15 +1334,15 @@ var PDFWorker = function PDFWorkerClosure() {
1278
1334
  messageHandler.destroy();
1279
1335
  worker.terminate();
1280
1336
 
1281
- if (_this6.destroyed) {
1282
- _this6._readyCapability.reject(new Error('Worker was destroyed'));
1337
+ if (_this7.destroyed) {
1338
+ _this7._readyCapability.reject(new Error('Worker was destroyed'));
1283
1339
  } else {
1284
- _this6._setupFakeWorker();
1340
+ _this7._setupFakeWorker();
1285
1341
  }
1286
1342
  };
1287
1343
 
1288
1344
  var onWorkerError = function onWorkerError() {
1289
- if (!_this6._webWorker) {
1345
+ if (!_this7._webWorker) {
1290
1346
  terminateEarly();
1291
1347
  }
1292
1348
  };
@@ -1295,27 +1351,27 @@ var PDFWorker = function PDFWorkerClosure() {
1295
1351
  messageHandler.on('test', function (data) {
1296
1352
  worker.removeEventListener('error', onWorkerError);
1297
1353
 
1298
- if (_this6.destroyed) {
1354
+ if (_this7.destroyed) {
1299
1355
  terminateEarly();
1300
1356
  return;
1301
1357
  }
1302
1358
 
1303
1359
  if (data && data.supportTypedArray) {
1304
- _this6._messageHandler = messageHandler;
1305
- _this6._port = worker;
1306
- _this6._webWorker = worker;
1360
+ _this7._messageHandler = messageHandler;
1361
+ _this7._port = worker;
1362
+ _this7._webWorker = worker;
1307
1363
 
1308
1364
  if (!data.supportTransfers) {
1309
- _this6.postMessageTransfers = false;
1365
+ _this7.postMessageTransfers = false;
1310
1366
  }
1311
1367
 
1312
- _this6._readyCapability.resolve();
1368
+ _this7._readyCapability.resolve();
1313
1369
 
1314
1370
  messageHandler.send('configure', {
1315
- verbosity: _this6.verbosity
1371
+ verbosity: _this7.verbosity
1316
1372
  });
1317
1373
  } else {
1318
- _this6._setupFakeWorker();
1374
+ _this7._setupFakeWorker();
1319
1375
 
1320
1376
  messageHandler.destroy();
1321
1377
  worker.terminate();
@@ -1324,7 +1380,7 @@ var PDFWorker = function PDFWorkerClosure() {
1324
1380
  messageHandler.on('ready', function (data) {
1325
1381
  worker.removeEventListener('error', onWorkerError);
1326
1382
 
1327
- if (_this6.destroyed) {
1383
+ if (_this7.destroyed) {
1328
1384
  terminateEarly();
1329
1385
  return;
1330
1386
  }
@@ -1332,12 +1388,12 @@ var PDFWorker = function PDFWorkerClosure() {
1332
1388
  try {
1333
1389
  sendTest();
1334
1390
  } catch (e) {
1335
- _this6._setupFakeWorker();
1391
+ _this7._setupFakeWorker();
1336
1392
  }
1337
1393
  });
1338
1394
 
1339
1395
  var sendTest = function sendTest() {
1340
- var testObj = new Uint8Array([_this6.postMessageTransfers ? 255 : 0]);
1396
+ var testObj = new Uint8Array([_this7.postMessageTransfers ? 255 : 0]);
1341
1397
 
1342
1398
  try {
1343
1399
  messageHandler.send('test', testObj, [testObj.buffer]);
@@ -1360,7 +1416,7 @@ var PDFWorker = function PDFWorkerClosure() {
1360
1416
  }, {
1361
1417
  key: "_setupFakeWorker",
1362
1418
  value: function _setupFakeWorker() {
1363
- var _this7 = this;
1419
+ var _this8 = this;
1364
1420
 
1365
1421
  if (!isWorkerDisabled) {
1366
1422
  (0, _util.warn)('Setting up fake worker.');
@@ -1368,23 +1424,23 @@ var PDFWorker = function PDFWorkerClosure() {
1368
1424
  }
1369
1425
 
1370
1426
  setupFakeWorkerGlobal().then(function (WorkerMessageHandler) {
1371
- if (_this7.destroyed) {
1372
- _this7._readyCapability.reject(new Error('Worker was destroyed'));
1427
+ if (_this8.destroyed) {
1428
+ _this8._readyCapability.reject(new Error('Worker was destroyed'));
1373
1429
 
1374
1430
  return;
1375
1431
  }
1376
1432
 
1377
1433
  var port = new LoopbackPort();
1378
- _this7._port = port;
1434
+ _this8._port = port;
1379
1435
  var id = 'fake' + nextFakeWorkerId++;
1380
1436
  var workerHandler = new _message_handler.MessageHandler(id + '_worker', id, port);
1381
1437
  WorkerMessageHandler.setup(workerHandler, port);
1382
1438
  var messageHandler = new _message_handler.MessageHandler(id, id + '_worker', port);
1383
- _this7._messageHandler = messageHandler;
1439
+ _this8._messageHandler = messageHandler;
1384
1440
 
1385
- _this7._readyCapability.resolve();
1386
- }).catch(function (reason) {
1387
- _this7._readyCapability.reject(new Error("Setting up fake worker failed: \"".concat(reason.message, "\".")));
1441
+ _this8._readyCapability.resolve();
1442
+ })["catch"](function (reason) {
1443
+ _this8._readyCapability.reject(new Error("Setting up fake worker failed: \"".concat(reason.message, "\".")));
1388
1444
  });
1389
1445
  }
1390
1446
  }, {
@@ -1398,7 +1454,7 @@ var PDFWorker = function PDFWorkerClosure() {
1398
1454
  this._webWorker = null;
1399
1455
  }
1400
1456
 
1401
- pdfWorkerPorts.delete(this._port);
1457
+ pdfWorkerPorts["delete"](this._port);
1402
1458
  this._port = null;
1403
1459
 
1404
1460
  if (this._messageHandler) {
@@ -1483,7 +1539,7 @@ function () {
1483
1539
  _createClass(WorkerTransport, [{
1484
1540
  key: "destroy",
1485
1541
  value: function destroy() {
1486
- var _this8 = this;
1542
+ var _this9 = this;
1487
1543
 
1488
1544
  if (this.destroyCapability) {
1489
1545
  return this.destroyCapability.promise;
@@ -1502,24 +1558,24 @@ function () {
1502
1558
  waitOn.push(page._destroy());
1503
1559
  }
1504
1560
  });
1505
- this.pageCache = [];
1506
- this.pagePromises = [];
1561
+ this.pageCache.length = 0;
1562
+ this.pagePromises.length = 0;
1507
1563
  var terminated = this.messageHandler.sendWithPromise('Terminate', null);
1508
1564
  waitOn.push(terminated);
1509
1565
  Promise.all(waitOn).then(function () {
1510
- _this8.fontLoader.clear();
1566
+ _this9.fontLoader.clear();
1511
1567
 
1512
- if (_this8._networkStream) {
1513
- _this8._networkStream.cancelAllRequests();
1568
+ if (_this9._networkStream) {
1569
+ _this9._networkStream.cancelAllRequests();
1514
1570
  }
1515
1571
 
1516
- if (_this8.messageHandler) {
1517
- _this8.messageHandler.destroy();
1572
+ if (_this9.messageHandler) {
1573
+ _this9.messageHandler.destroy();
1518
1574
 
1519
- _this8.messageHandler = null;
1575
+ _this9.messageHandler = null;
1520
1576
  }
1521
1577
 
1522
- _this8.destroyCapability.resolve();
1578
+ _this9.destroyCapability.resolve();
1523
1579
  }, this.destroyCapability.reject);
1524
1580
  return this.destroyCapability.promise;
1525
1581
  }
@@ -1529,20 +1585,20 @@ function () {
1529
1585
  var messageHandler = this.messageHandler,
1530
1586
  loadingTask = this.loadingTask;
1531
1587
  messageHandler.on('GetReader', function (data, sink) {
1532
- var _this9 = this;
1588
+ var _this10 = this;
1533
1589
 
1534
1590
  (0, _util.assert)(this._networkStream);
1535
1591
  this._fullReader = this._networkStream.getFullReader();
1536
1592
 
1537
1593
  this._fullReader.onProgress = function (evt) {
1538
- _this9._lastProgress = {
1594
+ _this10._lastProgress = {
1539
1595
  loaded: evt.loaded,
1540
1596
  total: evt.total
1541
1597
  };
1542
1598
  };
1543
1599
 
1544
1600
  sink.onPull = function () {
1545
- _this9._fullReader.read().then(function (_ref7) {
1601
+ _this10._fullReader.read().then(function (_ref7) {
1546
1602
  var value = _ref7.value,
1547
1603
  done = _ref7.done;
1548
1604
 
@@ -1553,24 +1609,24 @@ function () {
1553
1609
 
1554
1610
  (0, _util.assert)((0, _util.isArrayBuffer)(value));
1555
1611
  sink.enqueue(new Uint8Array(value), 1, [value]);
1556
- }).catch(function (reason) {
1612
+ })["catch"](function (reason) {
1557
1613
  sink.error(reason);
1558
1614
  });
1559
1615
  };
1560
1616
 
1561
1617
  sink.onCancel = function (reason) {
1562
- _this9._fullReader.cancel(reason);
1618
+ _this10._fullReader.cancel(reason);
1563
1619
  };
1564
1620
  }, this);
1565
1621
  messageHandler.on('ReaderHeadersReady', function (data) {
1566
- var _this10 = this;
1622
+ var _this11 = this;
1567
1623
 
1568
1624
  var headersCapability = (0, _util.createPromiseCapability)();
1569
1625
  var fullReader = this._fullReader;
1570
1626
  fullReader.headersReady.then(function () {
1571
1627
  if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) {
1572
- if (_this10._lastProgress && loadingTask.onProgress) {
1573
- loadingTask.onProgress(_this10._lastProgress);
1628
+ if (_this11._lastProgress && loadingTask.onProgress) {
1629
+ loadingTask.onProgress(_this11._lastProgress);
1574
1630
  }
1575
1631
 
1576
1632
  fullReader.onProgress = function (evt) {
@@ -1596,6 +1652,11 @@ function () {
1596
1652
 
1597
1653
  var rangeReader = this._networkStream.getRangeReader(data.begin, data.end);
1598
1654
 
1655
+ if (!rangeReader) {
1656
+ sink.close();
1657
+ return;
1658
+ }
1659
+
1599
1660
  sink.onPull = function () {
1600
1661
  rangeReader.read().then(function (_ref8) {
1601
1662
  var value = _ref8.value,
@@ -1608,7 +1669,7 @@ function () {
1608
1669
 
1609
1670
  (0, _util.assert)((0, _util.isArrayBuffer)(value));
1610
1671
  sink.enqueue(new Uint8Array(value), 1, [value]);
1611
- }).catch(function (reason) {
1672
+ })["catch"](function (reason) {
1612
1673
  sink.error(reason);
1613
1674
  });
1614
1675
  };
@@ -1619,19 +1680,18 @@ function () {
1619
1680
  }, this);
1620
1681
  messageHandler.on('GetDoc', function (_ref9) {
1621
1682
  var pdfInfo = _ref9.pdfInfo;
1622
- this.numPages = pdfInfo.numPages;
1623
- this.pdfDocument = new PDFDocumentProxy(pdfInfo, this, loadingTask);
1683
+ this._numPages = pdfInfo.numPages;
1624
1684
 
1625
- loadingTask._capability.resolve(this.pdfDocument);
1685
+ loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, this));
1626
1686
  }, this);
1627
1687
  messageHandler.on('PasswordRequest', function (exception) {
1628
- var _this11 = this;
1688
+ var _this12 = this;
1629
1689
 
1630
1690
  this._passwordCapability = (0, _util.createPromiseCapability)();
1631
1691
 
1632
1692
  if (loadingTask.onPassword) {
1633
1693
  var updatePassword = function updatePassword(password) {
1634
- _this11._passwordCapability.resolve({
1694
+ _this12._passwordCapability.resolve({
1635
1695
  password: password
1636
1696
  });
1637
1697
  };
@@ -1693,7 +1753,7 @@ function () {
1693
1753
  page._renderPageChunk(data.operatorList, data.intent);
1694
1754
  }, this);
1695
1755
  messageHandler.on('commonobj', function (data) {
1696
- var _this12 = this;
1756
+ var _this13 = this;
1697
1757
 
1698
1758
  if (this.destroyed) {
1699
1759
  return;
@@ -1721,10 +1781,10 @@ function () {
1721
1781
 
1722
1782
  var fontRegistry = null;
1723
1783
 
1724
- if (params.pdfBug && _global_scope.default.FontInspector && _global_scope.default.FontInspector.enabled) {
1784
+ if (params.pdfBug && _global_scope["default"].FontInspector && _global_scope["default"].FontInspector.enabled) {
1725
1785
  fontRegistry = {
1726
1786
  registerFont: function registerFont(font, url) {
1727
- _global_scope.default['FontInspector'].fontAdded(font, url);
1787
+ _global_scope["default"]['FontInspector'].fontAdded(font, url);
1728
1788
  }
1729
1789
  };
1730
1790
  }
@@ -1737,17 +1797,18 @@ function () {
1737
1797
  fontRegistry: fontRegistry
1738
1798
  });
1739
1799
  this.fontLoader.bind(font).then(function () {
1740
- _this12.commonObjs.resolve(id, font);
1800
+ _this13.commonObjs.resolve(id, font);
1741
1801
  }, function (reason) {
1742
1802
  messageHandler.sendWithPromise('FontFallback', {
1743
1803
  id: id
1744
- }).finally(function () {
1745
- _this12.commonObjs.resolve(id, font);
1804
+ })["finally"](function () {
1805
+ _this13.commonObjs.resolve(id, font);
1746
1806
  });
1747
1807
  });
1748
1808
  break;
1749
1809
 
1750
1810
  case 'FontPath':
1811
+ case 'FontType3Res':
1751
1812
  this.commonObjs.resolve(id, exportedData);
1752
1813
  break;
1753
1814
 
@@ -1757,7 +1818,7 @@ function () {
1757
1818
  }, this);
1758
1819
  messageHandler.on('obj', function (data) {
1759
1820
  if (this.destroyed) {
1760
- return;
1821
+ return undefined;
1761
1822
  }
1762
1823
 
1763
1824
  var _data2 = _slicedToArray(data, 4),
@@ -1769,7 +1830,7 @@ function () {
1769
1830
  var pageProxy = this.pageCache[pageIndex];
1770
1831
 
1771
1832
  if (pageProxy.objs.has(id)) {
1772
- return;
1833
+ return undefined;
1773
1834
  }
1774
1835
 
1775
1836
  switch (type) {
@@ -1783,6 +1844,7 @@ function () {
1783
1844
 
1784
1845
  img.onerror = function () {
1785
1846
  reject(new Error('Error during JPEG image loading'));
1847
+ (0, _display_utils.releaseImageResources)(img);
1786
1848
  };
1787
1849
 
1788
1850
  img.src = imageData;
@@ -1803,6 +1865,8 @@ function () {
1803
1865
  default:
1804
1866
  throw new Error("Got unknown object type ".concat(type));
1805
1867
  }
1868
+
1869
+ return undefined;
1806
1870
  }, this);
1807
1871
  messageHandler.on('DocProgress', function (data) {
1808
1872
  if (this.destroyed) {
@@ -1821,11 +1885,11 @@ function () {
1821
1885
  return;
1822
1886
  }
1823
1887
 
1824
- var page = this.pageCache[data.pageNum - 1];
1888
+ var page = this.pageCache[data.pageIndex];
1825
1889
  var intentState = page.intentStates[data.intent];
1826
1890
 
1827
1891
  if (intentState.displayReadyCapability) {
1828
- intentState.displayReadyCapability.reject(data.error);
1892
+ intentState.displayReadyCapability.reject(new Error(data.error));
1829
1893
  } else {
1830
1894
  throw new Error(data.error);
1831
1895
  }
@@ -1860,8 +1924,8 @@ function () {
1860
1924
  var img = new Image();
1861
1925
 
1862
1926
  img.onload = function () {
1863
- var width = img.width;
1864
- var height = img.height;
1927
+ var width = img.width,
1928
+ height = img.height;
1865
1929
  var size = width * height;
1866
1930
  var rgbaLength = size * 4;
1867
1931
  var buf = new Uint8ClampedArray(size * components);
@@ -1889,10 +1953,16 @@ function () {
1889
1953
  width: width,
1890
1954
  height: height
1891
1955
  });
1956
+ (0, _display_utils.releaseImageResources)(img);
1957
+ tmpCanvas.width = 0;
1958
+ tmpCanvas.height = 0;
1959
+ tmpCanvas = null;
1960
+ tmpCtx = null;
1892
1961
  };
1893
1962
 
1894
1963
  img.onerror = function () {
1895
1964
  reject(new Error('JpegDecode failed to load image'));
1965
+ (0, _display_utils.releaseImageResources)(img);
1896
1966
  };
1897
1967
 
1898
1968
  img.src = imageUrl;
@@ -1929,9 +1999,9 @@ function () {
1929
1999
  }, {
1930
2000
  key: "getPage",
1931
2001
  value: function getPage(pageNumber) {
1932
- var _this13 = this;
2002
+ var _this14 = this;
1933
2003
 
1934
- if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this.numPages) {
2004
+ if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this._numPages) {
1935
2005
  return Promise.reject(new Error('Invalid page request'));
1936
2006
  }
1937
2007
 
@@ -1944,12 +2014,12 @@ function () {
1944
2014
  var promise = this.messageHandler.sendWithPromise('GetPage', {
1945
2015
  pageIndex: pageIndex
1946
2016
  }).then(function (pageInfo) {
1947
- if (_this13.destroyed) {
2017
+ if (_this14.destroyed) {
1948
2018
  throw new Error('Transport destroyed');
1949
2019
  }
1950
2020
 
1951
- var page = new PDFPageProxy(pageIndex, pageInfo, _this13, _this13._params.pdfBug);
1952
- _this13.pageCache[pageIndex] = page;
2021
+ var page = new PDFPageProxy(pageIndex, pageInfo, _this14, _this14._params.pdfBug);
2022
+ _this14.pageCache[pageIndex] = page;
1953
2023
  return page;
1954
2024
  });
1955
2025
  this.pagePromises[pageIndex] = promise;
@@ -1960,7 +2030,7 @@ function () {
1960
2030
  value: function getPageIndex(ref) {
1961
2031
  return this.messageHandler.sendWithPromise('GetPageIndex', {
1962
2032
  ref: ref
1963
- }).catch(function (reason) {
2033
+ })["catch"](function (reason) {
1964
2034
  return Promise.reject(new Error(reason));
1965
2035
  });
1966
2036
  }
@@ -1993,15 +2063,25 @@ function () {
1993
2063
  value: function getPageLabels() {
1994
2064
  return this.messageHandler.sendWithPromise('GetPageLabels', null);
1995
2065
  }
2066
+ }, {
2067
+ key: "getPageLayout",
2068
+ value: function getPageLayout() {
2069
+ return this.messageHandler.sendWithPromise('GetPageLayout', null);
2070
+ }
1996
2071
  }, {
1997
2072
  key: "getPageMode",
1998
2073
  value: function getPageMode() {
1999
2074
  return this.messageHandler.sendWithPromise('GetPageMode', null);
2000
2075
  }
2076
+ }, {
2077
+ key: "getViewerPreferences",
2078
+ value: function getViewerPreferences() {
2079
+ return this.messageHandler.sendWithPromise('GetViewerPreferences', null);
2080
+ }
2001
2081
  }, {
2002
2082
  key: "getOpenActionDestination",
2003
2083
  value: function getOpenActionDestination() {
2004
- return this.messageHandler.sendWithPromise('getOpenActionDestination', null);
2084
+ return this.messageHandler.sendWithPromise('GetOpenActionDestination', null);
2005
2085
  }
2006
2086
  }, {
2007
2087
  key: "getAttachments",
@@ -2026,13 +2106,13 @@ function () {
2026
2106
  }, {
2027
2107
  key: "getMetadata",
2028
2108
  value: function getMetadata() {
2029
- var _this14 = this;
2109
+ var _this15 = this;
2030
2110
 
2031
2111
  return this.messageHandler.sendWithPromise('GetMetadata', null).then(function (results) {
2032
2112
  return {
2033
2113
  info: results[0],
2034
2114
  metadata: results[1] ? new _metadata.Metadata(results[1]) : null,
2035
- contentDispositionFilename: _this14._fullReader ? _this14._fullReader.filename : null
2115
+ contentDispositionFilename: _this15._fullReader ? _this15._fullReader.filename : null
2036
2116
  };
2037
2117
  });
2038
2118
  }
@@ -2044,20 +2124,20 @@ function () {
2044
2124
  }, {
2045
2125
  key: "startCleanup",
2046
2126
  value: function startCleanup() {
2047
- var _this15 = this;
2127
+ var _this16 = this;
2048
2128
 
2049
2129
  this.messageHandler.sendWithPromise('Cleanup', null).then(function () {
2050
- for (var i = 0, ii = _this15.pageCache.length; i < ii; i++) {
2051
- var page = _this15.pageCache[i];
2130
+ for (var i = 0, ii = _this16.pageCache.length; i < ii; i++) {
2131
+ var page = _this16.pageCache[i];
2052
2132
 
2053
2133
  if (page) {
2054
2134
  page.cleanup();
2055
2135
  }
2056
2136
  }
2057
2137
 
2058
- _this15.commonObjs.clear();
2138
+ _this16.commonObjs.clear();
2059
2139
 
2060
- _this15.fontLoader.clear();
2140
+ _this16.fontLoader.clear();
2061
2141
  });
2062
2142
  }
2063
2143
  }, {
@@ -2135,6 +2215,14 @@ function () {
2135
2215
  }, {
2136
2216
  key: "clear",
2137
2217
  value: function clear() {
2218
+ for (var objId in this._objs) {
2219
+ var data = this._objs[objId].data;
2220
+
2221
+ if (typeof Image !== 'undefined' && data instanceof Image) {
2222
+ (0, _display_utils.releaseImageResources)(data);
2223
+ }
2224
+ }
2225
+
2138
2226
  this._objs = Object.create(null);
2139
2227
  }
2140
2228
  }]);
@@ -2160,7 +2248,7 @@ function () {
2160
2248
  }, {
2161
2249
  key: "then",
2162
2250
  value: function then(onFulfilled, onRejected) {
2163
- (0, _util.deprecated)('RenderTask.then method, use the `promise` getter instead.');
2251
+ (0, _display_utils.deprecated)('RenderTask.then method, use the `promise` getter instead.');
2164
2252
  return this.promise.then.apply(this.promise, arguments);
2165
2253
  }
2166
2254
  }, {
@@ -2235,8 +2323,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
2235
2323
  canvasInRendering.add(this._canvas);
2236
2324
  }
2237
2325
 
2238
- if (this._pdfBug && _global_scope.default.StepperManager && _global_scope.default.StepperManager.enabled) {
2239
- this.stepper = _global_scope.default.StepperManager.create(this.pageNumber - 1);
2326
+ if (this._pdfBug && _global_scope["default"].StepperManager && _global_scope["default"].StepperManager.enabled) {
2327
+ this.stepper = _global_scope["default"].StepperManager.create(this.pageNumber - 1);
2240
2328
  this.stepper.init(this.operatorList);
2241
2329
  this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
2242
2330
  }
@@ -2273,10 +2361,10 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
2273
2361
  }
2274
2362
 
2275
2363
  if (this._canvas) {
2276
- canvasInRendering.delete(this._canvas);
2364
+ canvasInRendering["delete"](this._canvas);
2277
2365
  }
2278
2366
 
2279
- this.callback(error || new _dom_utils.RenderingCancelledException("Rendering cancelled, page ".concat(this.pageNumber), 'canvas'));
2367
+ this.callback(error || new _display_utils.RenderingCancelledException("Rendering cancelled, page ".concat(this.pageNumber), 'canvas'));
2280
2368
  }
2281
2369
  }, {
2282
2370
  key: "operatorListChanged",
@@ -2317,14 +2405,14 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
2317
2405
  }, {
2318
2406
  key: "_scheduleNext",
2319
2407
  value: function _scheduleNext() {
2320
- var _this16 = this;
2408
+ var _this17 = this;
2321
2409
 
2322
2410
  if (this._useRequestAnimationFrame) {
2323
2411
  window.requestAnimationFrame(function () {
2324
- _this16._nextBound().catch(_this16.cancel.bind(_this16));
2412
+ _this17._nextBound()["catch"](_this17.cancel.bind(_this17));
2325
2413
  });
2326
2414
  } else {
2327
- Promise.resolve().then(this._nextBound).catch(this.cancel.bind(this));
2415
+ Promise.resolve().then(this._nextBound)["catch"](this.cancel.bind(this));
2328
2416
  }
2329
2417
  }
2330
2418
  }, {
@@ -2332,8 +2420,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
2332
2420
  value: function () {
2333
2421
  var _next2 = _asyncToGenerator(
2334
2422
  /*#__PURE__*/
2335
- _regenerator.default.mark(function _callee() {
2336
- return _regenerator.default.wrap(function _callee$(_context) {
2423
+ _regenerator["default"].mark(function _callee() {
2424
+ return _regenerator["default"].wrap(function _callee$(_context) {
2337
2425
  while (1) {
2338
2426
  switch (_context.prev = _context.next) {
2339
2427
  case 0:
@@ -2354,7 +2442,7 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
2354
2442
  this.gfx.endDrawing();
2355
2443
 
2356
2444
  if (this._canvas) {
2357
- canvasInRendering.delete(this._canvas);
2445
+ canvasInRendering["delete"](this._canvas);
2358
2446
  }
2359
2447
 
2360
2448
  this.callback();
@@ -2383,7 +2471,7 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
2383
2471
  return InternalRenderTask;
2384
2472
  }();
2385
2473
 
2386
- var version = '2.1.266';
2474
+ var version = '2.2.228';
2387
2475
  exports.version = version;
2388
- var build = '81f5835c';
2476
+ var build = 'd7afb74a';
2389
2477
  exports.build = build;