pdfjs-dist 2.0.489 → 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.
- package/CODE_OF_CONDUCT.md +15 -0
- package/bower.json +1 -1
- package/build/pdf.js +18515 -11402
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +48266 -37137
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/external/url/url-lib.js +627 -0
- package/image_decoders/pdf.image_decoders.js +11350 -0
- package/image_decoders/pdf.image_decoders.js.map +1 -0
- package/image_decoders/pdf.image_decoders.min.js +1 -0
- package/lib/core/annotation.js +587 -242
- package/lib/core/arithmetic_decoder.js +275 -245
- package/lib/core/bidi.js +65 -6
- package/lib/core/ccitt.js +173 -18
- package/lib/core/ccitt_stream.js +15 -6
- package/lib/core/cff_parser.js +433 -61
- package/lib/core/charsets.js +5 -4
- package/lib/core/chunked_stream.js +400 -152
- package/lib/core/cmap.js +326 -87
- package/lib/core/colorspace.js +874 -594
- package/lib/core/core_utils.js +147 -0
- package/lib/core/crypto.js +290 -45
- package/lib/core/document.js +560 -268
- package/lib/core/encodings.js +19 -10
- package/lib/core/evaluator.js +1005 -360
- package/lib/core/font_renderer.js +331 -97
- package/lib/core/fonts.js +812 -195
- package/lib/core/function.js +284 -71
- package/lib/core/glyphlist.js +4 -3
- package/lib/core/image.js +169 -62
- package/lib/core/image_utils.js +111 -0
- package/lib/core/jbig2.js +479 -66
- package/lib/core/jbig2_stream.js +19 -8
- package/lib/core/jpeg_stream.js +38 -13
- package/lib/core/jpg.js +253 -29
- package/lib/core/jpx.js +396 -6
- package/lib/core/jpx_stream.js +18 -6
- package/lib/core/metrics.js +15 -15
- package/lib/core/murmurhash3.js +56 -34
- package/lib/core/obj.js +1354 -488
- package/lib/core/operator_list.js +144 -31
- package/lib/core/parser.js +539 -191
- package/lib/core/pattern.js +148 -14
- package/lib/core/pdf_manager.js +323 -133
- package/lib/core/primitives.js +111 -24
- package/lib/core/ps_parser.js +134 -45
- package/lib/core/standard_fonts.js +17 -17
- package/lib/core/stream.js +313 -34
- package/lib/core/type1_parser.js +143 -13
- package/lib/core/unicode.js +32 -5
- package/lib/core/worker.js +217 -190
- package/lib/core/worker_stream.js +277 -0
- package/lib/display/annotation_layer.js +450 -133
- package/lib/display/api.js +1597 -784
- package/lib/display/api_compatibility.js +11 -13
- package/lib/display/canvas.js +360 -44
- package/lib/display/content_disposition.js +83 -32
- package/lib/display/display_utils.js +747 -0
- package/lib/display/fetch_stream.js +221 -90
- package/lib/display/font_loader.js +468 -236
- package/lib/display/metadata.js +38 -16
- package/lib/display/network.js +635 -428
- package/lib/display/network_utils.js +32 -19
- package/lib/display/node_stream.js +367 -175
- package/lib/display/pattern_helper.js +81 -31
- package/lib/display/svg.js +1235 -519
- package/lib/display/text_layer.js +153 -29
- package/lib/display/transport_stream.js +345 -94
- package/lib/display/webgl.js +64 -18
- package/lib/display/worker_options.js +5 -4
- package/lib/display/xml_parser.js +166 -53
- package/lib/examples/node/domstubs.js +60 -4
- package/lib/pdf.js +36 -14
- package/lib/pdf.worker.js +5 -3
- package/lib/shared/compatibility.js +158 -564
- package/lib/shared/global_scope.js +2 -2
- package/lib/shared/is_node.js +4 -4
- package/lib/shared/message_handler.js +521 -0
- package/lib/shared/streams_polyfill.js +21 -17
- package/lib/shared/url_polyfill.js +56 -0
- package/lib/shared/util.js +243 -710
- package/lib/test/unit/annotation_spec.js +870 -401
- package/lib/test/unit/api_spec.js +657 -345
- package/lib/test/unit/bidi_spec.js +7 -7
- package/lib/test/unit/cff_parser_spec.js +54 -11
- package/lib/test/unit/clitests_helper.js +10 -8
- package/lib/test/unit/cmap_spec.js +95 -41
- package/lib/test/unit/colorspace_spec.js +115 -63
- package/lib/test/unit/core_utils_spec.js +191 -0
- package/lib/test/unit/crypto_spec.js +17 -5
- package/lib/test/unit/custom_spec.js +43 -55
- package/lib/test/unit/display_svg_spec.js +34 -18
- package/lib/test/unit/display_utils_spec.js +273 -0
- package/lib/test/unit/document_spec.js +8 -13
- package/lib/test/unit/encodings_spec.js +25 -45
- package/lib/test/unit/evaluator_spec.js +38 -15
- package/lib/test/unit/fetch_stream_spec.js +109 -0
- package/lib/test/unit/function_spec.js +17 -5
- package/lib/test/unit/jasmine-boot.js +33 -20
- package/lib/test/unit/{util_stream_spec.js → message_handler_spec.js} +41 -69
- package/lib/test/unit/metadata_spec.js +71 -11
- package/lib/test/unit/murmurhash3_spec.js +3 -3
- package/lib/test/unit/network_spec.js +19 -54
- package/lib/test/unit/network_utils_spec.js +91 -14
- package/lib/test/unit/node_stream_spec.js +56 -32
- package/lib/test/unit/parser_spec.js +162 -71
- package/lib/test/unit/pdf_find_controller_spec.js +230 -0
- package/lib/test/unit/pdf_find_utils_spec.js +63 -0
- package/lib/test/unit/pdf_history_spec.js +21 -9
- package/lib/test/unit/primitives_spec.js +53 -20
- package/lib/test/unit/stream_spec.js +12 -4
- package/lib/test/unit/test_utils.js +273 -56
- package/lib/test/unit/testreporter.js +21 -3
- package/lib/test/unit/type1_parser_spec.js +8 -6
- package/lib/test/unit/ui_utils_spec.js +454 -16
- package/lib/test/unit/unicode_spec.js +18 -15
- package/lib/test/unit/util_spec.js +87 -128
- package/lib/web/annotation_layer_builder.js +39 -22
- package/lib/web/app.js +1290 -588
- package/lib/web/app_options.js +100 -62
- package/lib/web/base_viewer.js +511 -182
- package/lib/web/chromecom.js +261 -117
- package/lib/web/debugger.js +166 -22
- package/lib/web/download_manager.js +32 -13
- package/lib/web/firefox_print_service.js +20 -10
- package/lib/web/firefoxcom.js +315 -80
- package/lib/web/genericcom.js +89 -30
- package/lib/web/genericl10n.js +142 -30
- package/lib/web/grab_to_pan.js +28 -4
- package/lib/web/interfaces.js +170 -47
- package/lib/web/overlay_manager.js +235 -85
- package/lib/web/password_prompt.js +22 -14
- package/lib/web/pdf_attachment_viewer.js +38 -18
- package/lib/web/pdf_cursor_tools.js +39 -16
- package/lib/web/pdf_document_properties.js +255 -136
- package/lib/web/pdf_find_bar.js +84 -40
- package/lib/web/pdf_find_controller.js +495 -184
- package/lib/web/pdf_find_utils.js +111 -0
- package/lib/web/pdf_history.js +190 -53
- package/lib/web/pdf_link_service.js +138 -77
- package/lib/web/pdf_outline_viewer.js +122 -46
- package/lib/web/pdf_page_view.js +191 -67
- package/lib/web/pdf_presentation_mode.js +99 -34
- package/lib/web/pdf_print_service.js +61 -13
- package/lib/web/pdf_rendering_queue.js +28 -9
- package/lib/web/pdf_sidebar.js +141 -81
- package/lib/web/pdf_sidebar_resizer.js +42 -16
- package/lib/web/pdf_single_page_viewer.js +74 -66
- package/lib/web/pdf_thumbnail_view.js +104 -33
- package/lib/web/pdf_thumbnail_viewer.js +66 -26
- package/lib/web/pdf_viewer.component.js +112 -32
- package/lib/web/pdf_viewer.js +91 -52
- package/lib/web/preferences.js +284 -89
- package/lib/web/secondary_toolbar.js +165 -40
- package/lib/web/text_layer_builder.js +134 -59
- package/lib/web/toolbar.js +78 -43
- package/lib/web/ui_utils.js +462 -136
- package/lib/web/view_history.js +215 -67
- package/lib/web/viewer_compatibility.js +4 -13
- package/package.json +5 -4
- package/web/pdf_viewer.css +79 -11
- package/web/pdf_viewer.js +6107 -3748
- package/web/pdf_viewer.js.map +1 -1
- package/lib/display/dom_utils.js +0 -309
- package/lib/test/unit/dom_utils_spec.js +0 -89
- package/lib/test/unit/fonts_spec.js +0 -81
- package/lib/web/dom_events.js +0 -137
@@ -2,7 +2,7 @@
|
|
2
2
|
* @licstart The following is the entire license notice for the
|
3
3
|
* Javascript code in this page
|
4
4
|
*
|
5
|
-
* Copyright
|
5
|
+
* Copyright 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.
|
@@ -19,67 +19,232 @@
|
|
19
19
|
* @licend The above is the entire license notice for the
|
20
20
|
* Javascript code in this page
|
21
21
|
*/
|
22
|
-
|
22
|
+
"use strict";
|
23
23
|
|
24
24
|
Object.defineProperty(exports, "__esModule", {
|
25
25
|
value: true
|
26
26
|
});
|
27
|
-
exports.
|
27
|
+
exports.buildGetDocumentParams = buildGetDocumentParams;
|
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"));
|
32
|
+
|
33
|
+
var _util = require("../../shared/util");
|
28
34
|
|
29
|
-
var
|
35
|
+
var _is_node = _interopRequireDefault(require("../../shared/is_node"));
|
30
36
|
|
31
|
-
var
|
37
|
+
var _primitives = require("../../core/primitives");
|
32
38
|
|
33
|
-
var
|
39
|
+
var _document = require("../../core/document");
|
34
40
|
|
35
|
-
|
41
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
36
42
|
|
37
|
-
var
|
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); } }
|
38
44
|
|
39
|
-
function
|
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); }); }; }
|
40
46
|
|
41
47
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
42
48
|
|
43
|
-
var
|
49
|
+
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); } }
|
50
|
+
|
51
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
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
|
+
|
124
|
+
var NodeFileReaderFactory =
|
125
|
+
/*#__PURE__*/
|
126
|
+
function () {
|
44
127
|
function NodeFileReaderFactory() {
|
45
128
|
_classCallCheck(this, NodeFileReaderFactory);
|
46
129
|
}
|
47
130
|
|
48
131
|
_createClass(NodeFileReaderFactory, null, [{
|
49
|
-
key:
|
50
|
-
value: function
|
51
|
-
var
|
52
|
-
|
53
|
-
|
54
|
-
|
132
|
+
key: "fetch",
|
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
|
+
}));
|
161
|
+
|
162
|
+
function fetch(_x3) {
|
163
|
+
return _fetch2.apply(this, arguments);
|
164
|
+
}
|
165
|
+
|
166
|
+
return fetch;
|
167
|
+
}()
|
55
168
|
}]);
|
56
169
|
|
57
170
|
return NodeFileReaderFactory;
|
58
171
|
}();
|
59
172
|
|
173
|
+
exports.NodeFileReaderFactory = NodeFileReaderFactory;
|
60
174
|
var TEST_PDFS_PATH = {
|
61
175
|
dom: '../pdfs/',
|
62
176
|
node: './test/pdfs/'
|
63
177
|
};
|
178
|
+
exports.TEST_PDFS_PATH = TEST_PDFS_PATH;
|
179
|
+
|
64
180
|
function buildGetDocumentParams(filename, options) {
|
65
181
|
var params = Object.create(null);
|
66
|
-
|
182
|
+
|
183
|
+
if ((0, _is_node["default"])()) {
|
67
184
|
params.url = TEST_PDFS_PATH.node + filename;
|
68
185
|
} else {
|
69
186
|
params.url = new URL(TEST_PDFS_PATH.dom + filename, window.location).href;
|
70
187
|
}
|
188
|
+
|
71
189
|
for (var option in options) {
|
72
190
|
params[option] = options[option];
|
73
191
|
}
|
192
|
+
|
74
193
|
return params;
|
75
194
|
}
|
76
195
|
|
77
|
-
var
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
196
|
+
var NodeCanvasFactory =
|
197
|
+
/*#__PURE__*/
|
198
|
+
function () {
|
199
|
+
function NodeCanvasFactory() {
|
200
|
+
_classCallCheck(this, NodeCanvasFactory);
|
201
|
+
}
|
202
|
+
|
203
|
+
_createClass(NodeCanvasFactory, [{
|
204
|
+
key: "create",
|
205
|
+
value: function create(width, height) {
|
206
|
+
(0, _util.assert)(width > 0 && height > 0, 'Invalid canvas size');
|
207
|
+
|
208
|
+
var Canvas = require('canvas');
|
209
|
+
|
210
|
+
var canvas = Canvas.createCanvas(width, height);
|
211
|
+
return {
|
212
|
+
canvas: canvas,
|
213
|
+
context: canvas.getContext('2d')
|
214
|
+
};
|
215
|
+
}
|
216
|
+
}, {
|
217
|
+
key: "reset",
|
218
|
+
value: function reset(canvasAndContext, width, height) {
|
219
|
+
(0, _util.assert)(canvasAndContext.canvas, 'Canvas is not specified');
|
220
|
+
(0, _util.assert)(width > 0 && height > 0, 'Invalid canvas size');
|
221
|
+
canvasAndContext.canvas.width = width;
|
222
|
+
canvasAndContext.canvas.height = height;
|
223
|
+
}
|
224
|
+
}, {
|
225
|
+
key: "destroy",
|
226
|
+
value: function destroy(canvasAndContext) {
|
227
|
+
(0, _util.assert)(canvasAndContext.canvas, 'Canvas is not specified');
|
228
|
+
canvasAndContext.canvas.width = 0;
|
229
|
+
canvasAndContext.canvas.height = 0;
|
230
|
+
canvasAndContext.canvas = null;
|
231
|
+
canvasAndContext.context = null;
|
232
|
+
}
|
233
|
+
}]);
|
234
|
+
|
235
|
+
return NodeCanvasFactory;
|
236
|
+
}();
|
237
|
+
|
238
|
+
exports.NodeCanvasFactory = NodeCanvasFactory;
|
239
|
+
|
240
|
+
var NodeCMapReaderFactory =
|
241
|
+
/*#__PURE__*/
|
242
|
+
function () {
|
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;
|
83
248
|
|
84
249
|
_classCallCheck(this, NodeCMapReaderFactory);
|
85
250
|
|
@@ -88,43 +253,85 @@ var NodeCMapReaderFactory = function () {
|
|
88
253
|
}
|
89
254
|
|
90
255
|
_createClass(NodeCMapReaderFactory, [{
|
91
|
-
key:
|
92
|
-
value: function
|
93
|
-
var
|
256
|
+
key: "fetch",
|
257
|
+
value: function () {
|
258
|
+
var _fetch3 = _asyncToGenerator(
|
259
|
+
/*#__PURE__*/
|
260
|
+
_regenerator["default"].mark(function _callee3(_ref3) {
|
261
|
+
var _this = this;
|
94
262
|
|
95
|
-
|
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;
|
96
269
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
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
|
+
}
|
110
310
|
}
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
}
|
117
|
-
|
311
|
+
}, _callee3, this);
|
312
|
+
}));
|
313
|
+
|
314
|
+
function fetch(_x4) {
|
315
|
+
return _fetch3.apply(this, arguments);
|
316
|
+
}
|
317
|
+
|
318
|
+
return fetch;
|
319
|
+
}()
|
118
320
|
}]);
|
119
321
|
|
120
322
|
return NodeCMapReaderFactory;
|
121
323
|
}();
|
122
324
|
|
123
|
-
|
325
|
+
exports.NodeCMapReaderFactory = NodeCMapReaderFactory;
|
326
|
+
|
327
|
+
var XRefMock =
|
328
|
+
/*#__PURE__*/
|
329
|
+
function () {
|
124
330
|
function XRefMock(array) {
|
125
331
|
_classCallCheck(this, XRefMock);
|
126
332
|
|
127
333
|
this._map = Object.create(null);
|
334
|
+
|
128
335
|
for (var key in array) {
|
129
336
|
var obj = array[key];
|
130
337
|
this._map[obj.ref.toString()] = obj.data;
|
@@ -132,25 +339,26 @@ var XRefMock = function () {
|
|
132
339
|
}
|
133
340
|
|
134
341
|
_createClass(XRefMock, [{
|
135
|
-
key:
|
342
|
+
key: "fetch",
|
136
343
|
value: function fetch(ref) {
|
137
344
|
return this._map[ref.toString()];
|
138
345
|
}
|
139
346
|
}, {
|
140
|
-
key:
|
347
|
+
key: "fetchAsync",
|
141
348
|
value: function fetchAsync(ref) {
|
142
349
|
return Promise.resolve(this.fetch(ref));
|
143
350
|
}
|
144
351
|
}, {
|
145
|
-
key:
|
352
|
+
key: "fetchIfRef",
|
146
353
|
value: function fetchIfRef(obj) {
|
147
354
|
if (!(0, _primitives.isRef)(obj)) {
|
148
355
|
return obj;
|
149
356
|
}
|
357
|
+
|
150
358
|
return this.fetch(obj);
|
151
359
|
}
|
152
360
|
}, {
|
153
|
-
key:
|
361
|
+
key: "fetchIfRefAsync",
|
154
362
|
value: function fetchIfRefAsync(obj) {
|
155
363
|
return Promise.resolve(this.fetchIfRef(obj));
|
156
364
|
}
|
@@ -159,8 +367,17 @@ var XRefMock = function () {
|
|
159
367
|
return XRefMock;
|
160
368
|
}();
|
161
369
|
|
162
|
-
exports.NodeFileReaderFactory = NodeFileReaderFactory;
|
163
|
-
exports.NodeCMapReaderFactory = NodeCMapReaderFactory;
|
164
370
|
exports.XRefMock = XRefMock;
|
165
|
-
|
166
|
-
|
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
|
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.
|
@@ -26,6 +26,7 @@ var TestReporter = function TestReporter(browser, appPath) {
|
|
26
26
|
var r = new XMLHttpRequest();
|
27
27
|
r.open('POST', action, true);
|
28
28
|
r.setRequestHeader('Content-Type', 'application/json');
|
29
|
+
|
29
30
|
r.onreadystatechange = function sendTaskResultOnreadystatechange(e) {
|
30
31
|
if (r.readyState === 4) {
|
31
32
|
if (r.status !== 200) {
|
@@ -37,47 +38,64 @@ var TestReporter = function TestReporter(browser, appPath) {
|
|
37
38
|
}
|
38
39
|
}
|
39
40
|
};
|
41
|
+
|
40
42
|
json['browser'] = browser;
|
41
43
|
r.send(JSON.stringify(json));
|
42
44
|
}
|
45
|
+
|
43
46
|
function sendInfo(message) {
|
44
|
-
send('/info', {
|
47
|
+
send('/info', {
|
48
|
+
message: message
|
49
|
+
});
|
45
50
|
}
|
51
|
+
|
46
52
|
function sendResult(status, description, error) {
|
47
53
|
var message = {
|
48
54
|
status: status,
|
49
55
|
description: description
|
50
56
|
};
|
57
|
+
|
51
58
|
if (typeof error !== 'undefined') {
|
52
59
|
message['error'] = error;
|
53
60
|
}
|
61
|
+
|
54
62
|
send('/submit_task_results', message);
|
55
63
|
}
|
64
|
+
|
56
65
|
function sendQuitRequest() {
|
57
66
|
send('/tellMeToQuit?path=' + escape(appPath), {});
|
58
67
|
}
|
68
|
+
|
59
69
|
this.now = function () {
|
60
70
|
return new Date().getTime();
|
61
71
|
};
|
72
|
+
|
62
73
|
this.jasmineStarted = function (suiteInfo) {
|
63
74
|
this.runnerStartTime = this.now();
|
64
|
-
sendInfo('Started
|
75
|
+
sendInfo('Started tests for ' + browser + '.');
|
65
76
|
};
|
77
|
+
|
66
78
|
this.suiteStarted = function (result) {};
|
79
|
+
|
67
80
|
this.specStarted = function (result) {};
|
81
|
+
|
68
82
|
this.specDone = function (result) {
|
69
83
|
if (result.failedExpectations.length === 0) {
|
70
84
|
sendResult('TEST-PASSED', result.description);
|
71
85
|
} else {
|
72
86
|
var failedMessages = '';
|
73
87
|
var items = result.failedExpectations;
|
88
|
+
|
74
89
|
for (var i = 0, ii = items.length; i < ii; i++) {
|
75
90
|
failedMessages += items[i].message + ' ';
|
76
91
|
}
|
92
|
+
|
77
93
|
sendResult('TEST-UNEXPECTED-FAIL', result.description, failedMessages);
|
78
94
|
}
|
79
95
|
};
|
96
|
+
|
80
97
|
this.suiteDone = function (result) {};
|
98
|
+
|
81
99
|
this.jasmineDone = function () {
|
82
100
|
setTimeout(sendQuitRequest, 500);
|
83
101
|
};
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* @licstart The following is the entire license notice for the
|
3
3
|
* Javascript code in this page
|
4
4
|
*
|
5
|
-
* Copyright
|
5
|
+
* Copyright 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.
|
@@ -19,13 +19,13 @@
|
|
19
19
|
* @licend The above is the entire license notice for the
|
20
20
|
* Javascript code in this page
|
21
21
|
*/
|
22
|
-
|
22
|
+
"use strict";
|
23
23
|
|
24
|
-
var _fonts = require(
|
24
|
+
var _fonts = require("../../core/fonts");
|
25
25
|
|
26
|
-
var _stream = require(
|
26
|
+
var _stream = require("../../core/stream");
|
27
27
|
|
28
|
-
var _type1_parser = require(
|
28
|
+
var _type1_parser = require("../../core/type1_parser");
|
29
29
|
|
30
30
|
describe('Type1Parser', function () {
|
31
31
|
it('splits tokens', function () {
|
@@ -95,7 +95,9 @@ describe('Type1Parser', function () {
|
|
95
95
|
it('parses font header encoding', function () {
|
96
96
|
var stream = new _stream.StringStream('/Encoding 256 array\n' + '0 1 255 {1 index exch /.notdef put} for\n' + 'dup 33 /arrowright put\n' + 'readonly def\n');
|
97
97
|
var parser = new _type1_parser.Type1Parser(stream, false, _fonts.SEAC_ANALYSIS_ENABLED);
|
98
|
-
var props = {
|
98
|
+
var props = {
|
99
|
+
overridableEncoding: true
|
100
|
+
};
|
99
101
|
parser.extractFontHeader(props);
|
100
102
|
expect(props.builtInEncoding[33]).toEqual('arrowright');
|
101
103
|
});
|