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.
@@ -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.
@@ -135,7 +135,7 @@ describe('primitives', function () {
135
135
  expect(values[0]).toBeUndefined();
136
136
  expect(values[1]).toBeNull();
137
137
  done();
138
- }).catch(function (reason) {
138
+ })["catch"](function (reason) {
139
139
  done.fail(reason);
140
140
  });
141
141
  });
@@ -146,7 +146,7 @@ describe('primitives', function () {
146
146
  expect(values[1]).toEqual(testFontFile2);
147
147
  expect(values[2]).toEqual(testFontFile);
148
148
  done();
149
- }).catch(function (reason) {
149
+ })["catch"](function (reason) {
150
150
  done.fail(reason);
151
151
  });
152
152
  });
@@ -161,7 +161,8 @@ describe('primitives', function () {
161
161
  expect(callbackSpyCalls.count()).toEqual(3);
162
162
  });
163
163
  it('should handle keys pointing to indirect objects, both sync and async', function (done) {
164
- var fontRef = new _primitives.Ref(1, 0);
164
+ var fontRef = _primitives.Ref.get(1, 0);
165
+
165
166
  var xref = new _test_utils.XRefMock([{
166
167
  ref: fontRef,
167
168
  data: testFontFile
@@ -173,13 +174,14 @@ describe('primitives', function () {
173
174
  fontDict.getAsync('FontFile', 'FontFile2', 'FontFile3').then(function (value) {
174
175
  expect(value).toEqual(testFontFile);
175
176
  done();
176
- }).catch(function (reason) {
177
+ })["catch"](function (reason) {
177
178
  done.fail(reason);
178
179
  });
179
180
  });
180
181
  it('should handle arrays containing indirect objects', function () {
181
- var minCoordRef = new _primitives.Ref(1, 0),
182
- maxCoordRef = new _primitives.Ref(2, 0);
182
+ var minCoordRef = _primitives.Ref.get(1, 0),
183
+ maxCoordRef = _primitives.Ref.get(2, 0);
184
+
183
185
  var minCoord = 0,
184
186
  maxCoord = 1;
185
187
  var xref = new _test_utils.XRefMock([{
@@ -221,24 +223,30 @@ describe('primitives', function () {
221
223
  it('should retain the stored values', function () {
222
224
  var storedNum = 4;
223
225
  var storedGen = 2;
224
- var ref = new _primitives.Ref(storedNum, storedGen);
226
+
227
+ var ref = _primitives.Ref.get(storedNum, storedGen);
228
+
225
229
  expect(ref.num).toEqual(storedNum);
226
230
  expect(ref.gen).toEqual(storedGen);
227
231
  });
228
232
  });
229
233
  describe('RefSet', function () {
230
234
  it('should have a stored value', function () {
231
- var ref = new _primitives.Ref(4, 2);
235
+ var ref = _primitives.Ref.get(4, 2);
236
+
232
237
  var refset = new _primitives.RefSet();
233
238
  refset.put(ref);
234
239
  expect(refset.has(ref)).toBeTruthy();
235
240
  });
236
241
  it('should not have an unknown value', function () {
237
- var ref = new _primitives.Ref(4, 2);
242
+ var ref = _primitives.Ref.get(4, 2);
243
+
238
244
  var refset = new _primitives.RefSet();
239
245
  expect(refset.has(ref)).toBeFalsy();
240
246
  refset.put(ref);
241
- var anotherRef = new _primitives.Ref(2, 4);
247
+
248
+ var anotherRef = _primitives.Ref.get(2, 4);
249
+
242
250
  expect(refset.has(anotherRef)).toBeFalsy();
243
251
  });
244
252
  });
@@ -299,19 +307,24 @@ describe('primitives', function () {
299
307
  expect((0, _primitives.isRef)(nonRef)).toEqual(false);
300
308
  });
301
309
  it('handles refs', function () {
302
- var ref = new _primitives.Ref(1, 0);
310
+ var ref = _primitives.Ref.get(1, 0);
311
+
303
312
  expect((0, _primitives.isRef)(ref)).toEqual(true);
304
313
  });
305
314
  });
306
315
  describe('isRefsEqual', function () {
307
- it('should handle different Refs pointing to the same object', function () {
308
- var ref1 = new _primitives.Ref(1, 0);
309
- var ref2 = new _primitives.Ref(1, 0);
316
+ it('should handle Refs pointing to the same object', function () {
317
+ var ref1 = _primitives.Ref.get(1, 0);
318
+
319
+ var ref2 = _primitives.Ref.get(1, 0);
320
+
310
321
  expect((0, _primitives.isRefsEqual)(ref1, ref2)).toEqual(true);
311
322
  });
312
323
  it('should handle Refs pointing to different objects', function () {
313
- var ref1 = new _primitives.Ref(1, 0);
314
- var ref2 = new _primitives.Ref(2, 0);
324
+ var ref1 = _primitives.Ref.get(1, 0);
325
+
326
+ var ref2 = _primitives.Ref.get(2, 0);
327
+
315
328
  expect((0, _primitives.isRefsEqual)(ref1, ref2)).toEqual(false);
316
329
  });
317
330
  });
@@ -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.
@@ -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.
@@ -25,7 +25,10 @@ Object.defineProperty(exports, "__esModule", {
25
25
  value: true
26
26
  });
27
27
  exports.buildGetDocumentParams = buildGetDocumentParams;
28
- exports.TEST_PDFS_PATH = exports.XRefMock = exports.NodeCMapReaderFactory = exports.NodeCanvasFactory = exports.NodeFileReaderFactory = void 0;
28
+ exports.createIdFactory = createIdFactory;
29
+ exports.TEST_PDFS_PATH = exports.XRefMock = exports.NodeCMapReaderFactory = exports.NodeCanvasFactory = exports.NodeFileReaderFactory = exports.DOMFileReaderFactory = void 0;
30
+
31
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
29
32
 
30
33
  var _util = require("../../shared/util");
31
34
 
@@ -33,7 +36,13 @@ var _is_node = _interopRequireDefault(require("../../shared/is_node"));
33
36
 
34
37
  var _primitives = require("../../core/primitives");
35
38
 
36
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
+ var _document = require("../../core/document");
40
+
41
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
42
+
43
+ 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); } }
44
+
45
+ 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); }); }; }
37
46
 
38
47
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
39
48
 
@@ -41,6 +50,77 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
41
50
 
42
51
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
43
52
 
53
+ var DOMFileReaderFactory =
54
+ /*#__PURE__*/
55
+ function () {
56
+ function DOMFileReaderFactory() {
57
+ _classCallCheck(this, DOMFileReaderFactory);
58
+ }
59
+
60
+ _createClass(DOMFileReaderFactory, null, [{
61
+ key: "fetch",
62
+ value: function (_fetch) {
63
+ function fetch(_x) {
64
+ return _fetch.apply(this, arguments);
65
+ }
66
+
67
+ fetch.toString = function () {
68
+ return _fetch.toString();
69
+ };
70
+
71
+ return fetch;
72
+ }(
73
+ /*#__PURE__*/
74
+ function () {
75
+ var _ref = _asyncToGenerator(
76
+ /*#__PURE__*/
77
+ _regenerator["default"].mark(function _callee(params) {
78
+ var response;
79
+ return _regenerator["default"].wrap(function _callee$(_context) {
80
+ while (1) {
81
+ switch (_context.prev = _context.next) {
82
+ case 0:
83
+ _context.next = 2;
84
+ return fetch(params.path);
85
+
86
+ case 2:
87
+ response = _context.sent;
88
+
89
+ if (response.ok) {
90
+ _context.next = 5;
91
+ break;
92
+ }
93
+
94
+ throw new Error(response.statusText);
95
+
96
+ case 5:
97
+ _context.t0 = Uint8Array;
98
+ _context.next = 8;
99
+ return response.arrayBuffer();
100
+
101
+ case 8:
102
+ _context.t1 = _context.sent;
103
+ return _context.abrupt("return", new _context.t0(_context.t1));
104
+
105
+ case 10:
106
+ case "end":
107
+ return _context.stop();
108
+ }
109
+ }
110
+ }, _callee);
111
+ }));
112
+
113
+ return function (_x2) {
114
+ return _ref.apply(this, arguments);
115
+ };
116
+ }())
117
+ }]);
118
+
119
+ return DOMFileReaderFactory;
120
+ }();
121
+
122
+ exports.DOMFileReaderFactory = DOMFileReaderFactory;
123
+
44
124
  var NodeFileReaderFactory =
45
125
  /*#__PURE__*/
46
126
  function () {
@@ -50,12 +130,41 @@ function () {
50
130
 
51
131
  _createClass(NodeFileReaderFactory, null, [{
52
132
  key: "fetch",
53
- value: function fetch(params) {
54
- var fs = require('fs');
133
+ value: function () {
134
+ var _fetch2 = _asyncToGenerator(
135
+ /*#__PURE__*/
136
+ _regenerator["default"].mark(function _callee2(params) {
137
+ var fs;
138
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
139
+ while (1) {
140
+ switch (_context2.prev = _context2.next) {
141
+ case 0:
142
+ fs = require('fs');
143
+ return _context2.abrupt("return", new Promise(function (resolve, reject) {
144
+ fs.readFile(params.path, function (error, data) {
145
+ if (error || !data) {
146
+ reject(error || new Error("Empty file for: ".concat(params.path)));
147
+ return;
148
+ }
149
+
150
+ resolve(new Uint8Array(data));
151
+ });
152
+ }));
153
+
154
+ case 2:
155
+ case "end":
156
+ return _context2.stop();
157
+ }
158
+ }
159
+ }, _callee2);
160
+ }));
55
161
 
56
- var file = fs.readFileSync(params.path);
57
- return new Uint8Array(file);
58
- }
162
+ function fetch(_x3) {
163
+ return _fetch2.apply(this, arguments);
164
+ }
165
+
166
+ return fetch;
167
+ }()
59
168
  }]);
60
169
 
61
170
  return NodeFileReaderFactory;
@@ -71,7 +180,7 @@ exports.TEST_PDFS_PATH = TEST_PDFS_PATH;
71
180
  function buildGetDocumentParams(filename, options) {
72
181
  var params = Object.create(null);
73
182
 
74
- if ((0, _is_node.default)()) {
183
+ if ((0, _is_node["default"])()) {
75
184
  params.url = TEST_PDFS_PATH.node + filename;
76
185
  } else {
77
186
  params.url = new URL(TEST_PDFS_PATH.dom + filename, window.location).href;
@@ -131,11 +240,11 @@ exports.NodeCanvasFactory = NodeCanvasFactory;
131
240
  var NodeCMapReaderFactory =
132
241
  /*#__PURE__*/
133
242
  function () {
134
- function NodeCMapReaderFactory(_ref) {
135
- var _ref$baseUrl = _ref.baseUrl,
136
- baseUrl = _ref$baseUrl === void 0 ? null : _ref$baseUrl,
137
- _ref$isCompressed = _ref.isCompressed,
138
- isCompressed = _ref$isCompressed === void 0 ? false : _ref$isCompressed;
243
+ function NodeCMapReaderFactory(_ref2) {
244
+ var _ref2$baseUrl = _ref2.baseUrl,
245
+ baseUrl = _ref2$baseUrl === void 0 ? null : _ref2$baseUrl,
246
+ _ref2$isCompressed = _ref2.isCompressed,
247
+ isCompressed = _ref2$isCompressed === void 0 ? false : _ref2$isCompressed;
139
248
 
140
249
  _classCallCheck(this, NodeCMapReaderFactory);
141
250
 
@@ -145,37 +254,69 @@ function () {
145
254
 
146
255
  _createClass(NodeCMapReaderFactory, [{
147
256
  key: "fetch",
148
- value: function fetch(_ref2) {
149
- var _this = this;
150
-
151
- var name = _ref2.name;
152
-
153
- if (!this.baseUrl) {
154
- return Promise.reject(new Error('The CMap "baseUrl" parameter must be specified, ensure that ' + 'the "cMapUrl" and "cMapPacked" API parameters are provided.'));
155
- }
257
+ value: function () {
258
+ var _fetch3 = _asyncToGenerator(
259
+ /*#__PURE__*/
260
+ _regenerator["default"].mark(function _callee3(_ref3) {
261
+ var _this = this;
262
+
263
+ var name, url, compressionType;
264
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
265
+ while (1) {
266
+ switch (_context3.prev = _context3.next) {
267
+ case 0:
268
+ name = _ref3.name;
269
+
270
+ if (this.baseUrl) {
271
+ _context3.next = 3;
272
+ break;
273
+ }
274
+
275
+ throw new Error('The CMap "baseUrl" parameter must be specified, ensure that ' + 'the "cMapUrl" and "cMapPacked" API parameters are provided.');
276
+
277
+ case 3:
278
+ if (name) {
279
+ _context3.next = 5;
280
+ break;
281
+ }
282
+
283
+ throw new Error('CMap name must be specified.');
284
+
285
+ case 5:
286
+ url = this.baseUrl + name + (this.isCompressed ? '.bcmap' : '');
287
+ compressionType = this.isCompressed ? _util.CMapCompressionType.BINARY : _util.CMapCompressionType.NONE;
288
+ return _context3.abrupt("return", new Promise(function (resolve, reject) {
289
+ var fs = require('fs');
290
+
291
+ fs.readFile(url, function (error, data) {
292
+ if (error || !data) {
293
+ reject(new Error(error));
294
+ return;
295
+ }
296
+
297
+ resolve({
298
+ cMapData: new Uint8Array(data),
299
+ compressionType: compressionType
300
+ });
301
+ });
302
+ })["catch"](function (reason) {
303
+ throw new Error("Unable to load ".concat(_this.isCompressed ? 'binary ' : '') + "CMap at: ".concat(url));
304
+ }));
305
+
306
+ case 8:
307
+ case "end":
308
+ return _context3.stop();
309
+ }
310
+ }
311
+ }, _callee3, this);
312
+ }));
156
313
 
157
- if (!name) {
158
- return Promise.reject(new Error('CMap name must be specified.'));
314
+ function fetch(_x4) {
315
+ return _fetch3.apply(this, arguments);
159
316
  }
160
317
 
161
- return new Promise(function (resolve, reject) {
162
- var url = _this.baseUrl + name + (_this.isCompressed ? '.bcmap' : '');
163
-
164
- var fs = require('fs');
165
-
166
- fs.readFile(url, function (error, data) {
167
- if (error || !data) {
168
- reject(new Error('Unable to load ' + (_this.isCompressed ? 'binary ' : '') + 'CMap at: ' + url));
169
- return;
170
- }
171
-
172
- resolve({
173
- cMapData: new Uint8Array(data),
174
- compressionType: _this.isCompressed ? _util.CMapCompressionType.BINARY : _util.CMapCompressionType.NONE
175
- });
176
- });
177
- });
178
- }
318
+ return fetch;
319
+ }()
179
320
  }]);
180
321
 
181
322
  return NodeCMapReaderFactory;
@@ -226,4 +367,17 @@ function () {
226
367
  return XRefMock;
227
368
  }();
228
369
 
229
- exports.XRefMock = XRefMock;
370
+ exports.XRefMock = XRefMock;
371
+
372
+ function createIdFactory(pageIndex) {
373
+ var page = new _document.Page({
374
+ pdfManager: {
375
+ get docId() {
376
+ return 'd0';
377
+ }
378
+
379
+ },
380
+ pageIndex: pageIndex
381
+ });
382
+ return page.idFactory;
383
+ }
@@ -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.
@@ -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.
@@ -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.
@@ -27,7 +27,7 @@ var _util = require("../../shared/util");
27
27
 
28
28
  var _is_node = _interopRequireDefault(require("../../shared/is_node"));
29
29
 
30
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
31
31
 
32
32
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
33
33
 
@@ -39,8 +39,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
39
 
40
40
  describe('ui_utils', function () {
41
41
  describe('binary search', function () {
42
- function isTrue(boolean) {
43
- return boolean;
42
+ function isTrue(_boolean) {
43
+ return _boolean;
44
44
  }
45
45
 
46
46
  function isGreater3(number) {
@@ -117,7 +117,7 @@ describe('ui_utils', function () {
117
117
  expect((0, _ui_utils.getPDFFileNameFromURL)('ftp://www.example.com/file4.pdf')).toEqual('file4.pdf');
118
118
  });
119
119
  it('gets PDF filename from query string appended to "blob:" URL', function () {
120
- if ((0, _is_node.default)()) {
120
+ if ((0, _is_node["default"])()) {
121
121
  pending('Blob in not supported in Node.js.');
122
122
  }
123
123
 
@@ -239,7 +239,7 @@ describe('ui_utils', function () {
239
239
  expect(count).toEqual(2);
240
240
  });
241
241
  it('should not, by default, re-dispatch to DOM', function (done) {
242
- if ((0, _is_node.default)()) {
242
+ if ((0, _is_node["default"])()) {
243
243
  pending('Document in not supported in Node.js.');
244
244
  }
245
245
 
@@ -263,7 +263,7 @@ describe('ui_utils', function () {
263
263
  });
264
264
  });
265
265
  it('should re-dispatch to DOM', function (done) {
266
- if ((0, _is_node.default)()) {
266
+ if ((0, _is_node["default"])()) {
267
267
  pending('Document in not supported in Node.js.');
268
268
  }
269
269
 
@@ -290,7 +290,7 @@ describe('ui_utils', function () {
290
290
  });
291
291
  });
292
292
  it('should re-dispatch to DOM, with arguments (without internal listeners)', function (done) {
293
- if ((0, _is_node.default)()) {
293
+ if ((0, _is_node["default"])()) {
294
294
  pending('Document in not supported in Node.js.');
295
295
  }
296
296
 
@@ -393,7 +393,7 @@ describe('ui_utils', function () {
393
393
  Promise.all([invalidTarget, invalidName, invalidDelay]).then(done, done.fail);
394
394
  });
395
395
  it('should resolve on event, using the DOM', function (done) {
396
- if ((0, _is_node.default)()) {
396
+ if ((0, _is_node["default"])()) {
397
397
  pending('Document in not supported in Node.js.');
398
398
  }
399
399
 
@@ -410,7 +410,7 @@ describe('ui_utils', function () {
410
410
  }, done.fail);
411
411
  });
412
412
  it('should resolve on timeout, using the DOM', function (done) {
413
- if ((0, _is_node.default)()) {
413
+ if ((0, _is_node["default"])()) {
414
414
  pending('Document in not supported in Node.js.');
415
415
  }
416
416
 
@@ -541,8 +541,8 @@ describe('ui_utils', function () {
541
541
  _iteratorError2 = err;
542
542
  } finally {
543
543
  try {
544
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
545
- _iterator2.return();
544
+ if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
545
+ _iterator2["return"]();
546
546
  }
547
547
  } finally {
548
548
  if (_didIteratorError2) {
@@ -558,8 +558,8 @@ describe('ui_utils', function () {
558
558
  _iteratorError = err;
559
559
  } finally {
560
560
  try {
561
- if (!_iteratorNormalCompletion && _iterator.return != null) {
562
- _iterator.return();
561
+ if (!_iteratorNormalCompletion && _iterator["return"] != null) {
562
+ _iterator["return"]();
563
563
  }
564
564
  } finally {
565
565
  if (_didIteratorError) {
@@ -609,8 +609,8 @@ describe('ui_utils', function () {
609
609
  _iteratorError3 = err;
610
610
  } finally {
611
611
  try {
612
- if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
613
- _iterator3.return();
612
+ if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) {
613
+ _iterator3["return"]();
614
614
  }
615
615
  } finally {
616
616
  if (_didIteratorError3) {
@@ -689,8 +689,8 @@ describe('ui_utils', function () {
689
689
  _iteratorError4 = err;
690
690
  } finally {
691
691
  try {
692
- if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
693
- _iterator4.return();
692
+ if (!_iteratorNormalCompletion4 && _iterator4["return"] != null) {
693
+ _iterator4["return"]();
694
694
  }
695
695
  } finally {
696
696
  if (_didIteratorError4) {
@@ -713,8 +713,8 @@ describe('ui_utils', function () {
713
713
  _iteratorError5 = err;
714
714
  } finally {
715
715
  try {
716
- if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
717
- _iterator5.return();
716
+ if (!_iteratorNormalCompletion5 && _iterator5["return"] != null) {
717
+ _iterator5["return"]();
718
718
  }
719
719
  } finally {
720
720
  if (_didIteratorError5) {
@@ -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.
@@ -90,12 +90,12 @@ describe('unicode', function () {
90
90
  describe('reverseIfRtl', function () {
91
91
  var NormalizedUnicodes;
92
92
 
93
- function getGlyphUnicode(char) {
94
- if (NormalizedUnicodes[char] !== undefined) {
95
- return NormalizedUnicodes[char];
93
+ function getGlyphUnicode(_char) {
94
+ if (NormalizedUnicodes[_char] !== undefined) {
95
+ return NormalizedUnicodes[_char];
96
96
  }
97
97
 
98
- return char;
98
+ return _char;
99
99
  }
100
100
 
101
101
  beforeAll(function (done) {