pdfjs-dist 2.0.487 → 2.1.266

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

Potentially problematic release.


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

Files changed (161) hide show
  1. package/bower.json +1 -1
  2. package/build/pdf.js +15564 -9476
  3. package/build/pdf.js.map +1 -1
  4. package/build/pdf.min.js +1 -1
  5. package/build/pdf.worker.js +46644 -36309
  6. package/build/pdf.worker.js.map +1 -1
  7. package/build/pdf.worker.min.js +1 -1
  8. package/external/url/url-lib.js +627 -0
  9. package/image_decoders/pdf.image_decoders.js +11430 -0
  10. package/image_decoders/pdf.image_decoders.js.map +1 -0
  11. package/image_decoders/pdf.image_decoders.min.js +1 -0
  12. package/lib/core/annotation.js +406 -131
  13. package/lib/core/arithmetic_decoder.js +275 -245
  14. package/lib/core/bidi.js +65 -6
  15. package/lib/core/ccitt.js +173 -18
  16. package/lib/core/ccitt_stream.js +15 -6
  17. package/lib/core/cff_parser.js +376 -53
  18. package/lib/core/charsets.js +5 -4
  19. package/lib/core/chunked_stream.js +387 -149
  20. package/lib/core/cmap.js +310 -75
  21. package/lib/core/colorspace.js +874 -594
  22. package/lib/core/crypto.js +290 -45
  23. package/lib/core/document.js +545 -260
  24. package/lib/core/encodings.js +19 -10
  25. package/lib/core/evaluator.js +725 -147
  26. package/lib/core/font_renderer.js +360 -91
  27. package/lib/core/fonts.js +791 -186
  28. package/lib/core/function.js +284 -71
  29. package/lib/core/glyphlist.js +3 -2
  30. package/lib/core/image.js +168 -61
  31. package/lib/core/jbig2.js +479 -66
  32. package/lib/core/jbig2_stream.js +19 -8
  33. package/lib/core/jpeg_stream.js +38 -13
  34. package/lib/core/jpg.js +252 -29
  35. package/lib/core/jpx.js +396 -6
  36. package/lib/core/jpx_stream.js +18 -6
  37. package/lib/core/metrics.js +4 -4
  38. package/lib/core/murmurhash3.js +24 -6
  39. package/lib/core/obj.js +1137 -475
  40. package/lib/core/operator_list.js +108 -6
  41. package/lib/core/parser.js +321 -68
  42. package/lib/core/pattern.js +145 -13
  43. package/lib/core/pdf_manager.js +321 -133
  44. package/lib/core/primitives.js +75 -22
  45. package/lib/core/ps_parser.js +134 -45
  46. package/lib/core/standard_fonts.js +10 -10
  47. package/lib/core/stream.js +313 -34
  48. package/lib/core/type1_parser.js +143 -13
  49. package/lib/core/unicode.js +31 -4
  50. package/lib/core/worker.js +210 -66
  51. package/lib/display/annotation_layer.js +361 -123
  52. package/lib/display/api.js +1454 -729
  53. package/lib/display/api_compatibility.js +11 -13
  54. package/lib/display/canvas.js +324 -29
  55. package/lib/display/content_disposition.js +83 -32
  56. package/lib/display/dom_utils.js +226 -41
  57. package/lib/display/fetch_stream.js +208 -84
  58. package/lib/display/font_loader.js +465 -236
  59. package/lib/display/metadata.js +38 -16
  60. package/lib/display/network.js +216 -51
  61. package/lib/display/network_utils.js +32 -19
  62. package/lib/display/node_stream.js +352 -169
  63. package/lib/display/pattern_helper.js +58 -7
  64. package/lib/display/svg.js +242 -29
  65. package/lib/display/text_layer.js +132 -18
  66. package/lib/display/transport_stream.js +171 -42
  67. package/lib/display/webgl.js +64 -18
  68. package/lib/display/worker_options.js +5 -4
  69. package/lib/display/xml_parser.js +166 -53
  70. package/lib/examples/node/domstubs.js +57 -4
  71. package/lib/pdf.js +21 -4
  72. package/lib/pdf.worker.js +5 -3
  73. package/lib/shared/compatibility.js +158 -564
  74. package/lib/shared/global_scope.js +2 -2
  75. package/lib/shared/is_node.js +4 -4
  76. package/lib/shared/message_handler.js +521 -0
  77. package/lib/shared/streams_polyfill.js +21 -17
  78. package/lib/shared/url_polyfill.js +56 -0
  79. package/lib/shared/util.js +295 -650
  80. package/lib/test/unit/annotation_spec.js +629 -345
  81. package/lib/test/unit/api_spec.js +555 -253
  82. package/lib/test/unit/bidi_spec.js +7 -7
  83. package/lib/test/unit/cff_parser_spec.js +40 -11
  84. package/lib/test/unit/clitests_helper.js +9 -7
  85. package/lib/test/unit/cmap_spec.js +80 -26
  86. package/lib/test/unit/colorspace_spec.js +99 -52
  87. package/lib/test/unit/crypto_spec.js +17 -5
  88. package/lib/test/unit/custom_spec.js +41 -53
  89. package/lib/test/unit/display_svg_spec.js +33 -17
  90. package/lib/test/unit/document_spec.js +3 -3
  91. package/lib/test/unit/dom_utils_spec.js +9 -9
  92. package/lib/test/unit/encodings_spec.js +25 -45
  93. package/lib/test/unit/evaluator_spec.js +34 -9
  94. package/lib/test/unit/function_spec.js +17 -5
  95. package/lib/test/unit/jasmine-boot.js +31 -18
  96. package/lib/test/unit/{util_stream_spec.js → message_handler_spec.js} +41 -69
  97. package/lib/test/unit/metadata_spec.js +71 -11
  98. package/lib/test/unit/murmurhash3_spec.js +3 -3
  99. package/lib/test/unit/network_spec.js +20 -5
  100. package/lib/test/unit/network_utils_spec.js +41 -14
  101. package/lib/test/unit/node_stream_spec.js +51 -27
  102. package/lib/test/unit/parser_spec.js +35 -8
  103. package/lib/test/unit/pdf_find_controller_spec.js +230 -0
  104. package/lib/test/unit/pdf_find_utils_spec.js +63 -0
  105. package/lib/test/unit/pdf_history_spec.js +21 -9
  106. package/lib/test/unit/primitives_spec.js +24 -4
  107. package/lib/test/unit/stream_spec.js +12 -4
  108. package/lib/test/unit/test_utils.js +90 -27
  109. package/lib/test/unit/testreporter.js +21 -3
  110. package/lib/test/unit/type1_parser_spec.js +8 -6
  111. package/lib/test/unit/ui_utils_spec.js +452 -14
  112. package/lib/test/unit/unicode_spec.js +14 -11
  113. package/lib/test/unit/util_spec.js +131 -9
  114. package/lib/web/annotation_layer_builder.js +39 -22
  115. package/lib/web/app.js +1240 -582
  116. package/lib/web/app_options.js +71 -41
  117. package/lib/web/base_viewer.js +508 -179
  118. package/lib/web/chromecom.js +261 -117
  119. package/lib/web/debugger.js +166 -22
  120. package/lib/web/download_manager.js +31 -13
  121. package/lib/web/firefox_print_service.js +17 -9
  122. package/lib/web/firefoxcom.js +283 -79
  123. package/lib/web/genericcom.js +89 -30
  124. package/lib/web/genericl10n.js +142 -30
  125. package/lib/web/grab_to_pan.js +26 -4
  126. package/lib/web/interfaces.js +170 -47
  127. package/lib/web/overlay_manager.js +235 -85
  128. package/lib/web/password_prompt.js +21 -13
  129. package/lib/web/pdf_attachment_viewer.js +38 -18
  130. package/lib/web/pdf_cursor_tools.js +39 -16
  131. package/lib/web/pdf_document_properties.js +80 -30
  132. package/lib/web/pdf_find_bar.js +84 -40
  133. package/lib/web/pdf_find_controller.js +495 -184
  134. package/lib/web/pdf_find_utils.js +111 -0
  135. package/lib/web/pdf_history.js +190 -53
  136. package/lib/web/pdf_link_service.js +137 -76
  137. package/lib/web/pdf_outline_viewer.js +73 -22
  138. package/lib/web/pdf_page_view.js +196 -63
  139. package/lib/web/pdf_presentation_mode.js +99 -34
  140. package/lib/web/pdf_print_service.js +57 -11
  141. package/lib/web/pdf_rendering_queue.js +27 -5
  142. package/lib/web/pdf_sidebar.js +120 -67
  143. package/lib/web/pdf_sidebar_resizer.js +42 -16
  144. package/lib/web/pdf_single_page_viewer.js +74 -66
  145. package/lib/web/pdf_thumbnail_view.js +103 -32
  146. package/lib/web/pdf_thumbnail_viewer.js +64 -24
  147. package/lib/web/pdf_viewer.component.js +112 -32
  148. package/lib/web/pdf_viewer.js +91 -52
  149. package/lib/web/preferences.js +275 -80
  150. package/lib/web/secondary_toolbar.js +165 -40
  151. package/lib/web/text_layer_builder.js +162 -65
  152. package/lib/web/toolbar.js +78 -43
  153. package/lib/web/ui_utils.js +462 -136
  154. package/lib/web/view_history.js +215 -67
  155. package/lib/web/viewer_compatibility.js +4 -13
  156. package/package.json +5 -4
  157. package/web/pdf_viewer.css +58 -1
  158. package/web/pdf_viewer.js +6346 -3919
  159. package/web/pdf_viewer.js.map +1 -1
  160. package/lib/test/unit/fonts_spec.js +0 -81
  161. package/lib/web/dom_events.js +0 -137
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2017 Mozilla Foundation
5
+ * Copyright 2018 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -19,21 +19,21 @@
19
19
  * @licend The above is the entire license notice for the
20
20
  * Javascript code in this page
21
21
  */
22
- 'use strict';
22
+ "use strict";
23
23
 
24
- var _bidi = require('../../core/bidi');
24
+ var _bidi = require("../../core/bidi");
25
25
 
26
26
  describe('bidi', function () {
27
27
  it('should mark text as RTL if more than 30% of text is RTL', function () {
28
- var test = '\u0645\u0635\u0631 Egypt';
29
- var result = 'Egypt \u0631\u0635\u0645';
28
+ var test = "\u0645\u0635\u0631 Egypt";
29
+ var result = "Egypt \u0631\u0635\u0645";
30
30
  var bidiText = (0, _bidi.bidi)(test, -1, false);
31
31
  expect(bidiText.str).toEqual(result);
32
32
  expect(bidiText.dir).toEqual('rtl');
33
33
  });
34
34
  it('should mark text as LTR if less than 30% of text is RTL', function () {
35
- var test = 'Egypt is known as \u0645\u0635\u0631 in Arabic.';
36
- var result = 'Egypt is known as \u0631\u0635\u0645 in Arabic.';
35
+ var test = "Egypt is known as \u0645\u0635\u0631 in Arabic.";
36
+ var result = "Egypt is known as \u0631\u0635\u0645 in Arabic.";
37
37
  var bidiText = (0, _bidi.bidi)(test, -1, false);
38
38
  expect(bidiText.str).toEqual(result);
39
39
  expect(bidiText.dir).toEqual('ltr');
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2017 Mozilla Foundation
5
+ * Copyright 2018 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -19,22 +19,25 @@
19
19
  * @licend The above is the entire license notice for the
20
20
  * Javascript code in this page
21
21
  */
22
- 'use strict';
22
+ "use strict";
23
23
 
24
- var _cff_parser = require('../../core/cff_parser');
24
+ var _cff_parser = require("../../core/cff_parser");
25
25
 
26
- var _fonts = require('../../core/fonts');
26
+ var _fonts = require("../../core/fonts");
27
27
 
28
- var _stream = require('../../core/stream');
28
+ var _stream = require("../../core/stream");
29
29
 
30
30
  describe('CFFParser', function () {
31
31
  function createWithNullProto(obj) {
32
32
  var result = Object.create(null);
33
+
33
34
  for (var i in obj) {
34
35
  result[i] = obj[i];
35
36
  }
37
+
36
38
  return result;
37
39
  }
40
+
38
41
  var privateDictStub = {
39
42
  getByName: function getByName(name) {
40
43
  return 0;
@@ -44,10 +47,12 @@ describe('CFFParser', function () {
44
47
  beforeAll(function (done) {
45
48
  var exampleFont = '0100040100010101134142434445462b' + '54696d65732d526f6d616e000101011f' + 'f81b00f81c02f81d03f819041c6f000d' + 'fb3cfb6efa7cfa1605e911b8f1120003' + '01010813183030312e30303754696d65' + '7320526f6d616e54696d657300000002' + '010102030e0e7d99f92a99fb7695f773' + '8b06f79a93fc7c8c077d99f85695f75e' + '9908fb6e8cf87393f7108b09a70adf0b' + 'f78e14';
46
49
  var fontArr = [];
50
+
47
51
  for (var i = 0, ii = exampleFont.length; i < ii; i += 2) {
48
- var hex = exampleFont.substr(i, 2);
52
+ var hex = exampleFont.substring(i, i + 2);
49
53
  fontArr.push(parseInt(hex, 16));
50
54
  }
55
+
51
56
  fontData = new _stream.Stream(fontArr);
52
57
  done();
53
58
  });
@@ -103,9 +108,11 @@ describe('CFFParser', function () {
103
108
  parser.bytes = bytes;
104
109
  var topDict = cff.topDict;
105
110
  topDict.setByName('Private', [bytes.length, 0]);
111
+
106
112
  var parsePrivateDict = function parsePrivateDict() {
107
113
  parser.parsePrivateDict(topDict);
108
114
  };
115
+
109
116
  expect(parsePrivateDict).not.toThrow();
110
117
  var privateDict = topDict.privateDict;
111
118
  expect(privateDict.getByName('BlueValues')).toBeNull();
@@ -198,7 +205,9 @@ describe('CFFParser', function () {
198
205
  var bytes = new Uint8Array([0x00, 0x00, 0x00, 0x01, 0x08]);
199
206
  parser.bytes = bytes;
200
207
  var encoding = parser.parseEncoding(2, {}, new _cff_parser.CFFStrings(), null);
201
- expect(encoding.encoding).toEqual(createWithNullProto({ 0x8: 1 }));
208
+ expect(encoding.encoding).toEqual(createWithNullProto({
209
+ 0x8: 1
210
+ }));
202
211
  });
203
212
  it('parses encoding format 1', function () {
204
213
  var bytes = new Uint8Array([0x00, 0x00, 0x01, 0x01, 0x07, 0x01]);
@@ -214,22 +223,21 @@ describe('CFFParser', function () {
214
223
  parser.bytes = bytes.slice();
215
224
  var fdSelect = parser.parseFDSelect(0, 2);
216
225
  expect(fdSelect.fdSelect).toEqual([0, 1]);
217
- expect(fdSelect.raw).toEqual(bytes);
226
+ expect(fdSelect.format).toEqual(0);
218
227
  });
219
228
  it('parses fdselect format 3', function () {
220
229
  var bytes = new Uint8Array([0x03, 0x00, 0x02, 0x00, 0x00, 0x09, 0x00, 0x02, 0x0a, 0x00, 0x04]);
221
230
  parser.bytes = bytes.slice();
222
231
  var fdSelect = parser.parseFDSelect(0, 4);
223
232
  expect(fdSelect.fdSelect).toEqual([9, 9, 0xa, 0xa]);
224
- expect(fdSelect.raw).toEqual(bytes);
233
+ expect(fdSelect.format).toEqual(3);
225
234
  });
226
235
  it('parses invalid fdselect format 3 (bug 1146106)', function () {
227
236
  var bytes = new Uint8Array([0x03, 0x00, 0x02, 0x00, 0x01, 0x09, 0x00, 0x02, 0x0a, 0x00, 0x04]);
228
237
  parser.bytes = bytes.slice();
229
238
  var fdSelect = parser.parseFDSelect(0, 4);
230
239
  expect(fdSelect.fdSelect).toEqual([9, 9, 0xa, 0xa]);
231
- bytes[3] = bytes[4] = 0x00;
232
- expect(fdSelect.raw).toEqual(bytes);
240
+ expect(fdSelect.format).toEqual(3);
233
241
  });
234
242
  });
235
243
  describe('CFFCompiler', function () {
@@ -241,6 +249,7 @@ describe('CFFCompiler', function () {
241
249
  }
242
250
  }, {}, _fonts.SEAC_ANALYSIS_ENABLED);
243
251
  }
252
+
244
253
  it('encodes integers', function () {
245
254
  var c = new _cff_parser.CFFCompiler();
246
255
  expect(c.encodeInteger(0)).toEqual([0x8b]);
@@ -266,13 +275,33 @@ describe('CFFCompiler', function () {
266
275
  var names = parser.parseNameIndex(nameIndex.obj);
267
276
  expect(names).toEqual(['_a']);
268
277
  var longName = '';
278
+
269
279
  for (var i = 0; i < 129; i++) {
270
280
  longName += '_';
271
281
  }
282
+
272
283
  nameIndexCompiled = c.compileNameIndex([longName]);
273
284
  parser = testParser(nameIndexCompiled);
274
285
  nameIndex = parser.parseIndex(0);
275
286
  names = parser.parseNameIndex(nameIndex.obj);
276
287
  expect(names[0].length).toEqual(127);
277
288
  });
289
+ it('compiles fdselect format 0', function () {
290
+ var fdSelect = new _cff_parser.CFFFDSelect(0, [3, 2, 1]);
291
+ var c = new _cff_parser.CFFCompiler();
292
+ var out = c.compileFDSelect(fdSelect);
293
+ expect(out).toEqual([0, 3, 2, 1]);
294
+ });
295
+ it('compiles fdselect format 3', function () {
296
+ var fdSelect = new _cff_parser.CFFFDSelect(3, [0, 0, 1, 1]);
297
+ var c = new _cff_parser.CFFCompiler();
298
+ var out = c.compileFDSelect(fdSelect);
299
+ expect(out).toEqual([3, 0, 2, 0, 0, 0, 0, 2, 1, 0, 4]);
300
+ });
301
+ it('compiles fdselect format 3, single range', function () {
302
+ var fdSelect = new _cff_parser.CFFFDSelect(3, [0, 0]);
303
+ var c = new _cff_parser.CFFCompiler();
304
+ var out = c.compileFDSelect(fdSelect);
305
+ expect(out).toEqual([3, 0, 1, 0, 0, 0, 0, 2]);
306
+ });
278
307
  });
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2017 Mozilla Foundation
5
+ * Copyright 2018 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -19,21 +19,23 @@
19
19
  * @licend The above is the entire license notice for the
20
20
  * Javascript code in this page
21
21
  */
22
- 'use strict';
22
+ "use strict";
23
23
 
24
- var _is_node = require('../../shared/is_node');
24
+ var _util = require("../../shared/util");
25
25
 
26
- var _is_node2 = _interopRequireDefault(_is_node);
26
+ var _is_node = _interopRequireDefault(require("../../shared/is_node"));
27
27
 
28
- var _node_stream = require('../../display/node_stream');
28
+ var _node_stream = require("../../display/node_stream");
29
29
 
30
- var _api = require('../../display/api');
30
+ var _api = require("../../display/api");
31
31
 
32
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
33
 
34
- if (!(0, _is_node2.default)()) {
34
+ if (!(0, _is_node.default)()) {
35
35
  throw new Error('The `gulp unittestcli` command can only be used in ' + 'Node.js environments.');
36
36
  }
37
+
38
+ (0, _util.setVerbosityLevel)(_util.VerbosityLevel.ERRORS);
37
39
  (0, _api.setPDFNetworkStreamFactory)(function (params) {
38
40
  return new _node_stream.PDFNodeStream(params);
39
41
  });
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2017 Mozilla Foundation
5
+ * Copyright 2018 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -19,21 +19,19 @@
19
19
  * @licend The above is the entire license notice for the
20
20
  * Javascript code in this page
21
21
  */
22
- 'use strict';
22
+ "use strict";
23
23
 
24
- var _cmap = require('../../core/cmap');
24
+ var _cmap = require("../../core/cmap");
25
25
 
26
- var _dom_utils = require('../../display/dom_utils');
26
+ var _dom_utils = require("../../display/dom_utils");
27
27
 
28
- var _is_node = require('../../shared/is_node');
28
+ var _is_node = _interopRequireDefault(require("../../shared/is_node"));
29
29
 
30
- var _is_node2 = _interopRequireDefault(_is_node);
30
+ var _primitives = require("../../core/primitives");
31
31
 
32
- var _primitives = require('../../core/primitives');
32
+ var _test_utils = require("./test_utils");
33
33
 
34
- var _test_utils = require('./test_utils');
35
-
36
- var _stream = require('../../core/stream');
34
+ var _stream = require("../../core/stream");
37
35
 
38
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
37
 
@@ -46,7 +44,8 @@ describe('cmap', function () {
46
44
  var fetchBuiltInCMap;
47
45
  beforeAll(function (done) {
48
46
  var CMapReaderFactory;
49
- if ((0, _is_node2.default)()) {
47
+
48
+ if ((0, _is_node.default)()) {
50
49
  CMapReaderFactory = new _test_utils.NodeCMapReaderFactory({
51
50
  baseUrl: cMapUrl.node,
52
51
  isCompressed: cMapPacked
@@ -57,9 +56,13 @@ describe('cmap', function () {
57
56
  isCompressed: cMapPacked
58
57
  });
59
58
  }
59
+
60
60
  fetchBuiltInCMap = function fetchBuiltInCMap(name) {
61
- return CMapReaderFactory.fetch({ name: name });
61
+ return CMapReaderFactory.fetch({
62
+ name: name
63
+ });
62
64
  };
65
+
63
66
  done();
64
67
  });
65
68
  afterAll(function () {
@@ -68,7 +71,11 @@ describe('cmap', function () {
68
71
  it('parses beginbfchar', function (done) {
69
72
  var str = '2 beginbfchar\n' + '<03> <00>\n' + '<04> <01>\n' + 'endbfchar\n';
70
73
  var stream = new _stream.StringStream(str);
71
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
74
+
75
+ var cmapPromise = _cmap.CMapFactory.create({
76
+ encoding: stream
77
+ });
78
+
72
79
  cmapPromise.then(function (cmap) {
73
80
  expect(cmap.lookup(0x03)).toEqual(String.fromCharCode(0x00));
74
81
  expect(cmap.lookup(0x04)).toEqual(String.fromCharCode(0x01));
@@ -81,7 +88,11 @@ describe('cmap', function () {
81
88
  it('parses beginbfrange with range', function (done) {
82
89
  var str = '1 beginbfrange\n' + '<06> <0B> 0\n' + 'endbfrange\n';
83
90
  var stream = new _stream.StringStream(str);
84
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
91
+
92
+ var cmapPromise = _cmap.CMapFactory.create({
93
+ encoding: stream
94
+ });
95
+
85
96
  cmapPromise.then(function (cmap) {
86
97
  expect(cmap.lookup(0x05)).toBeUndefined();
87
98
  expect(cmap.lookup(0x06)).toEqual(String.fromCharCode(0x00));
@@ -95,7 +106,11 @@ describe('cmap', function () {
95
106
  it('parses beginbfrange with array', function (done) {
96
107
  var str = '1 beginbfrange\n' + '<0D> <12> [ 0 1 2 3 4 5 ]\n' + 'endbfrange\n';
97
108
  var stream = new _stream.StringStream(str);
98
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
109
+
110
+ var cmapPromise = _cmap.CMapFactory.create({
111
+ encoding: stream
112
+ });
113
+
99
114
  cmapPromise.then(function (cmap) {
100
115
  expect(cmap.lookup(0x0C)).toBeUndefined();
101
116
  expect(cmap.lookup(0x0D)).toEqual(0x00);
@@ -109,7 +124,11 @@ describe('cmap', function () {
109
124
  it('parses begincidchar', function (done) {
110
125
  var str = '1 begincidchar\n' + '<14> 0\n' + 'endcidchar\n';
111
126
  var stream = new _stream.StringStream(str);
112
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
127
+
128
+ var cmapPromise = _cmap.CMapFactory.create({
129
+ encoding: stream
130
+ });
131
+
113
132
  cmapPromise.then(function (cmap) {
114
133
  expect(cmap.lookup(0x14)).toEqual(0x00);
115
134
  expect(cmap.lookup(0x15)).toBeUndefined();
@@ -121,7 +140,11 @@ describe('cmap', function () {
121
140
  it('parses begincidrange', function (done) {
122
141
  var str = '1 begincidrange\n' + '<0016> <001B> 0\n' + 'endcidrange\n';
123
142
  var stream = new _stream.StringStream(str);
124
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
143
+
144
+ var cmapPromise = _cmap.CMapFactory.create({
145
+ encoding: stream
146
+ });
147
+
125
148
  cmapPromise.then(function (cmap) {
126
149
  expect(cmap.lookup(0x15)).toBeUndefined();
127
150
  expect(cmap.lookup(0x16)).toEqual(0x00);
@@ -135,7 +158,11 @@ describe('cmap', function () {
135
158
  it('decodes codespace ranges', function (done) {
136
159
  var str = '1 begincodespacerange\n' + '<01> <02>\n' + '<00000003> <00000004>\n' + 'endcodespacerange\n';
137
160
  var stream = new _stream.StringStream(str);
138
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
161
+
162
+ var cmapPromise = _cmap.CMapFactory.create({
163
+ encoding: stream
164
+ });
165
+
139
166
  cmapPromise.then(function (cmap) {
140
167
  var c = {};
141
168
  cmap.readCharCode(String.fromCharCode(1), 0, c);
@@ -152,7 +179,11 @@ describe('cmap', function () {
152
179
  it('decodes 4 byte codespace ranges', function (done) {
153
180
  var str = '1 begincodespacerange\n' + '<8EA1A1A1> <8EA1FEFE>\n' + 'endcodespacerange\n';
154
181
  var stream = new _stream.StringStream(str);
155
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
182
+
183
+ var cmapPromise = _cmap.CMapFactory.create({
184
+ encoding: stream
185
+ });
186
+
156
187
  cmapPromise.then(function (cmap) {
157
188
  var c = {};
158
189
  cmap.readCharCode(String.fromCharCode(0x8E, 0xA1, 0xA1, 0xA1), 0, c);
@@ -166,11 +197,13 @@ describe('cmap', function () {
166
197
  it('read usecmap', function (done) {
167
198
  var str = '/Adobe-Japan1-1 usecmap\n';
168
199
  var stream = new _stream.StringStream(str);
200
+
169
201
  var cmapPromise = _cmap.CMapFactory.create({
170
202
  encoding: stream,
171
203
  fetchBuiltInCMap: fetchBuiltInCMap,
172
204
  useCMap: null
173
205
  });
206
+
174
207
  cmapPromise.then(function (cmap) {
175
208
  expect(cmap instanceof _cmap.CMap).toEqual(true);
176
209
  expect(cmap.useCMap).not.toBeNull();
@@ -185,7 +218,11 @@ describe('cmap', function () {
185
218
  it('parses cmapname', function (done) {
186
219
  var str = '/CMapName /Identity-H def\n';
187
220
  var stream = new _stream.StringStream(str);
188
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
221
+
222
+ var cmapPromise = _cmap.CMapFactory.create({
223
+ encoding: stream
224
+ });
225
+
189
226
  cmapPromise.then(function (cmap) {
190
227
  expect(cmap.name).toEqual('Identity-H');
191
228
  done();
@@ -196,7 +233,11 @@ describe('cmap', function () {
196
233
  it('parses wmode', function (done) {
197
234
  var str = '/WMode 1 def\n';
198
235
  var stream = new _stream.StringStream(str);
199
- var cmapPromise = _cmap.CMapFactory.create({ encoding: stream });
236
+
237
+ var cmapPromise = _cmap.CMapFactory.create({
238
+ encoding: stream
239
+ });
240
+
200
241
  cmapPromise.then(function (cmap) {
201
242
  expect(cmap.vertical).toEqual(true);
202
243
  done();
@@ -210,6 +251,7 @@ describe('cmap', function () {
210
251
  fetchBuiltInCMap: fetchBuiltInCMap,
211
252
  useCMap: null
212
253
  });
254
+
213
255
  cmapPromise.then(function (cmap) {
214
256
  expect(cmap instanceof _cmap.CMap).toEqual(true);
215
257
  expect(cmap.useCMap).toBeNull();
@@ -227,6 +269,7 @@ describe('cmap', function () {
227
269
  fetchBuiltInCMap: fetchBuiltInCMap,
228
270
  useCMap: null
229
271
  });
272
+
230
273
  cmapPromise.then(function (cmap) {
231
274
  expect(cmap instanceof _cmap.IdentityCMap).toEqual(true);
232
275
  expect(cmap.vertical).toEqual(false);
@@ -245,6 +288,7 @@ describe('cmap', function () {
245
288
  fetchBuiltInCMap: fetchBuiltInCMap,
246
289
  useCMap: null
247
290
  });
291
+
248
292
  cmapPromise.then(function () {
249
293
  done.fail('No CMap should be loaded');
250
294
  }, function (reason) {
@@ -255,14 +299,18 @@ describe('cmap', function () {
255
299
  });
256
300
  it('attempts to load a built-in CMap without the necessary API parameters', function (done) {
257
301
  function tmpFetchBuiltInCMap(name) {
258
- var CMapReaderFactory = (0, _is_node2.default)() ? new _test_utils.NodeCMapReaderFactory({}) : new _dom_utils.DOMCMapReaderFactory({});
259
- return CMapReaderFactory.fetch({ name: name });
302
+ var CMapReaderFactory = (0, _is_node.default)() ? new _test_utils.NodeCMapReaderFactory({}) : new _dom_utils.DOMCMapReaderFactory({});
303
+ return CMapReaderFactory.fetch({
304
+ name: name
305
+ });
260
306
  }
307
+
261
308
  var cmapPromise = _cmap.CMapFactory.create({
262
309
  encoding: _primitives.Name.get('Adobe-Japan1-1'),
263
310
  fetchBuiltInCMap: tmpFetchBuiltInCMap,
264
311
  useCMap: null
265
312
  });
313
+
266
314
  cmapPromise.then(function () {
267
315
  done.fail('No CMap should be loaded');
268
316
  }, function (reason) {
@@ -273,8 +321,9 @@ describe('cmap', function () {
273
321
  });
274
322
  it('attempts to load a built-in CMap with inconsistent API parameters', function (done) {
275
323
  function tmpFetchBuiltInCMap(name) {
276
- var CMapReaderFactory = void 0;
277
- if ((0, _is_node2.default)()) {
324
+ var CMapReaderFactory;
325
+
326
+ if ((0, _is_node.default)()) {
278
327
  CMapReaderFactory = new _test_utils.NodeCMapReaderFactory({
279
328
  baseUrl: cMapUrl.node,
280
329
  isCompressed: false
@@ -285,13 +334,18 @@ describe('cmap', function () {
285
334
  isCompressed: false
286
335
  });
287
336
  }
288
- return CMapReaderFactory.fetch({ name: name });
337
+
338
+ return CMapReaderFactory.fetch({
339
+ name: name
340
+ });
289
341
  }
342
+
290
343
  var cmapPromise = _cmap.CMapFactory.create({
291
344
  encoding: _primitives.Name.get('Adobe-Japan1-1'),
292
345
  fetchBuiltInCMap: tmpFetchBuiltInCMap,
293
346
  useCMap: null
294
347
  });
348
+
295
349
  cmapPromise.then(function () {
296
350
  done.fail('No CMap should be loaded');
297
351
  }, function (reason) {