pdfjs-dist 2.2.228 → 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 (84) hide show
  1. package/bower.json +1 -1
  2. package/build/pdf.js +8851 -8582
  3. package/build/pdf.js.map +1 -1
  4. package/build/pdf.min.js +1 -1
  5. package/build/pdf.worker.js +8717 -8394
  6. package/build/pdf.worker.js.map +1 -1
  7. package/build/pdf.worker.min.js +1 -1
  8. package/image_decoders/pdf.image_decoders.js +3014 -2864
  9. package/image_decoders/pdf.image_decoders.js.map +1 -1
  10. package/image_decoders/pdf.image_decoders.min.js +1 -1
  11. package/lib/core/annotation.js +203 -39
  12. package/lib/core/chunked_stream.js +32 -9
  13. package/lib/core/core_utils.js +48 -22
  14. package/lib/core/document.js +44 -33
  15. package/lib/core/evaluator.js +68 -32
  16. package/lib/core/fonts.js +2 -2
  17. package/lib/core/glyphlist.js +1 -0
  18. package/lib/core/image.js +1 -1
  19. package/lib/core/jbig2.js +23 -6
  20. package/lib/core/jpg.js +54 -23
  21. package/lib/core/jpx.js +23 -6
  22. package/lib/core/obj.js +18 -16
  23. package/lib/core/operator_list.js +17 -14
  24. package/lib/core/parser.js +9 -12
  25. package/lib/core/pattern.js +22 -7
  26. package/lib/core/pdf_manager.js +4 -4
  27. package/lib/core/primitives.js +63 -42
  28. package/lib/core/stream.js +14 -0
  29. package/lib/core/type1_parser.js +9 -1
  30. package/lib/core/worker.js +17 -56
  31. package/lib/display/annotation_layer.js +194 -85
  32. package/lib/display/api.js +331 -213
  33. package/lib/display/canvas.js +6 -1
  34. package/lib/display/content_disposition.js +1 -1
  35. package/lib/display/display_utils.js +48 -18
  36. package/lib/display/network_utils.js +6 -0
  37. package/lib/display/pattern_helper.js +22 -5
  38. package/lib/display/svg.js +1 -1
  39. package/lib/display/text_layer.js +62 -53
  40. package/lib/display/xml_parser.js +1 -1
  41. package/lib/pdf.js +2 -3
  42. package/lib/pdf.worker.js +2 -2
  43. package/lib/shared/compatibility.js +23 -19
  44. package/lib/shared/message_handler.js +163 -196
  45. package/lib/shared/streams_polyfill.js +1 -1
  46. package/lib/shared/util.js +288 -196
  47. package/lib/test/unit/annotation_spec.js +687 -93
  48. package/lib/test/unit/api_spec.js +72 -27
  49. package/lib/test/unit/display_utils_spec.js +1 -1
  50. package/lib/test/unit/evaluator_spec.js +21 -5
  51. package/lib/test/unit/fetch_stream_spec.js +3 -1
  52. package/lib/test/unit/message_handler_spec.js +10 -6
  53. package/lib/test/unit/network_spec.js +3 -1
  54. package/lib/test/unit/network_utils_spec.js +14 -0
  55. package/lib/test/unit/node_stream_spec.js +3 -3
  56. package/lib/test/unit/primitives_spec.js +2 -2
  57. package/lib/test/unit/type1_parser_spec.js +1 -1
  58. package/lib/test/unit/ui_utils_spec.js +1 -1
  59. package/lib/test/unit/util_spec.js +10 -10
  60. package/lib/web/app.js +47 -35
  61. package/lib/web/app_options.js +4 -4
  62. package/lib/web/base_viewer.js +36 -12
  63. package/lib/web/chromecom.js +1 -3
  64. package/lib/web/download_manager.js +1 -1
  65. package/lib/web/firefox_print_service.js +7 -4
  66. package/lib/web/firefoxcom.js +10 -5
  67. package/lib/web/interfaces.js +4 -0
  68. package/lib/web/pdf_document_properties.js +1 -1
  69. package/lib/web/pdf_history.js +1 -1
  70. package/lib/web/pdf_link_service.js +7 -3
  71. package/lib/web/pdf_outline_viewer.js +2 -1
  72. package/lib/web/pdf_page_view.js +12 -16
  73. package/lib/web/pdf_print_service.js +3 -5
  74. package/lib/web/pdf_sidebar.js +3 -0
  75. package/lib/web/pdf_viewer.component.js +2 -2
  76. package/lib/web/toolbar.js +2 -0
  77. package/lib/web/ui_utils.js +1 -1
  78. package/package.json +1 -1
  79. package/web/pdf_viewer.css +5 -9
  80. package/web/pdf_viewer.js +60 -45
  81. package/web/pdf_viewer.js.map +1 -1
  82. package/external/streams/streams-lib.js +0 -3962
  83. package/external/url/url-lib.js +0 -627
  84. package/lib/shared/url_polyfill.js +0 -56
@@ -47,7 +47,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
47
47
 
48
48
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
49
49
 
50
- function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
50
+ function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
51
51
 
52
52
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
53
53
 
@@ -395,9 +395,7 @@ describe('api', function () {
395
395
  expect(doc.numPages).toEqual(3);
396
396
  });
397
397
  it('gets fingerprint', function () {
398
- var fingerprint = doc.fingerprint;
399
- expect(_typeof(fingerprint)).toEqual('string');
400
- expect(fingerprint.length > 0).toEqual(true);
398
+ expect(doc.fingerprint).toEqual('ea8b35919d6279a369e835bde778611b');
401
399
  });
402
400
  it('gets page', function (done) {
403
401
  var promise = doc.getPage(1);
@@ -668,19 +666,14 @@ describe('api', function () {
668
666
  })["catch"](done.fail);
669
667
  });
670
668
  it('gets attachments', function (done) {
671
- if ((0, _is_node["default"])()) {
672
- pending('TODO: Use a non-linked test-case.');
673
- }
674
-
675
- var loadingTask = (0, _api.getDocument)((0, _test_utils.buildGetDocumentParams)('bug766138.pdf'));
669
+ var loadingTask = (0, _api.getDocument)((0, _test_utils.buildGetDocumentParams)('attachment.pdf'));
676
670
  var promise = loadingTask.promise.then(function (pdfDoc) {
677
671
  return pdfDoc.getAttachments();
678
672
  });
679
673
  promise.then(function (data) {
680
- var attachment = data['Press Quality.joboptions'];
681
- expect(attachment.filename).toEqual('Press Quality.joboptions');
682
- expect(attachment.content instanceof Uint8Array).toBeTruthy();
683
- expect(attachment.content.length).toEqual(30098);
674
+ var attachment = data['foo.txt'];
675
+ expect(attachment.filename).toEqual('foo.txt');
676
+ expect(attachment.content).toEqual(new Uint8Array([98, 97, 114, 32, 98, 97, 122, 32, 10]));
684
677
  loadingTask.destroy().then(done);
685
678
  })["catch"](done.fail);
686
679
  });
@@ -858,8 +851,8 @@ describe('api', function () {
858
851
  var promise = doc.getStats();
859
852
  promise.then(function (stats) {
860
853
  expect(stats).toEqual({
861
- streamTypes: [],
862
- fontTypes: []
854
+ streamTypes: {},
855
+ fontTypes: {}
863
856
  });
864
857
  done();
865
858
  })["catch"](done.fail);
@@ -867,15 +860,12 @@ describe('api', function () {
867
860
  it('checks that fingerprints are unique', function (done) {
868
861
  var loadingTask1 = (0, _api.getDocument)((0, _test_utils.buildGetDocumentParams)('issue4436r.pdf'));
869
862
  var loadingTask2 = (0, _api.getDocument)((0, _test_utils.buildGetDocumentParams)('issue4575.pdf'));
870
- var promises = [loadingTask1.promise, loadingTask2.promise];
871
- Promise.all(promises).then(function (data) {
863
+ Promise.all([loadingTask1.promise, loadingTask2.promise]).then(function (data) {
872
864
  var fingerprint1 = data[0].fingerprint;
873
- expect(_typeof(fingerprint1)).toEqual('string');
874
- expect(fingerprint1.length > 0).toEqual(true);
875
865
  var fingerprint2 = data[1].fingerprint;
876
- expect(_typeof(fingerprint2)).toEqual('string');
877
- expect(fingerprint2.length > 0).toEqual(true);
878
866
  expect(fingerprint1).not.toEqual(fingerprint2);
867
+ expect(fingerprint1).toEqual('2f695a83d6e7553c24fc08b7ac69712d');
868
+ expect(fingerprint2).toEqual('04c7126b34a46b6d4d6e7a1eff7edcb6');
879
869
  Promise.all([loadingTask1.destroy(), loadingTask2.destroy()]).then(done);
880
870
  })["catch"](done.fail);
881
871
  });
@@ -990,6 +980,32 @@ describe('api', function () {
990
980
  it('gets view', function () {
991
981
  expect(page.view).toEqual([0, 0, 595.28, 841.89]);
992
982
  });
983
+ it('gets view, with empty/invalid bounding boxes', function (done) {
984
+ var viewLoadingTask = (0, _api.getDocument)((0, _test_utils.buildGetDocumentParams)('boundingBox_invalid.pdf'));
985
+ viewLoadingTask.promise.then(function (pdfDoc) {
986
+ var numPages = pdfDoc.numPages;
987
+ expect(numPages).toEqual(3);
988
+ var viewPromises = [];
989
+
990
+ for (var i = 0; i < numPages; i++) {
991
+ viewPromises[i] = pdfDoc.getPage(i + 1).then(function (pdfPage) {
992
+ return pdfPage.view;
993
+ });
994
+ }
995
+
996
+ Promise.all(viewPromises).then(function (_ref3) {
997
+ var _ref4 = _slicedToArray(_ref3, 3),
998
+ page1 = _ref4[0],
999
+ page2 = _ref4[1],
1000
+ page3 = _ref4[2];
1001
+
1002
+ expect(page1).toEqual([0, 0, 612, 792]);
1003
+ expect(page2).toEqual([0, 0, 800, 600]);
1004
+ expect(page3).toEqual([0, 0, 600, 800]);
1005
+ viewLoadingTask.destroy().then(done);
1006
+ });
1007
+ })["catch"](done.fail);
1008
+ });
993
1009
  it('gets viewport', function () {
994
1010
  var viewport = page.getViewport({
995
1011
  scale: 1.5,
@@ -1095,9 +1111,9 @@ describe('api', function () {
1095
1111
  var loadingTask = (0, _api.getDocument)((0, _test_utils.buildGetDocumentParams)('issue8276_reduced.pdf'));
1096
1112
  loadingTask.promise.then(function (pdfDoc) {
1097
1113
  pdfDoc.getPage(1).then(function (pdfPage) {
1098
- pdfPage.getTextContent().then(function (_ref3) {
1099
- var items = _ref3.items,
1100
- styles = _ref3.styles;
1114
+ pdfPage.getTextContent().then(function (_ref5) {
1115
+ var items = _ref5.items,
1116
+ styles = _ref5.styles;
1101
1117
  expect(items.length).toEqual(1);
1102
1118
  expect(Object.keys(styles)).toEqual(['Times']);
1103
1119
  expect(items[0]).toEqual({
@@ -1146,13 +1162,42 @@ describe('api', function () {
1146
1162
  });
1147
1163
  })["catch"](done.fail);
1148
1164
  });
1165
+ it('gets operatorList, from corrupt PDF file (issue 8702), ' + 'with/without `stopAtErrors` set', function (done) {
1166
+ var loadingTask1 = (0, _api.getDocument)((0, _test_utils.buildGetDocumentParams)('issue8702.pdf', {
1167
+ stopAtErrors: false
1168
+ }));
1169
+ var loadingTask2 = (0, _api.getDocument)((0, _test_utils.buildGetDocumentParams)('issue8702.pdf', {
1170
+ stopAtErrors: true
1171
+ }));
1172
+ var result1 = loadingTask1.promise.then(function (pdfDoc) {
1173
+ return pdfDoc.getPage(1).then(function (pdfPage) {
1174
+ return pdfPage.getOperatorList().then(function (opList) {
1175
+ expect(opList.fnArray.length).toEqual(722);
1176
+ expect(opList.argsArray.length).toEqual(722);
1177
+ expect(opList.lastChunk).toEqual(true);
1178
+ return loadingTask1.destroy();
1179
+ });
1180
+ });
1181
+ });
1182
+ var result2 = loadingTask2.promise.then(function (pdfDoc) {
1183
+ return pdfDoc.getPage(1).then(function (pdfPage) {
1184
+ return pdfPage.getOperatorList().then(function (opList) {
1185
+ expect(opList.fnArray.length).toEqual(0);
1186
+ expect(opList.argsArray.length).toEqual(0);
1187
+ expect(opList.lastChunk).toEqual(true);
1188
+ return loadingTask2.destroy();
1189
+ });
1190
+ });
1191
+ });
1192
+ Promise.all([result1, result2]).then(done, done.fail);
1193
+ });
1149
1194
  it('gets document stats after parsing page', function (done) {
1150
1195
  var promise = page.getOperatorList().then(function () {
1151
1196
  return pdfDocument.getStats();
1152
1197
  });
1153
- var expectedStreamTypes = [];
1198
+ var expectedStreamTypes = {};
1154
1199
  expectedStreamTypes[_util.StreamType.FLATE] = true;
1155
- var expectedFontTypes = [];
1200
+ var expectedFontTypes = {};
1156
1201
  expectedFontTypes[_util.FontType.TYPE1] = true;
1157
1202
  expectedFontTypes[_util.FontType.CIDFONTTYPE2] = true;
1158
1203
  promise.then(function (stats) {
@@ -1189,7 +1234,7 @@ describe('api', function () {
1189
1234
  statEntry = _stats$times[0];
1190
1235
 
1191
1236
  expect(statEntry.name).toEqual('Page Request');
1192
- expect(statEntry.end - statEntry.start).toBeGreaterThan(0);
1237
+ expect(statEntry.end - statEntry.start).toBeGreaterThanOrEqual(0);
1193
1238
  loadingTask.destroy().then(done);
1194
1239
  }, done.fail);
1195
1240
  });
@@ -31,7 +31,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
31
31
 
32
32
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
33
33
 
34
- function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
34
+ function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
35
35
 
36
36
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
37
37
 
@@ -35,6 +35,12 @@ var _evaluator = require("../../core/evaluator");
35
35
 
36
36
  var _worker = require("../../core/worker");
37
37
 
38
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
39
+
40
+ 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); } }
41
+
42
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
43
+
38
44
  describe('evaluator', function () {
39
45
  function HandlerMock() {
40
46
  this.inputs = [];
@@ -301,13 +307,23 @@ describe('evaluator', function () {
301
307
  });
302
308
  });
303
309
  describe('operator list', function () {
304
- function MessageHandlerMock() {}
310
+ var StreamSinkMock =
311
+ /*#__PURE__*/
312
+ function () {
313
+ function StreamSinkMock() {
314
+ _classCallCheck(this, StreamSinkMock);
315
+ }
316
+
317
+ _createClass(StreamSinkMock, [{
318
+ key: "enqueue",
319
+ value: function enqueue() {}
320
+ }]);
321
+
322
+ return StreamSinkMock;
323
+ }();
305
324
 
306
- MessageHandlerMock.prototype = {
307
- send: function send() {}
308
- };
309
325
  it('should get correct total length after flushing', function () {
310
- var operatorList = new _operator_list.OperatorList(null, new MessageHandlerMock());
326
+ var operatorList = new _operator_list.OperatorList(null, new StreamSinkMock());
311
327
  operatorList.addOp(_util.OPS.save, null);
312
328
  operatorList.addOp(_util.OPS.restore, null);
313
329
  expect(operatorList.totalLength).toEqual(2);
@@ -21,6 +21,8 @@
21
21
  */
22
22
  "use strict";
23
23
 
24
+ var _util = require("../../shared/util");
25
+
24
26
  var _fetch_stream = require("../../display/fetch_stream");
25
27
 
26
28
  describe('fetch_stream', function () {
@@ -72,7 +74,7 @@ describe('fetch_stream', function () {
72
74
  var promise = fullReader.headersReady.then(function () {
73
75
  isStreamingSupported = fullReader.isStreamingSupported;
74
76
  isRangeSupported = fullReader.isRangeSupported;
75
- fullReader.cancel(new Error('Don\'t need full reader'));
77
+ fullReader.cancel(new _util.AbortException('Don\'t need fullReader.'));
76
78
  fullReaderCancelled = true;
77
79
  });
78
80
  var tailSize = pdfLength % rangeSize || rangeSize;
@@ -135,7 +135,7 @@ describe('message_handler', function () {
135
135
  return sleep(10);
136
136
  }).then(function () {
137
137
  expect(log).toEqual('01p2');
138
- return reader.cancel();
138
+ return reader.cancel(new _util.AbortException('reader cancelled.'));
139
139
  }).then(function () {
140
140
  expect(log).toEqual('01p2c4');
141
141
  done();
@@ -154,12 +154,14 @@ describe('message_handler', function () {
154
154
  log += 'c';
155
155
  };
156
156
 
157
+ log += '0';
157
158
  sink.ready.then(function () {
159
+ log += '1';
158
160
  sink.enqueue([1, 2, 3, 4], 4);
159
161
  return sink.ready;
160
162
  }).then(function () {
161
- log += 'error';
162
- sink.error('error');
163
+ log += 'e';
164
+ sink.error(new Error('should not read when errored'));
163
165
  });
164
166
  });
165
167
  var messageHandler1 = new _message_handler.MessageHandler('main', 'worker', port);
@@ -171,14 +173,16 @@ describe('message_handler', function () {
171
173
  });
172
174
  var reader = readable.getReader();
173
175
  sleep(10).then(function () {
174
- expect(log).toEqual('');
176
+ expect(log).toEqual('01');
175
177
  return reader.read();
176
178
  }).then(function (result) {
177
179
  expect(result.value).toEqual([1, 2, 3, 4]);
178
180
  expect(result.done).toEqual(false);
179
181
  return reader.read();
180
- }).then(function () {}, function (reason) {
181
- expect(reason).toEqual('error');
182
+ })["catch"](function (reason) {
183
+ expect(log).toEqual('01pe');
184
+ expect(reason instanceof _util.UnknownErrorException).toEqual(true);
185
+ expect(reason.message).toEqual('should not read when errored');
182
186
  done();
183
187
  });
184
188
  });
@@ -21,6 +21,8 @@
21
21
  */
22
22
  "use strict";
23
23
 
24
+ var _util = require("../../shared/util");
25
+
24
26
  var _network = require("../../display/network");
25
27
 
26
28
  describe('network', function () {
@@ -79,7 +81,7 @@ describe('network', function () {
79
81
  var promise = fullReader.headersReady.then(function () {
80
82
  isStreamingSupported = fullReader.isStreamingSupported;
81
83
  isRangeSupported = fullReader.isRangeSupported;
82
- fullReader.cancel('Don\'t need full reader');
84
+ fullReader.cancel(new _util.AbortException('Don\'t need fullReader.'));
83
85
  fullReaderCancelled = true;
84
86
  });
85
87
  var tailSize = pdf1Length % rangeSize || rangeSize;
@@ -244,6 +244,20 @@ describe('network_utils', function () {
244
244
 
245
245
  throw new Error("Unexpected headerName: ".concat(headerName));
246
246
  })).toEqual('filename.pdf');
247
+ expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
248
+ if (headerName === 'Content-Disposition') {
249
+ return 'attachment; filename="%e4%b8%ad%e6%96%87.pdf"';
250
+ }
251
+
252
+ throw new Error("Unexpected headerName: ".concat(headerName));
253
+ })).toEqual('中文.pdf');
254
+ expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
255
+ if (headerName === 'Content-Disposition') {
256
+ return 'attachment; filename="100%.pdf"';
257
+ }
258
+
259
+ throw new Error("Unexpected headerName: ".concat(headerName));
260
+ })).toEqual('100%.pdf');
247
261
  });
248
262
  it('gets the filename from the response header (RFC 6266)', function () {
249
263
  expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
@@ -33,7 +33,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
33
33
 
34
34
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
35
35
 
36
- function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
36
+ function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
37
37
 
38
38
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
39
 
@@ -185,13 +185,13 @@ describe('node_stream', function () {
185
185
  var promise1 = fullReader1.headersReady.then(function () {
186
186
  isStreamingSupported1 = fullReader1.isStreamingSupported;
187
187
  isRangeSupported1 = fullReader1.isRangeSupported;
188
- fullReader1.cancel('Don\'t need full reader');
188
+ fullReader1.cancel(new _util.AbortException('Don\'t need fullReader1.'));
189
189
  fullReaderCancelled1 = true;
190
190
  });
191
191
  var promise2 = fullReader2.headersReady.then(function () {
192
192
  isStreamingSupported2 = fullReader2.isStreamingSupported;
193
193
  isRangeSupported2 = fullReader2.isRangeSupported;
194
- fullReader2.cancel('Don\'t need full reader');
194
+ fullReader2.cancel(new _util.AbortException('Don\'t need fullReader2.'));
195
195
  fullReaderCancelled2 = true;
196
196
  });
197
197
  var tailSize = pdfLength % rangeSize || rangeSize;
@@ -80,7 +80,7 @@ describe('primitives', function () {
80
80
  expect(dict.get()).toBeUndefined();
81
81
  expect(dict.get('Prev')).toBeUndefined();
82
82
  expect(dict.get('Decode', 'D')).toBeUndefined();
83
- expect(dict.get('FontFile', 'FontFile2', 'FontFile3')).toBeNull();
83
+ expect(dict.get('FontFile', 'FontFile2', 'FontFile3')).toBeUndefined();
84
84
  };
85
85
 
86
86
  var emptyDict, dictWithSizeKey, dictWithManyKeys;
@@ -133,7 +133,7 @@ describe('primitives', function () {
133
133
  var keyPromises = [dictWithManyKeys.getAsync('Size'), dictWithSizeKey.getAsync('FontFile', 'FontFile2', 'FontFile3')];
134
134
  Promise.all(keyPromises).then(function (values) {
135
135
  expect(values[0]).toBeUndefined();
136
- expect(values[1]).toBeNull();
136
+ expect(values[1]).toBeUndefined();
137
137
  done();
138
138
  })["catch"](function (reason) {
139
139
  done.fail(reason);
@@ -81,7 +81,7 @@ describe('Type1Parser', function () {
81
81
  it('parses font program', function () {
82
82
  var stream = new _stream.StringStream('/ExpansionFactor 99\n' + '/Subrs 1 array\n' + 'dup 0 1 RD x noaccess put\n' + 'end\n' + '/CharStrings 46 dict dup begin\n' + '/.notdef 1 RD x ND\n' + 'end');
83
83
  var parser = new _type1_parser.Type1Parser(stream, false, _fonts.SEAC_ANALYSIS_ENABLED);
84
- var program = parser.extractFontProgram();
84
+ var program = parser.extractFontProgram({});
85
85
  expect(program.charstrings.length).toEqual(1);
86
86
  expect(program.properties.privateData.ExpansionFactor).toEqual(99);
87
87
  });
@@ -33,7 +33,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
33
33
 
34
34
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
35
35
 
36
- function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
36
+ function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
37
37
 
38
38
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
39
 
@@ -192,11 +192,11 @@ describe('util', function () {
192
192
  });
193
193
  describe('URL', function () {
194
194
  it('should return an Object', function () {
195
- var url = new _util.URL('https://example.com');
195
+ var url = new URL('https://example.com');
196
196
  expect(_typeof(url)).toEqual('object');
197
197
  });
198
198
  it('should have property `href`', function () {
199
- var url = new _util.URL('https://example.com');
199
+ var url = new URL('https://example.com');
200
200
  expect(_typeof(url.href)).toEqual('string');
201
201
  });
202
202
  });
@@ -220,15 +220,15 @@ describe('util', function () {
220
220
  expect((0, _util.createValidAbsoluteUrl)('magnet:?foo', null)).toEqual(null);
221
221
  });
222
222
  it('correctly creates a valid URL for whitelisted protocols', function () {
223
- expect((0, _util.createValidAbsoluteUrl)('http://www.mozilla.org/foo', null)).toEqual(new _util.URL('http://www.mozilla.org/foo'));
224
- expect((0, _util.createValidAbsoluteUrl)('/foo', 'http://www.mozilla.org')).toEqual(new _util.URL('http://www.mozilla.org/foo'));
225
- expect((0, _util.createValidAbsoluteUrl)('https://www.mozilla.org/foo', null)).toEqual(new _util.URL('https://www.mozilla.org/foo'));
226
- expect((0, _util.createValidAbsoluteUrl)('/foo', 'https://www.mozilla.org')).toEqual(new _util.URL('https://www.mozilla.org/foo'));
227
- expect((0, _util.createValidAbsoluteUrl)('ftp://www.mozilla.org/foo', null)).toEqual(new _util.URL('ftp://www.mozilla.org/foo'));
228
- expect((0, _util.createValidAbsoluteUrl)('/foo', 'ftp://www.mozilla.org')).toEqual(new _util.URL('ftp://www.mozilla.org/foo'));
229
- expect((0, _util.createValidAbsoluteUrl)('mailto:foo@bar.baz', null)).toEqual(new _util.URL('mailto:foo@bar.baz'));
223
+ expect((0, _util.createValidAbsoluteUrl)('http://www.mozilla.org/foo', null)).toEqual(new URL('http://www.mozilla.org/foo'));
224
+ expect((0, _util.createValidAbsoluteUrl)('/foo', 'http://www.mozilla.org')).toEqual(new URL('http://www.mozilla.org/foo'));
225
+ expect((0, _util.createValidAbsoluteUrl)('https://www.mozilla.org/foo', null)).toEqual(new URL('https://www.mozilla.org/foo'));
226
+ expect((0, _util.createValidAbsoluteUrl)('/foo', 'https://www.mozilla.org')).toEqual(new URL('https://www.mozilla.org/foo'));
227
+ expect((0, _util.createValidAbsoluteUrl)('ftp://www.mozilla.org/foo', null)).toEqual(new URL('ftp://www.mozilla.org/foo'));
228
+ expect((0, _util.createValidAbsoluteUrl)('/foo', 'ftp://www.mozilla.org')).toEqual(new URL('ftp://www.mozilla.org/foo'));
229
+ expect((0, _util.createValidAbsoluteUrl)('mailto:foo@bar.baz', null)).toEqual(new URL('mailto:foo@bar.baz'));
230
230
  expect((0, _util.createValidAbsoluteUrl)('/foo', 'mailto:foo@bar.baz')).toEqual(null);
231
- expect((0, _util.createValidAbsoluteUrl)('tel:+0123456789', null)).toEqual(new _util.URL('tel:+0123456789'));
231
+ expect((0, _util.createValidAbsoluteUrl)('tel:+0123456789', null)).toEqual(new URL('tel:+0123456789'));
232
232
  expect((0, _util.createValidAbsoluteUrl)('/foo', 'tel:0123456789')).toEqual(null);
233
233
  });
234
234
  });