Bug 1699313 - Update pdf.js to version 2.8.243 r=calixte

Differential Revision: https://phabricator.services.mozilla.com/D108882
This commit is contained in:
Brendan Dahl 2021-03-18 15:34:06 +00:00
Родитель 0471523b58
Коммит c339eff4b2
7 изменённых файлов: 752 добавлений и 711 удалений

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

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.8.188
Current extension version is: 2.8.243
Taken from upstream commit: 5e3af62d5
Taken from upstream commit: a16494135

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

@ -569,7 +569,7 @@ exports.isBool = isBool;
exports.isNum = isNum;
exports.isSameOrigin = isSameOrigin;
exports.isString = isString;
exports.objectFromEntries = objectFromEntries;
exports.objectFromMap = objectFromMap;
exports.objectSize = objectSize;
exports.removeNullCharacters = removeNullCharacters;
exports.setVerbosityLevel = setVerbosityLevel;
@ -1157,8 +1157,14 @@ function objectSize(obj) {
return Object.keys(obj).length;
}
function objectFromEntries(iterable) {
return Object.assign(Object.create(null), Object.fromEntries(iterable));
function objectFromMap(map) {
const obj = Object.create(null);
for (const [key, value] of map) {
obj[key] = value;
}
return obj;
}
function isLittleEndian() {
@ -1553,17 +1559,19 @@ function getDocument(src) {
} else if (key === "worker") {
worker = source[key];
continue;
} else if (key === "data" && !(source[key] instanceof Uint8Array)) {
} else if (key === "data") {
const pdfBytes = source[key];
if (typeof pdfBytes === "string") {
if (pdfBytes instanceof Uint8Array) {
params[key] = pdfBytes;
} else if (typeof pdfBytes === "string") {
params[key] = (0, _util.stringToBytes)(pdfBytes);
} else if (typeof pdfBytes === "object" && pdfBytes !== null && !isNaN(pdfBytes.length)) {
params[key] = new Uint8Array(pdfBytes);
} else if ((0, _util.isArrayBuffer)(pdfBytes)) {
params[key] = new Uint8Array(pdfBytes);
} else {
throw new Error("Invalid PDF binary data: either typed array, " + "string or array-like object is expected in the " + "data property.");
throw new Error("Invalid PDF binary data: either typed array, " + "string, or array-like object is expected in the data property.");
}
continue;
@ -1680,7 +1688,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
return worker.messageHandler.sendWithPromise("GetDocRequest", {
docId,
apiVersion: '2.8.188',
apiVersion: '2.8.243',
source: {
data: source.data,
url: source.url,
@ -3686,9 +3694,9 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
return InternalRenderTask;
}();
const version = '2.8.188';
const version = '2.8.243';
exports.version = version;
const build = '5e3af62d5';
const build = 'a16494135';
exports.build = build;
/***/ }),
@ -3998,11 +4006,9 @@ class AnnotationStorage {
}
getValue(key, defaultValue) {
if (this._storage.has(key)) {
return this._storage.get(key);
}
const obj = this._storage.get(key);
return defaultValue;
return obj !== undefined ? obj : defaultValue;
}
getOrCreateValue(key, defaultValue) {
@ -4041,7 +4047,7 @@ class AnnotationStorage {
}
getAll() {
return this._storage.size > 0 ? (0, _util.objectFromEntries)(this._storage) : null;
return this._storage.size > 0 ? (0, _util.objectFromMap)(this._storage) : null;
}
get size() {
@ -7365,7 +7371,7 @@ class Metadata {
}
getAll() {
return (0, _util.objectFromEntries)(this._metadataMap);
return (0, _util.objectFromMap)(this._metadataMap);
}
has(name) {
@ -7529,11 +7535,7 @@ class OptionalContentConfig {
}
getGroups() {
if (!this._groups.size) {
return null;
}
return (0, _util.objectFromEntries)(this._groups);
return this._groups.size > 0 ? (0, _util.objectFromMap)(this._groups) : null;
}
getGroup(id) {
@ -11242,8 +11244,8 @@ var _text_layer = __w_pdfjs_require__(20);
var _svg = __w_pdfjs_require__(21);
const pdfjsVersion = '2.8.188';
const pdfjsBuild = '5e3af62d5';
const pdfjsVersion = '2.8.243';
const pdfjsBuild = 'a16494135';
;
})();

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

@ -151,6 +151,10 @@ function initSandbox(params) {
globalThis.style = _constants.Style;
globalThis.trans = _constants.Trans;
globalThis.zoomtype = _constants.ZoomType;
globalThis.ADBE = {
Reader_Value_Asked: true,
Viewer_Value_Asked: true
};
const aform = new _aform.AForm(doc, app, util, color);
for (const name of Object.getOwnPropertyNames(_aform.AForm.prototype)) {
@ -4656,8 +4660,8 @@ Object.defineProperty(exports, "initSandbox", ({
var _initialization = __w_pdfjs_require__(1);
const pdfjsVersion = '2.8.188';
const pdfjsBuild = '5e3af62d5';
const pdfjsVersion = '2.8.243';
const pdfjsBuild = 'a16494135';
})();
/******/ return __webpack_exports__;

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

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

@ -2074,14 +2074,20 @@ html[dir="rtl"] #documentPropertiesOverlay .row > * {
}
/* wrapper around (scaled) print canvas elements */
#printContainer > div {
position: relative;
top: 0;
left: 0;
width: 1px;
height: 1px;
overflow: visible;
/* Without the following max-height declaration, Chromium might create extra
* blank pages, even though it shouldn't! */
max-height: 100%;
page-break-after: always;
page-break-inside: avoid;
/* If we're smaller than the page, center the canvas horizontally and
* vertically */
min-height: 100%;
min-width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#printContainer canvas,
#printContainer img {

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

@ -7953,6 +7953,7 @@ class PDFScriptingManager {
}) {
this._pdfDocument = null;
this._pdfViewer = null;
this._closeCapability = null;
this._destroyCapability = null;
this._scripting = null;
this._mouseState = Object.create(null);
@ -8031,8 +8032,9 @@ class PDFScriptingManager {
this._dispatchPageOpen(pageNumber);
});
this._internalEvents.set("pagesdestroy", event => {
this._dispatchPageClose(this._pdfViewer.currentPageNumber);
this._internalEvents.set("pagesdestroy", async event => {
await this._dispatchPageClose(this._pdfViewer.currentPageNumber);
this._closeCapability?.resolve();
});
this._domEvents.set("mousedown", event => {
@ -8147,7 +8149,7 @@ class PDFScriptingManager {
return (0, _pdfjsLib.shadow)(this, "_visitedPages", new Map());
}
_updateFromSandbox(detail) {
async _updateFromSandbox(detail) {
const {
id,
command,
@ -8173,10 +8175,10 @@ class PDFScriptingManager {
break;
case "print":
this._pdfViewer.pagesPromise.then(() => {
this._eventBus.dispatch("print", {
source: this
});
await this._pdfViewer.pagesPromise;
this._eventBus.dispatch("print", {
source: this
});
break;
@ -8211,6 +8213,7 @@ class PDFScriptingManager {
visitedPages = this._visitedPages;
if (initialize) {
this._closeCapability = (0, _pdfjsLib.createPromiseCapability)();
this._pageEventsReady = true;
}
@ -8303,13 +8306,21 @@ class PDFScriptingManager {
}
async _destroyScripting() {
this._pdfDocument = null;
if (!this._scripting) {
this._pdfDocument = null;
this._destroyCapability?.resolve();
return;
}
if (this._closeCapability) {
await Promise.race([this._closeCapability.promise, new Promise(resolve => {
setTimeout(resolve, 1000);
})]).catch(reason => {});
this._closeCapability = null;
}
this._pdfDocument = null;
try {
await this._scripting.destroySandbox();
} catch (ex) {}
@ -9711,7 +9722,7 @@ class BaseViewer {
throw new Error("Cannot initialize BaseViewer.");
}
const viewerVersion = '2.8.188';
const viewerVersion = '2.8.243';
if (_pdfjsLib.version !== viewerVersion) {
throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`);
@ -9958,9 +9969,7 @@ class BaseViewer {
}
if (this._scriptingManager) {
Promise.resolve().then(() => {
this._scriptingManager.setDocument(null);
});
this._scriptingManager.setDocument(null);
}
}
@ -13728,6 +13737,8 @@ function composePage(pdfDocument, pageNumber, size, printContainer, printResolut
canvas.style.height = Math.floor(size.height * _ui_utils.CSS_UNITS) + "px";
const canvasWrapper = document.createElement("div");
canvasWrapper.appendChild(canvas);
canvasWrapper.style.width = canvas.style.width;
canvasWrapper.style.height = canvas.style.height;
printContainer.appendChild(canvasWrapper);
let currentRenderTask = null;
@ -13880,8 +13891,8 @@ var _app_options = __webpack_require__(1);
var _app = __webpack_require__(3);
const pdfjsVersion = '2.8.188';
const pdfjsBuild = '5e3af62d5';
const pdfjsVersion = '2.8.243';
const pdfjsBuild = 'a16494135';
window.PDFViewerApplication = _app.PDFViewerApplication;
window.PDFViewerApplicationOptions = _app_options.AppOptions;
;

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

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