Bug 1586266 - Update pdf.js to version 2.4.15. r=bdahl

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ryan VanderMeulen 2019-10-09 15:56:36 +00:00
Родитель 4cbcb23e42
Коммит 66392f1fb3
5 изменённых файлов: 194 добавлений и 287 удалений

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

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.3.194
Current extension version is: 2.4.15
Taken from upstream commit: cd909c53
Taken from upstream commit: cead77ef

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

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
var pdfjsVersion = '2.3.194';
var pdfjsBuild = 'cd909c53';
var pdfjsVersion = '2.4.15';
var pdfjsBuild = 'cead77ef';
var pdfjsSharedUtil = __w_pdfjs_require__(1);
@ -226,7 +226,7 @@ Object.defineProperty(exports, "ReadableStream", {
return _streams_polyfill.ReadableStream;
}
});
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;
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 = exports.BaseException = void 0;
__w_pdfjs_require__(2);
@ -609,97 +609,66 @@ function shadow(obj, prop, value) {
return value;
}
const PasswordException = function PasswordExceptionClosure() {
function PasswordException(msg, code) {
this.name = 'PasswordException';
this.message = msg;
const BaseException = function BaseExceptionClosure() {
function BaseException(message) {
if (this.constructor === BaseException) {
unreachable('Cannot initialize BaseException.');
}
this.message = message;
this.name = this.constructor.name;
}
BaseException.prototype = new Error();
BaseException.constructor = BaseException;
return BaseException;
}();
exports.BaseException = BaseException;
class PasswordException extends BaseException {
constructor(msg, code) {
super(msg);
this.code = code;
}
PasswordException.prototype = new Error();
PasswordException.constructor = PasswordException;
return PasswordException;
}();
}
exports.PasswordException = PasswordException;
const UnknownErrorException = function UnknownErrorExceptionClosure() {
function UnknownErrorException(msg, details) {
this.name = 'UnknownErrorException';
this.message = msg;
class UnknownErrorException extends BaseException {
constructor(msg, details) {
super(msg);
this.details = details;
}
UnknownErrorException.prototype = new Error();
UnknownErrorException.constructor = UnknownErrorException;
return UnknownErrorException;
}();
}
exports.UnknownErrorException = UnknownErrorException;
const InvalidPDFException = function InvalidPDFExceptionClosure() {
function InvalidPDFException(msg) {
this.name = 'InvalidPDFException';
this.message = msg;
}
InvalidPDFException.prototype = new Error();
InvalidPDFException.constructor = InvalidPDFException;
return InvalidPDFException;
}();
class InvalidPDFException extends BaseException {}
exports.InvalidPDFException = InvalidPDFException;
const MissingPDFException = function MissingPDFExceptionClosure() {
function MissingPDFException(msg) {
this.name = 'MissingPDFException';
this.message = msg;
}
MissingPDFException.prototype = new Error();
MissingPDFException.constructor = MissingPDFException;
return MissingPDFException;
}();
class MissingPDFException extends BaseException {}
exports.MissingPDFException = MissingPDFException;
const UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
function UnexpectedResponseException(msg, status) {
this.name = 'UnexpectedResponseException';
this.message = msg;
class UnexpectedResponseException extends BaseException {
constructor(msg, status) {
super(msg);
this.status = status;
}
UnexpectedResponseException.prototype = new Error();
UnexpectedResponseException.constructor = UnexpectedResponseException;
return UnexpectedResponseException;
}();
}
exports.UnexpectedResponseException = UnexpectedResponseException;
const FormatError = function FormatErrorClosure() {
function FormatError(msg) {
this.message = msg;
}
FormatError.prototype = new Error();
FormatError.prototype.name = 'FormatError';
FormatError.constructor = FormatError;
return FormatError;
}();
class FormatError extends BaseException {}
exports.FormatError = FormatError;
const AbortException = function AbortExceptionClosure() {
function AbortException(msg) {
this.name = 'AbortException';
this.message = msg;
}
AbortException.prototype = new Error();
AbortException.constructor = AbortException;
return AbortException;
}();
class AbortException extends BaseException {}
exports.AbortException = AbortException;
const NullCharactersRegExp = /\x00/g;
@ -1302,7 +1271,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId,
apiVersion: '2.3.194',
apiVersion: '2.4.15',
source: {
data: source.data,
url: source.url,
@ -2053,7 +2022,15 @@ class LoopbackPort {
p = Object.getPrototypeOf(p);
}
if (typeof desc.value === 'undefined' || typeof desc.value === 'function') {
if (typeof desc.value === 'undefined') {
continue;
}
if (typeof desc.value === 'function') {
if (value.hasOwnProperty && value.hasOwnProperty(i)) {
throw new Error(`LoopbackPort.postMessage - cannot clone: ${value[i]}`);
}
continue;
}
@ -3199,9 +3176,9 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
return InternalRenderTask;
}();
const version = '2.3.194';
const version = '2.4.15';
exports.version = version;
const build = 'cd909c53';
const build = 'cead77ef';
exports.build = build;
/***/ }),
@ -3452,17 +3429,13 @@ class PageViewport {
exports.PageViewport = PageViewport;
const RenderingCancelledException = function RenderingCancelledException() {
function RenderingCancelledException(msg, type) {
this.message = msg;
class RenderingCancelledException extends _util.BaseException {
constructor(msg, type) {
super(msg);
this.type = type;
}
RenderingCancelledException.prototype = new Error();
RenderingCancelledException.prototype.name = 'RenderingCancelledException';
RenderingCancelledException.constructor = RenderingCancelledException;
return RenderingCancelledException;
}();
}
exports.RenderingCancelledException = RenderingCancelledException;
const LinkTarget = {
@ -6501,7 +6474,7 @@ const StreamKind = {
};
function wrapReason(reason) {
if (typeof reason !== 'object') {
if (typeof reason !== 'object' || reason === null) {
return reason;
}
@ -6792,14 +6765,6 @@ MessageHandler.prototype = {
const streamId = data.streamId;
const comObj = this.comObj;
let deleteStreamController = () => {
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[streamId];
});
};
switch (data.stream) {
case StreamKind.START_COMPLETE:
if (data.success) {
@ -6879,13 +6844,17 @@ MessageHandler.prototype = {
this.streamControllers[streamId].isClosed = true;
this.streamControllers[streamId].controller.close();
deleteStreamController();
this._deleteStreamController(streamId);
break;
case StreamKind.ERROR:
(0, _util.assert)(this.streamControllers[streamId], 'error should have stream controller');
this.streamControllers[streamId].controller.error(wrapReason(data.reason));
deleteStreamController();
this._deleteStreamController(streamId);
break;
case StreamKind.CANCEL_COMPLETE:
@ -6895,7 +6864,8 @@ MessageHandler.prototype = {
this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason));
}
deleteStreamController();
this._deleteStreamController(streamId);
break;
case StreamKind.CANCEL:
@ -6935,6 +6905,13 @@ MessageHandler.prototype = {
}
},
async _deleteStreamController(streamId) {
await Promise.all([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) {
return capability && capability.promise.catch(function () {});
}));
delete this.streamControllers[streamId];
},
postMessage(message, transfers) {
if (transfers && this.postMessageTransfers) {
this.comObj.postMessage(message, transfers);

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

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
const pdfjsVersion = '2.3.194';
const pdfjsBuild = 'cd909c53';
const pdfjsVersion = '2.4.15';
const pdfjsBuild = 'cead77ef';
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.3.194';
const workerVersion = '2.4.15';
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
@ -707,7 +707,7 @@ Object.defineProperty(exports, "ReadableStream", {
return _streams_polyfill.ReadableStream;
}
});
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;
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 = exports.BaseException = void 0;
__w_pdfjs_require__(3);
@ -1090,97 +1090,66 @@ function shadow(obj, prop, value) {
return value;
}
const PasswordException = function PasswordExceptionClosure() {
function PasswordException(msg, code) {
this.name = 'PasswordException';
this.message = msg;
const BaseException = function BaseExceptionClosure() {
function BaseException(message) {
if (this.constructor === BaseException) {
unreachable('Cannot initialize BaseException.');
}
this.message = message;
this.name = this.constructor.name;
}
BaseException.prototype = new Error();
BaseException.constructor = BaseException;
return BaseException;
}();
exports.BaseException = BaseException;
class PasswordException extends BaseException {
constructor(msg, code) {
super(msg);
this.code = code;
}
PasswordException.prototype = new Error();
PasswordException.constructor = PasswordException;
return PasswordException;
}();
}
exports.PasswordException = PasswordException;
const UnknownErrorException = function UnknownErrorExceptionClosure() {
function UnknownErrorException(msg, details) {
this.name = 'UnknownErrorException';
this.message = msg;
class UnknownErrorException extends BaseException {
constructor(msg, details) {
super(msg);
this.details = details;
}
UnknownErrorException.prototype = new Error();
UnknownErrorException.constructor = UnknownErrorException;
return UnknownErrorException;
}();
}
exports.UnknownErrorException = UnknownErrorException;
const InvalidPDFException = function InvalidPDFExceptionClosure() {
function InvalidPDFException(msg) {
this.name = 'InvalidPDFException';
this.message = msg;
}
InvalidPDFException.prototype = new Error();
InvalidPDFException.constructor = InvalidPDFException;
return InvalidPDFException;
}();
class InvalidPDFException extends BaseException {}
exports.InvalidPDFException = InvalidPDFException;
const MissingPDFException = function MissingPDFExceptionClosure() {
function MissingPDFException(msg) {
this.name = 'MissingPDFException';
this.message = msg;
}
MissingPDFException.prototype = new Error();
MissingPDFException.constructor = MissingPDFException;
return MissingPDFException;
}();
class MissingPDFException extends BaseException {}
exports.MissingPDFException = MissingPDFException;
const UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
function UnexpectedResponseException(msg, status) {
this.name = 'UnexpectedResponseException';
this.message = msg;
class UnexpectedResponseException extends BaseException {
constructor(msg, status) {
super(msg);
this.status = status;
}
UnexpectedResponseException.prototype = new Error();
UnexpectedResponseException.constructor = UnexpectedResponseException;
return UnexpectedResponseException;
}();
}
exports.UnexpectedResponseException = UnexpectedResponseException;
const FormatError = function FormatErrorClosure() {
function FormatError(msg) {
this.message = msg;
}
FormatError.prototype = new Error();
FormatError.prototype.name = 'FormatError';
FormatError.constructor = FormatError;
return FormatError;
}();
class FormatError extends BaseException {}
exports.FormatError = FormatError;
const AbortException = function AbortExceptionClosure() {
function AbortException(msg) {
this.name = 'AbortException';
this.message = msg;
}
AbortException.prototype = new Error();
AbortException.constructor = AbortException;
return AbortException;
}();
class AbortException extends BaseException {}
exports.AbortException = AbortException;
const NullCharactersRegExp = /\x00/g;
@ -2719,44 +2688,22 @@ function getLookupTableFactory(initializer) {
};
}
const MissingDataException = function MissingDataExceptionClosure() {
function MissingDataException(begin, end) {
class MissingDataException extends _util.BaseException {
constructor(begin, end) {
super(`Missing data [${begin}, ${end})`);
this.begin = begin;
this.end = end;
this.message = `Missing data [${begin}, ${end})`;
}
MissingDataException.prototype = new Error();
MissingDataException.prototype.name = 'MissingDataException';
MissingDataException.constructor = MissingDataException;
return MissingDataException;
}();
}
exports.MissingDataException = MissingDataException;
const XRefEntryException = function XRefEntryExceptionClosure() {
function XRefEntryException(msg) {
this.message = msg;
}
XRefEntryException.prototype = new Error();
XRefEntryException.prototype.name = 'XRefEntryException';
XRefEntryException.constructor = XRefEntryException;
return XRefEntryException;
}();
class XRefEntryException extends _util.BaseException {}
exports.XRefEntryException = XRefEntryException;
const XRefParseException = function XRefParseExceptionClosure() {
function XRefParseException(msg) {
this.message = msg;
}
XRefParseException.prototype = new Error();
XRefParseException.prototype.name = 'XRefParseException';
XRefParseException.constructor = XRefParseException;
return XRefParseException;
}();
class XRefParseException extends _util.BaseException {}
exports.XRefParseException = XRefParseException;
@ -9217,16 +9164,12 @@ var _arithmetic_decoder = __w_pdfjs_require__(18);
var _ccitt = __w_pdfjs_require__(15);
let Jbig2Error = function Jbig2ErrorClosure() {
function Jbig2Error(msg) {
this.message = 'JBIG2 error: ' + msg;
class Jbig2Error extends _util.BaseException {
constructor(msg) {
super(`JBIG2 error: ${msg}`);
}
Jbig2Error.prototype = new Error();
Jbig2Error.prototype.name = 'Jbig2Error';
Jbig2Error.constructor = Jbig2Error;
return Jbig2Error;
}();
}
var Jbig2Image = function Jbig2ImageClosure() {
function ContextCache() {}
@ -11891,39 +11834,22 @@ exports.JpegImage = void 0;
var _util = __w_pdfjs_require__(2);
let JpegError = function JpegErrorClosure() {
function JpegError(msg) {
this.message = 'JPEG error: ' + msg;
class JpegError extends _util.BaseException {
constructor(msg) {
super(`JPEG error: ${msg}`);
}
JpegError.prototype = new Error();
JpegError.prototype.name = 'JpegError';
JpegError.constructor = JpegError;
return JpegError;
}();
}
let DNLMarkerError = function DNLMarkerErrorClosure() {
function DNLMarkerError(message, scanLines) {
this.message = message;
class DNLMarkerError extends _util.BaseException {
constructor(message, scanLines) {
super(message);
this.scanLines = scanLines;
}
DNLMarkerError.prototype = new Error();
DNLMarkerError.prototype.name = 'DNLMarkerError';
DNLMarkerError.constructor = DNLMarkerError;
return DNLMarkerError;
}();
}
let EOIMarkerError = function EOIMarkerErrorClosure() {
function EOIMarkerError(message) {
this.message = message;
}
EOIMarkerError.prototype = new Error();
EOIMarkerError.prototype.name = 'EOIMarkerError';
EOIMarkerError.constructor = EOIMarkerError;
return EOIMarkerError;
}();
class EOIMarkerError extends _util.BaseException {}
var JpegImage = function JpegImageClosure() {
var dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]);
@ -13167,16 +13093,12 @@ var _util = __w_pdfjs_require__(2);
var _arithmetic_decoder = __w_pdfjs_require__(18);
let JpxError = function JpxErrorClosure() {
function JpxError(msg) {
this.message = 'JPX error: ' + msg;
class JpxError extends _util.BaseException {
constructor(msg) {
super(`JPX error: ${msg}`);
}
JpxError.prototype = new Error();
JpxError.prototype.name = 'JpxError';
JpxError.constructor = JpxError;
return JpxError;
}();
}
var JpxImage = function JpxImageClosure() {
var SubbandsGainLog2 = {
@ -21806,7 +21728,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
});
},
_buildSimpleFontToUnicode(properties) {
_buildSimpleFontToUnicode(properties, forceGlyphs = false) {
(0, _util.assert)(!properties.composite, 'Must be a simple font.');
let toUnicode = [],
charcode,
@ -21852,8 +21774,19 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
case 'C':
case 'c':
if (glyphName.length >= 3) {
code = +glyphName.substring(1);
if (glyphName.length >= 3 && glyphName.length <= 4) {
const codeStr = glyphName.substring(1);
if (forceGlyphs) {
code = parseInt(codeStr, 16);
break;
}
code = +codeStr;
if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
return this._buildSimpleFontToUnicode(properties, true);
}
}
break;
@ -44723,7 +44656,7 @@ const StreamKind = {
};
function wrapReason(reason) {
if (typeof reason !== 'object') {
if (typeof reason !== 'object' || reason === null) {
return reason;
}
@ -45014,14 +44947,6 @@ MessageHandler.prototype = {
const streamId = data.streamId;
const comObj = this.comObj;
let deleteStreamController = () => {
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[streamId];
});
};
switch (data.stream) {
case StreamKind.START_COMPLETE:
if (data.success) {
@ -45101,13 +45026,17 @@ MessageHandler.prototype = {
this.streamControllers[streamId].isClosed = true;
this.streamControllers[streamId].controller.close();
deleteStreamController();
this._deleteStreamController(streamId);
break;
case StreamKind.ERROR:
(0, _util.assert)(this.streamControllers[streamId], 'error should have stream controller');
this.streamControllers[streamId].controller.error(wrapReason(data.reason));
deleteStreamController();
this._deleteStreamController(streamId);
break;
case StreamKind.CANCEL_COMPLETE:
@ -45117,7 +45046,8 @@ MessageHandler.prototype = {
this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason));
}
deleteStreamController();
this._deleteStreamController(streamId);
break;
case StreamKind.CANCEL:
@ -45157,6 +45087,13 @@ MessageHandler.prototype = {
}
},
async _deleteStreamController(streamId) {
await Promise.all([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) {
return capability && capability.promise.catch(function () {});
}));
delete this.streamControllers[streamId];
},
postMessage(message, transfers) {
if (transfers && this.postMessageTransfers) {
this.comObj.postMessage(message, transfers);

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

@ -2425,6 +2425,7 @@ exports.isValidScrollMode = isValidScrollMode;
exports.isValidSpreadMode = isValidSpreadMode;
exports.isPortraitOrientation = isPortraitOrientation;
exports.getGlobalEventBus = getGlobalEventBus;
exports.clamp = clamp;
exports.getPDFFileNameFromURL = getPDFFileNameFromURL;
exports.noContextMenuHandler = noContextMenuHandler;
exports.parseQueryString = parseQueryString;
@ -7460,12 +7461,6 @@ class PDFSidebarResizer {
this.resizer = options.resizer;
this.eventBus = eventBus;
this.l10n = l10n;
if (typeof CSS === 'undefined' || typeof CSS.supports !== 'function' || !CSS.supports(SIDEBAR_WIDTH_VAR, `calc(-1 * ${SIDEBAR_MIN_WIDTH}px)`)) {
console.warn('PDFSidebarResizer: ' + 'The browser does not support resizing of the sidebar.');
return;
}
this.enabled = true;
this.resizer.classList.remove('hidden');
this.l10n.getDirection().then(dir => {
@ -7488,22 +7483,14 @@ class PDFSidebarResizer {
return false;
}
const maxWidth = Math.floor(this.outerContainerWidth / 2);
const newWidth = (0, _ui_utils.clamp)(width, SIDEBAR_MIN_WIDTH, Math.floor(this.outerContainerWidth / 2));
if (width > maxWidth) {
width = maxWidth;
}
if (width < SIDEBAR_MIN_WIDTH) {
width = SIDEBAR_MIN_WIDTH;
}
if (width === this._width) {
if (newWidth === this._width) {
return false;
}
this._width = width;
this.doc.style.setProperty(SIDEBAR_WIDTH_VAR, `${width}px`);
this._width = newWidth;
this.doc.style.setProperty(SIDEBAR_WIDTH_VAR, `${newWidth}px`);
return true;
}
@ -7548,29 +7535,35 @@ class PDFSidebarResizer {
this.sidebarOpen = !!(evt && evt.view);
});
this.eventBus.on('resize', evt => {
if (evt && evt.source === window) {
this._outerContainerWidth = null;
if (this._width) {
if (this.sidebarOpen) {
this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);
let updated = this._updateWidth(this._width);
Promise.resolve().then(() => {
this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);
if (updated) {
this.eventBus.dispatch('resize', {
source: this
});
}
});
} else {
this._updateWidth(this._width);
}
}
if (!evt || evt.source !== window) {
return;
}
this._outerContainerWidth = null;
if (!this._width) {
return;
}
if (!this.sidebarOpen) {
this._updateWidth(this._width);
return;
}
this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);
let updated = this._updateWidth(this._width);
Promise.resolve().then(() => {
this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);
if (updated) {
this.eventBus.dispatch('resize', {
source: this
});
}
});
});
}

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

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