Bug 1590105 - Update pdf.js to version 2.4.71. r=bdahl

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ryan VanderMeulen 2019-10-23 22:53:00 +00:00
Родитель f44ddd9679
Коммит 99384c9856
5 изменённых файлов: 69 добавлений и 49 удалений

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

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.4.43
Current extension version is: 2.4.71
Taken from upstream commit: 16ae7c69
Taken from upstream commit: d7f651aa

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

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
var pdfjsVersion = '2.4.43';
var pdfjsBuild = '16ae7c69';
var pdfjsVersion = '2.4.71';
var pdfjsBuild = 'd7f651aa';
var pdfjsSharedUtil = __w_pdfjs_require__(1);
@ -1271,7 +1271,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId,
apiVersion: '2.4.43',
apiVersion: '2.4.71',
source: {
data: source.data,
url: source.url,
@ -2514,6 +2514,33 @@ class WorkerTransport {
loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, this));
});
messageHandler.on('DocException', function (ex) {
let reason;
switch (ex.name) {
case 'PasswordException':
reason = new _util.PasswordException(ex.message, ex.code);
break;
case 'InvalidPDFException':
reason = new _util.InvalidPDFException(ex.message);
break;
case 'MissingPDFException':
reason = new _util.MissingPDFException(ex.message);
break;
case 'UnexpectedResponseException':
reason = new _util.UnexpectedResponseException(ex.message, ex.status);
break;
case 'UnknownErrorException':
reason = new _util.UnknownErrorException(ex.message, ex.details);
break;
}
loadingTask._capability.reject(reason);
});
messageHandler.on('PasswordRequest', exception => {
this._passwordCapability = (0, _util.createPromiseCapability)();
@ -2535,21 +2562,6 @@ class WorkerTransport {
return this._passwordCapability.promise;
});
messageHandler.on('PasswordException', function (exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
});
messageHandler.on('InvalidPDF', function (exception) {
loadingTask._capability.reject(new _util.InvalidPDFException(exception.message));
});
messageHandler.on('MissingPDF', function (exception) {
loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
});
messageHandler.on('UnexpectedResponse', function (exception) {
loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
});
messageHandler.on('UnknownError', function (exception) {
loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
});
messageHandler.on('DataLoaded', data => {
if (loadingTask.onProgress) {
loadingTask.onProgress({
@ -3174,9 +3186,9 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
return InternalRenderTask;
}();
const version = '2.4.43';
const version = '2.4.71';
exports.version = version;
const build = '16ae7c69';
const build = 'd7f651aa';
exports.build = build;
/***/ }),

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

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
const pdfjsVersion = '2.4.43';
const pdfjsBuild = '16ae7c69';
const pdfjsVersion = '2.4.71';
const pdfjsBuild = 'd7f651aa';
const pdfjsCoreWorker = __w_pdfjs_require__(1);
@ -225,7 +225,7 @@ var WorkerMessageHandler = {
var WorkerTasks = [];
const verbosity = (0, _util.getVerbosityLevel)();
const apiVersion = docParams.apiVersion;
const workerVersion = '2.4.43';
const workerVersion = '2.4.71';
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
@ -398,28 +398,24 @@ var WorkerMessageHandler = {
});
}
function onFailure(e) {
function onFailure(ex) {
ensureNotTerminated();
if (e instanceof _util.PasswordException) {
var task = new WorkerTask('PasswordException: response ' + e.code);
if (ex instanceof _util.PasswordException) {
var task = new WorkerTask(`PasswordException: response ${ex.code}`);
startWorkerTask(task);
handler.sendWithPromise('PasswordRequest', e).then(function (data) {
handler.sendWithPromise('PasswordRequest', ex).then(function (data) {
finishWorkerTask(task);
pdfManager.updatePassword(data.password);
pdfManagerReady();
}).catch(function (boundException) {
}).catch(function () {
finishWorkerTask(task);
handler.send('PasswordException', boundException);
}.bind(null, e));
} else if (e instanceof _util.InvalidPDFException) {
handler.send('InvalidPDF', e);
} else if (e instanceof _util.MissingPDFException) {
handler.send('MissingPDF', e);
} else if (e instanceof _util.UnexpectedResponseException) {
handler.send('UnexpectedResponse', e);
handler.send('DocException', ex);
});
} else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
handler.send('DocException', ex);
} else {
handler.send('UnknownError', new _util.UnknownErrorException(e.message, e.toString()));
handler.send('DocException', new _util.UnknownErrorException(ex.message, ex.toString()));
}
}
@ -4927,7 +4923,7 @@ var XRef = function XRefClosure() {
const num = m[1] | 0,
gen = m[2] | 0;
if (typeof this.entries[num] === 'undefined') {
if (!this.entries[num] || this.entries[num].gen === gen) {
this.entries[num] = {
offset: position - stream.start,
gen,
@ -25029,8 +25025,8 @@ var Font = function FontClosure() {
this.remeasure = Object.keys(this.widths).length > 0;
if (isStandardFont && type === 'CIDFontType2' && this.cidEncoding.startsWith('Identity-')) {
var GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
var map = [];
const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
const map = [];
for (charCode in GlyphMapForStandardFonts) {
map[+charCode] = GlyphMapForStandardFonts[charCode];
@ -25071,7 +25067,8 @@ var Font = function FontClosure() {
} else if (isStandardFont) {
this.toFontChar = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
} else {
var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
const map = [];
this.toUnicode.forEach((charCode, unicodeCharCode) => {
if (!this.composite) {
var glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
@ -25082,8 +25079,20 @@ var Font = function FontClosure() {
}
}
this.toFontChar[charCode] = unicodeCharCode;
map[+charCode] = unicodeCharCode;
});
if (this.composite && this.toUnicode instanceof IdentityToUnicodeMap) {
if (/Verdana/i.test(name)) {
const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
for (charCode in GlyphMapForStandardFonts) {
map[+charCode] = GlyphMapForStandardFonts[charCode];
}
}
}
this.toFontChar = map;
}
this.loadedName = fontName.split('-')[0];
@ -25620,9 +25629,8 @@ var Font = function FontClosure() {
}
var numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
var locaData = loca.data;
var locaDataSize = itemSize * (1 + numGlyphsOut);
locaData = new Uint8Array(locaDataSize);
var locaData = new Uint8Array(locaDataSize);
locaData.set(loca.data.subarray(0, locaDataSize));
loca.data = locaData;
var oldGlyfData = glyf.data;

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

@ -2195,7 +2195,7 @@ function webViewerKeyDown(evt) {
let curElement = document.activeElement || document.querySelector(':focus');
let curElementTagName = curElement && curElement.tagName.toUpperCase();
if (curElementTagName === 'INPUT' || curElementTagName === 'TEXTAREA' || curElementTagName === 'SELECT') {
if (curElementTagName === 'INPUT' || curElementTagName === 'TEXTAREA' || curElementTagName === 'SELECT' || curElement && curElement.isContentEditable) {
if (evt.keyCode !== 27) {
return;
}
@ -8683,7 +8683,7 @@ class BaseViewer {
this.findController.setDocument(pdfDocument);
}
if (pdfDocument.loadingParams['disableAutoFetch']) {
if (pdfDocument.loadingParams['disableAutoFetch'] || pagesCount > 7500) {
pagesCapability.resolve();
return;
}

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

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