Bug 1582724 - Update pdf.js to version 2.3.183. r=bdahl

Differential Revision: https://phabricator.services.mozilla.com/D46592

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ryan VanderMeulen 2019-09-23 17:07:39 +00:00
Родитель 5ba1c3f18f
Коммит 3778a57619
5 изменённых файлов: 387 добавлений и 362 удалений

Просмотреть файл

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.3.164
Current extension version is: 2.3.183
Taken from upstream commit: 12ff2527
Taken from upstream commit: c289f3a9

Просмотреть файл

@ -123,24 +123,24 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
var pdfjsVersion = '2.3.164';
var pdfjsBuild = '12ff2527';
var pdfjsVersion = '2.3.183';
var pdfjsBuild = 'c289f3a9';
var pdfjsSharedUtil = __w_pdfjs_require__(1);
var pdfjsDisplayAPI = __w_pdfjs_require__(6);
var pdfjsDisplayAPI = __w_pdfjs_require__(5);
var pdfjsDisplayTextLayer = __w_pdfjs_require__(18);
var pdfjsDisplayTextLayer = __w_pdfjs_require__(17);
var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(19);
var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(18);
var pdfjsDisplayDisplayUtils = __w_pdfjs_require__(7);
var pdfjsDisplayDisplayUtils = __w_pdfjs_require__(6);
var pdfjsDisplaySVG = __w_pdfjs_require__(20);
var pdfjsDisplaySVG = __w_pdfjs_require__(19);
let pdfjsDisplayWorkerOptions = __w_pdfjs_require__(12);
let pdfjsDisplayWorkerOptions = __w_pdfjs_require__(11);
let pdfjsDisplayAPICompatibility = __w_pdfjs_require__(9);
let pdfjsDisplayAPICompatibility = __w_pdfjs_require__(8);
;
exports.build = pdfjsDisplayAPI.build;
@ -169,7 +169,6 @@ exports.removeNullCharacters = pdfjsSharedUtil.removeNullCharacters;
exports.shadow = pdfjsSharedUtil.shadow;
exports.Util = pdfjsSharedUtil.Util;
exports.ReadableStream = pdfjsSharedUtil.ReadableStream;
exports.URL = pdfjsSharedUtil.URL;
exports.RenderingCancelledException = pdfjsDisplayDisplayUtils.RenderingCancelledException;
exports.getFilenameFromUrl = pdfjsDisplayDisplayUtils.getFilenameFromUrl;
exports.LinkTarget = pdfjsDisplayDisplayUtils.LinkTarget;
@ -227,20 +226,12 @@ Object.defineProperty(exports, "ReadableStream", {
return _streams_polyfill.ReadableStream;
}
});
Object.defineProperty(exports, "URL", {
enumerable: true,
get: function () {
return _url_polyfill.URL;
}
});
exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = void 0;
__w_pdfjs_require__(2);
var _streams_polyfill = __w_pdfjs_require__(4);
var _url_polyfill = __w_pdfjs_require__(5);
const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
@ -561,7 +552,7 @@ function isSameOrigin(baseUrl, otherUrl) {
let base;
try {
base = new _url_polyfill.URL(baseUrl);
base = new URL(baseUrl);
if (!base.origin || base.origin === 'null') {
return false;
@ -570,7 +561,7 @@ function isSameOrigin(baseUrl, otherUrl) {
return false;
}
const other = new _url_polyfill.URL(otherUrl, base);
const other = new URL(otherUrl, base);
return base.origin === other.origin;
}
@ -598,7 +589,7 @@ function createValidAbsoluteUrl(url, baseUrl) {
}
try {
const absoluteUrl = baseUrl ? new _url_polyfill.URL(url, baseUrl) : new _url_polyfill.URL(url);
const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
if (_isValidProtocol(absoluteUrl)) {
return absoluteUrl;
@ -1034,11 +1025,11 @@ function createPromiseCapability() {
const createObjectURL = function createObjectURLClosure() {
const digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
return function createObjectURL(data, contentType, forceDataSchema = false) {
if (!forceDataSchema && _url_polyfill.URL.createObjectURL) {
if (!forceDataSchema && URL.createObjectURL) {
const blob = new Blob([data], {
type: contentType
});
return _url_polyfill.URL.createObjectURL(blob);
return URL.createObjectURL(blob);
}
let buffer = `data:${contentType};base64,`;
@ -1102,17 +1093,6 @@ module.exports = typeof window !== 'undefined' && window.Math === Math ? window
"use strict";
{
exports.URL = URL;
}
/***/ }),
/* 6 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@ -1122,29 +1102,30 @@ exports.build = exports.version = exports.PDFPageProxy = exports.PDFDocumentProx
var _util = __w_pdfjs_require__(1);
var _display_utils = __w_pdfjs_require__(7);
var _display_utils = __w_pdfjs_require__(6);
var _font_loader = __w_pdfjs_require__(8);
var _font_loader = __w_pdfjs_require__(7);
var _api_compatibility = __w_pdfjs_require__(9);
var _api_compatibility = __w_pdfjs_require__(8);
var _canvas = __w_pdfjs_require__(10);
var _canvas = __w_pdfjs_require__(9);
var _global_scope = _interopRequireDefault(__w_pdfjs_require__(3));
var _worker_options = __w_pdfjs_require__(12);
var _worker_options = __w_pdfjs_require__(11);
var _message_handler = __w_pdfjs_require__(13);
var _message_handler = __w_pdfjs_require__(12);
var _metadata = __w_pdfjs_require__(14);
var _metadata = __w_pdfjs_require__(13);
var _transport_stream = __w_pdfjs_require__(16);
var _transport_stream = __w_pdfjs_require__(15);
var _webgl = __w_pdfjs_require__(17);
var _webgl = __w_pdfjs_require__(16);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const DEFAULT_RANGE_CHUNK_SIZE = 65536;
const RENDERING_CANCELLED_TIMEOUT = 100;
let isWorkerDisabled = false;
let fallbackWorkerSrc;
let fakeWorkerFilesLoader = null;
@ -1189,7 +1170,7 @@ function getDocument(src) {
for (const key in source) {
if (key === 'url' && typeof window !== 'undefined') {
params[key] = new _util.URL(source[key], window.location).href;
params[key] = new URL(source[key], window.location).href;
continue;
} else if (key === 'range') {
rangeTransport = source[key];
@ -1321,7 +1302,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId,
apiVersion: '2.3.164',
apiVersion: '2.3.183',
source: {
data: source.data,
url: source.url,
@ -1636,12 +1617,8 @@ class PDFPageProxy {
}) {
const stats = this._stats;
stats.time('Overall');
this.pendingCleanup = false;
const renderingIntent = intent === 'print' ? 'print' : 'display';
const canvasFactoryInstance = canvasFactory || new _display_utils.DOMCanvasFactory();
const webGLContext = new _webgl.WebGLContext({
enable: enableWebGL
});
this.pendingCleanup = false;
if (!this.intentStates[renderingIntent]) {
this.intentStates[renderingIntent] = Object.create(null);
@ -1649,6 +1626,16 @@ class PDFPageProxy {
const intentState = this.intentStates[renderingIntent];
if (intentState.streamReaderCancelTimeout) {
clearTimeout(intentState.streamReaderCancelTimeout);
intentState.streamReaderCancelTimeout = null;
}
const canvasFactoryInstance = canvasFactory || new _display_utils.DOMCanvasFactory();
const webGLContext = new _webgl.WebGLContext({
enable: enableWebGL
});
if (!intentState.displayReadyCapability) {
intentState.displayReadyCapability = (0, _util.createPromiseCapability)();
intentState.operatorList = {
@ -1881,6 +1868,12 @@ class PDFPageProxy {
_startRenderPage(transparency, intent) {
const intentState = this.intentStates[intent];
if (!intentState) {
return;
}
this._stats.timeEnd('Page Request');
if (intentState.displayReadyCapability) {
intentState.displayReadyCapability.resolve(transparency);
}
@ -1970,16 +1963,41 @@ class PDFPageProxy {
return;
}
if (!force && intentState.renderTasks.length !== 0) {
return;
}
if (!force) {
if (intentState.renderTasks.length !== 0) {
return;
}
if (reason instanceof _display_utils.RenderingCancelledException) {
return;
if (reason instanceof _display_utils.RenderingCancelledException) {
intentState.streamReaderCancelTimeout = setTimeout(() => {
this._abortOperatorList({
intentState,
reason,
force: true
});
intentState.streamReaderCancelTimeout = null;
}, RENDERING_CANCELLED_TIMEOUT);
return;
}
}
intentState.streamReader.cancel(new _util.AbortException(reason && reason.message));
intentState.streamReader = null;
if (this._transport.destroyed) {
return;
}
Object.keys(this.intentStates).some(intent => {
if (this.intentStates[intent] === intentState) {
delete this.intentStates[intent];
return true;
}
return false;
});
this.cleanup();
}
get stats() {
@ -2137,7 +2155,7 @@ const PDFWorker = function PDFWorkerClosure() {
function createCDNWrapper(url) {
const wrapper = 'importScripts(\'' + url + '\');';
return _util.URL.createObjectURL(new Blob([wrapper]));
return URL.createObjectURL(new Blob([wrapper]));
}
class PDFWorker {
@ -2573,8 +2591,6 @@ class WorkerTransport {
const page = this.pageCache[data.pageIndex];
page._stats.timeEnd('Page Request');
page._startRenderPage(data.transparency, data.intent);
});
messageHandler.on('commonobj', data => {
@ -3183,13 +3199,13 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
return InternalRenderTask;
}();
const version = '2.3.164';
const version = '2.3.183';
exports.version = version;
const build = '12ff2527';
const build = 'c289f3a9';
exports.build = build;
/***/ }),
/* 7 */
/* 6 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@ -3577,7 +3593,7 @@ function isValidFetchUrl(url, baseUrl) {
try {
const {
protocol
} = baseUrl ? new _util.URL(url, baseUrl) : new _util.URL(url);
} = baseUrl ? new URL(url, baseUrl) : new URL(url);
return protocol === 'http:' || protocol === 'https:';
} catch (ex) {
return false;
@ -3606,8 +3622,8 @@ function releaseImageResources(img) {
(0, _util.assert)(img instanceof Image, 'Invalid `img` parameter.');
const url = img.src;
if (typeof url === 'string' && url.startsWith('blob:') && _util.URL.revokeObjectURL) {
_util.URL.revokeObjectURL(url);
if (typeof url === 'string' && url.startsWith('blob:') && URL.revokeObjectURL) {
URL.revokeObjectURL(url);
}
img.removeAttribute('src');
@ -3664,7 +3680,7 @@ class PDFDateString {
exports.PDFDateString = PDFDateString;
/***/ }),
/* 8 */
/* 7 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@ -3925,7 +3941,7 @@ class FontFaceObject {
exports.FontFaceObject = FontFaceObject;
/***/ }),
/* 9 */
/* 8 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@ -3936,7 +3952,7 @@ let compatibilityParams = Object.create(null);
exports.apiCompatibilityParams = Object.freeze(compatibilityParams);
/***/ }),
/* 10 */
/* 9 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@ -3949,7 +3965,7 @@ exports.CanvasGraphics = void 0;
var _util = __w_pdfjs_require__(1);
var _pattern_helper = __w_pdfjs_require__(11);
var _pattern_helper = __w_pdfjs_require__(10);
var MIN_FONT_SIZE = 16;
var MAX_FONT_SIZE = 100;
@ -5994,7 +6010,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() {
exports.CanvasGraphics = CanvasGraphics;
/***/ }),
/* 11 */
/* 10 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@ -6443,7 +6459,7 @@ var TilingPattern = function TilingPatternClosure() {
exports.TilingPattern = TilingPattern;
/***/ }),
/* 12 */
/* 11 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@ -6459,7 +6475,7 @@ GlobalWorkerOptions.workerPort = GlobalWorkerOptions.workerPort === undefined ?
GlobalWorkerOptions.workerSrc = GlobalWorkerOptions.workerSrc === undefined ? '' : GlobalWorkerOptions.workerSrc;
/***/ }),
/* 13 */
/* 12 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@ -6507,14 +6523,6 @@ function wrapReason(reason) {
}
}
function resolveOrReject(capability, data) {
if (data.success) {
capability.resolve();
} else {
capability.reject(wrapReason(data.reason));
}
}
function MessageHandler(sourceName, targetName, comObj) {
this.sourceName = sourceName;
this.targetName = targetName;
@ -6543,8 +6551,8 @@ function MessageHandler(sourceName, targetName, comObj) {
let callback = callbacksCapabilities[callbackId];
delete callbacksCapabilities[callbackId];
if ('error' in data) {
callback.reject(wrapReason(data.error));
if ('reason' in data) {
callback.reject(wrapReason(data.reason));
} else {
callback.resolve(data.data);
}
@ -6573,7 +6581,7 @@ function MessageHandler(sourceName, targetName, comObj) {
targetName,
isReply: true,
callbackId: data.callbackId,
error: wrapReason(reason)
reason: wrapReason(reason)
});
});
} else if (data.streamId) {
@ -6640,6 +6648,8 @@ MessageHandler.prototype = {
this.streamControllers[streamId] = {
controller,
startCall: startCapability,
pullCall: null,
cancelCall: null,
isClosed: false
};
this.postMessage({
@ -6779,28 +6789,38 @@ MessageHandler.prototype = {
_processStreamMessage(data) {
let sourceName = this.sourceName;
let targetName = data.sourceName;
let streamId = data.streamId;
const streamId = data.streamId;
const comObj = this.comObj;
let deleteStreamController = () => {
Promise.all([this.streamControllers[data.streamId].startCall, this.streamControllers[data.streamId].pullCall, this.streamControllers[data.streamId].cancelCall].map(function (capability) {
Promise.all([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) {
return capability && capability.promise.catch(function () {});
})).then(() => {
delete this.streamControllers[data.streamId];
delete this.streamControllers[streamId];
});
};
switch (data.stream) {
case StreamKind.START_COMPLETE:
resolveOrReject(this.streamControllers[data.streamId].startCall, data);
if (data.success) {
this.streamControllers[streamId].startCall.resolve();
} else {
this.streamControllers[streamId].startCall.reject(wrapReason(data.reason));
}
break;
case StreamKind.PULL_COMPLETE:
resolveOrReject(this.streamControllers[data.streamId].pullCall, data);
if (data.success) {
this.streamControllers[streamId].pullCall.resolve();
} else {
this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason));
}
break;
case StreamKind.PULL:
if (!this.streamSinks[data.streamId]) {
if (!this.streamSinks[streamId]) {
comObj.postMessage({
sourceName,
targetName,
@ -6811,11 +6831,11 @@ MessageHandler.prototype = {
break;
}
if (this.streamSinks[data.streamId].desiredSize <= 0 && data.desiredSize > 0) {
this.streamSinks[data.streamId].sinkCapability.resolve();
if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) {
this.streamSinks[streamId].sinkCapability.resolve();
}
this.streamSinks[data.streamId].desiredSize = data.desiredSize;
this.streamSinks[streamId].desiredSize = data.desiredSize;
const {
onPull
} = this.streamSinks[data.streamId];
@ -6841,39 +6861,45 @@ MessageHandler.prototype = {
break;
case StreamKind.ENQUEUE:
(0, _util.assert)(this.streamControllers[data.streamId], 'enqueue should have stream controller');
(0, _util.assert)(this.streamControllers[streamId], 'enqueue should have stream controller');
if (!this.streamControllers[data.streamId].isClosed) {
this.streamControllers[data.streamId].controller.enqueue(data.chunk);
}
break;
case StreamKind.CLOSE:
(0, _util.assert)(this.streamControllers[data.streamId], 'close should have stream controller');
if (this.streamControllers[data.streamId].isClosed) {
if (this.streamControllers[streamId].isClosed) {
break;
}
this.streamControllers[data.streamId].isClosed = true;
this.streamControllers[data.streamId].controller.close();
this.streamControllers[streamId].controller.enqueue(data.chunk);
break;
case StreamKind.CLOSE:
(0, _util.assert)(this.streamControllers[streamId], 'close should have stream controller');
if (this.streamControllers[streamId].isClosed) {
break;
}
this.streamControllers[streamId].isClosed = true;
this.streamControllers[streamId].controller.close();
deleteStreamController();
break;
case StreamKind.ERROR:
(0, _util.assert)(this.streamControllers[data.streamId], 'error should have stream controller');
this.streamControllers[data.streamId].controller.error(wrapReason(data.reason));
(0, _util.assert)(this.streamControllers[streamId], 'error should have stream controller');
this.streamControllers[streamId].controller.error(wrapReason(data.reason));
deleteStreamController();
break;
case StreamKind.CANCEL_COMPLETE:
resolveOrReject(this.streamControllers[data.streamId].cancelCall, data);
if (data.success) {
this.streamControllers[streamId].cancelCall.resolve();
} else {
this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason));
}
deleteStreamController();
break;
case StreamKind.CANCEL:
if (!this.streamSinks[data.streamId]) {
if (!this.streamSinks[streamId]) {
break;
}
@ -6899,9 +6925,9 @@ MessageHandler.prototype = {
reason: wrapReason(reason)
});
});
this.streamSinks[data.streamId].sinkCapability.reject(wrapReason(data.reason));
this.streamSinks[data.streamId].isCancelled = true;
delete this.streamSinks[data.streamId];
this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason));
this.streamSinks[streamId].isCancelled = true;
delete this.streamSinks[streamId];
break;
default:
@ -6924,7 +6950,7 @@ MessageHandler.prototype = {
};
/***/ }),
/* 14 */
/* 13 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@ -6937,7 +6963,7 @@ exports.Metadata = void 0;
var _util = __w_pdfjs_require__(1);
var _xml_parser = __w_pdfjs_require__(15);
var _xml_parser = __w_pdfjs_require__(14);
class Metadata {
constructor(data) {
@ -7046,7 +7072,7 @@ class Metadata {
exports.Metadata = Metadata;
/***/ }),
/* 15 */
/* 14 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@ -7492,7 +7518,7 @@ class SimpleXMLParser extends XMLParserBase {
exports.SimpleXMLParser = SimpleXMLParser;
/***/ }),
/* 16 */
/* 15 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@ -7847,7 +7873,7 @@ class PDFDataTransportStreamRangeReader {
}
/***/ }),
/* 17 */
/* 16 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@ -8294,7 +8320,7 @@ var WebGLUtils = function WebGLUtilsClosure() {
}();
/***/ }),
/* 18 */
/* 17 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@ -8986,7 +9012,7 @@ var renderTextLayer = function renderTextLayerClosure() {
exports.renderTextLayer = renderTextLayer;
/***/ }),
/* 19 */
/* 18 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@ -8997,7 +9023,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.AnnotationLayer = void 0;
var _display_utils = __w_pdfjs_require__(7);
var _display_utils = __w_pdfjs_require__(6);
var _util = __w_pdfjs_require__(1);
@ -9995,7 +10021,7 @@ class AnnotationLayer {
exports.AnnotationLayer = AnnotationLayer;
/***/ }),
/* 20 */
/* 19 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
@ -10008,9 +10034,9 @@ exports.SVGGraphics = void 0;
var _util = __w_pdfjs_require__(1);
var _display_utils = __w_pdfjs_require__(7);
var _display_utils = __w_pdfjs_require__(6);
var _is_node = _interopRequireDefault(__w_pdfjs_require__(21));
var _is_node = _interopRequireDefault(__w_pdfjs_require__(20));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@ -10022,7 +10048,7 @@ exports.SVGGraphics = SVGGraphics;
;
/***/ }),
/* 21 */
/* 20 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -11282,14 +11282,14 @@ class DownloadManager {
}
download(blob, url, filename) {
let blobUrl = _pdfjsLib.URL.createObjectURL(blob);
let blobUrl = URL.createObjectURL(blob);
let onResponse = err => {
if (err && this.onerror) {
this.onerror(err);
}
_pdfjsLib.URL.revokeObjectURL(blobUrl);
URL.revokeObjectURL(blobUrl);
};
FirefoxCom.request('download', {

Просмотреть файл

@ -20,7 +20,7 @@ origin:
# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
release: version 2.3.164
release: version 2.3.183
# The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/