Bug 1598435 - Update pdf.js to version 2.4.152. r=bdahl

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ryan VanderMeulen 2019-11-26 19:45:52 +00:00
Родитель b72a62729c
Коммит ecce4a80cd
5 изменённых файлов: 126 добавлений и 122 удалений

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

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.4.127
Current extension version is: 2.4.152
Taken from upstream commit: 21895aa7
Taken from upstream commit: 827eb64b

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

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
var pdfjsVersion = '2.4.127';
var pdfjsBuild = '21895aa7';
var pdfjsVersion = '2.4.152';
var pdfjsBuild = '827eb64b';
var pdfjsSharedUtil = __w_pdfjs_require__(1);
@ -1280,7 +1280,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId,
apiVersion: '2.4.127',
apiVersion: '2.4.152',
source: {
data: source.data,
url: source.url,
@ -3214,9 +3214,9 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
return InternalRenderTask;
}();
const version = '2.4.127';
const version = '2.4.152';
exports.version = version;
const build = '21895aa7';
const build = '827eb64b';
exports.build = build;
/***/ }),

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

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
const pdfjsVersion = '2.4.127';
const pdfjsBuild = '21895aa7';
const pdfjsVersion = '2.4.152';
const pdfjsBuild = '827eb64b';
const pdfjsCoreWorker = __w_pdfjs_require__(1);
@ -223,7 +223,7 @@ var WorkerMessageHandler = {
var WorkerTasks = [];
const verbosity = (0, _util.getVerbosityLevel)();
const apiVersion = docParams.apiVersion;
const workerVersion = '2.4.127';
const workerVersion = '2.4.152';
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
@ -3239,7 +3239,7 @@ class PDFDocument {
stream.reset();
if (find(stream, 'endobj', 1024)) {
startXRef = stream.pos + 6;
startXRef = stream.pos + 6 - stream.start;
}
} else {
const step = 1024;
@ -7528,9 +7528,9 @@ var FlateStream = function FlateStreamClosure() {
this.codeBuf = 0;
this.codeSize = 0;
var bufferLength = this.bufferLength;
buffer = this.ensureBuffer(bufferLength + blockLen);
var end = bufferLength + blockLen;
const bufferLength = this.bufferLength,
end = bufferLength + blockLen;
buffer = this.ensureBuffer(end);
this.bufferLength = end;
if (blockLen === 0) {
@ -7538,13 +7538,11 @@ var FlateStream = function FlateStreamClosure() {
this.eof = true;
}
} else {
for (var n = bufferLength; n < end; ++n) {
if ((b = str.getByte()) === -1) {
this.eof = true;
break;
}
const block = str.getBytes(blockLen);
buffer.set(block, bufferLength);
buffer[n] = b;
if (block.length < blockLen) {
this.eof = true;
}
}

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

@ -6092,19 +6092,10 @@ class PDFHistory {
}
if (shouldReplace) {
if (newUrl) {
window.history.replaceState(newState, '', newUrl);
} else {
window.history.replaceState(newState, '');
}
window.history.replaceState(newState, '', newUrl);
} else {
this._maxUid = this._uid;
if (newUrl) {
window.history.pushState(newState, '', newUrl);
} else {
window.history.pushState(newState, '');
}
window.history.pushState(newState, '', newUrl);
}
}
@ -7701,7 +7692,7 @@ class PDFThumbnailViewer {
this._currentPageNumber = 1;
this._pageLabels = null;
this._pagesRotation = 0;
this._pagesRequests = [];
this._pagesRequests = new WeakMap();
this.container.textContent = '';
}
@ -7779,21 +7770,24 @@ class PDFThumbnailViewer {
return Promise.resolve(thumbView.pdfPage);
}
let pageNumber = thumbView.id;
if (this._pagesRequests[pageNumber]) {
return this._pagesRequests[pageNumber];
if (this._pagesRequests.has(thumbView)) {
return this._pagesRequests.get(thumbView);
}
let promise = this.pdfDocument.getPage(pageNumber).then(pdfPage => {
const promise = this.pdfDocument.getPage(thumbView.id).then(pdfPage => {
thumbView.setPdfPage(pdfPage);
this._pagesRequests[pageNumber] = null;
this._pagesRequests.delete(thumbView);
return pdfPage;
}).catch(reason => {
console.error('Unable to get page for thumb view', reason);
this._pagesRequests[pageNumber] = null;
this._pagesRequests.delete(thumbView);
});
this._pagesRequests[pageNumber] = promise;
this._pagesRequests.set(thumbView, promise);
return promise;
}
@ -8440,7 +8434,13 @@ class BaseViewer {
}
get pageViewsReady() {
return this._pageViewsReady;
if (!this._pageViewsReady) {
return false;
}
return this._pages.every(function (pageView) {
return !!(pageView && pageView.pdfPage);
});
}
get currentPageNumber() {
@ -8754,7 +8754,7 @@ class BaseViewer {
this._buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);
this._location = null;
this._pagesRotation = 0;
this._pagesRequests = [];
this._pagesRequests = new WeakMap();
this._pageViewsReady = false;
this._scrollMode = _ui_utils.ScrollMode.VERTICAL;
this._spreadMode = _ui_utils.SpreadMode.NONE;
@ -9167,24 +9167,26 @@ class BaseViewer {
return Promise.resolve(pageView.pdfPage);
}
let pageNumber = pageView.id;
if (this._pagesRequests[pageNumber]) {
return this._pagesRequests[pageNumber];
if (this._pagesRequests.has(pageView)) {
return this._pagesRequests.get(pageView);
}
let promise = this.pdfDocument.getPage(pageNumber).then(pdfPage => {
const promise = this.pdfDocument.getPage(pageView.id).then(pdfPage => {
if (!pageView.pdfPage) {
pageView.setPdfPage(pdfPage);
}
this._pagesRequests[pageNumber] = null;
this._pagesRequests.delete(pageView);
return pdfPage;
}).catch(reason => {
console.error('Unable to get page for page view', reason);
this._pagesRequests[pageNumber] = null;
this._pagesRequests.delete(pageView);
});
this._pagesRequests[pageNumber] = promise;
this._pagesRequests.set(pageView, promise);
return promise;
}
@ -10596,13 +10598,12 @@ class SecondaryToolbar {
_bindClickListeners() {
this.toggleButton.addEventListener('click', this.toggle.bind(this));
for (let button in this.buttons) {
let {
element,
eventName,
close,
eventDetails
} = this.buttons[button];
for (const {
element,
eventName,
close,
eventDetails
} of this.buttons) {
element.addEventListener('click', evt => {
if (eventName !== null) {
let details = {
@ -10868,7 +10869,45 @@ class Toolbar {
this.toolbar = options.container;
this.eventBus = eventBus;
this.l10n = l10n;
this.items = options;
this.buttons = [{
element: options.previous,
eventName: 'previouspage'
}, {
element: options.next,
eventName: 'nextpage'
}, {
element: options.zoomIn,
eventName: 'zoomin'
}, {
element: options.zoomOut,
eventName: 'zoomout'
}, {
element: options.openFile,
eventName: 'openfile'
}, {
element: options.print,
eventName: 'print'
}, {
element: options.presentationModeButton,
eventName: 'presentationmode'
}, {
element: options.download,
eventName: 'download'
}, {
element: options.viewBookmark,
eventName: null
}];
this.items = {
numPages: options.numPages,
pageNumber: options.pageNumber,
scaleSelectContainer: options.scaleSelectContainer,
scaleSelect: options.scaleSelect,
customScaleOption: options.customScaleOption,
previous: options.previous,
next: options.next,
zoomIn: options.zoomIn,
zoomOut: options.zoomOut
};
this._wasLocalized = false;
this.reset();
@ -10910,82 +10949,52 @@ class Toolbar {
}
_bindListeners() {
let {
eventBus,
items
} = this;
let self = this;
items.previous.addEventListener('click', function () {
eventBus.dispatch('previouspage', {
source: self
const {
pageNumber,
scaleSelect
} = this.items;
const self = this;
for (const {
element,
eventName
} of this.buttons) {
element.addEventListener('click', evt => {
if (eventName !== null) {
this.eventBus.dispatch(eventName, {
source: this
});
}
});
});
items.next.addEventListener('click', function () {
eventBus.dispatch('nextpage', {
source: self
});
});
items.zoomIn.addEventListener('click', function () {
eventBus.dispatch('zoomin', {
source: self
});
});
items.zoomOut.addEventListener('click', function () {
eventBus.dispatch('zoomout', {
source: self
});
});
items.pageNumber.addEventListener('click', function () {
}
pageNumber.addEventListener('click', function () {
this.select();
});
items.pageNumber.addEventListener('change', function () {
eventBus.dispatch('pagenumberchanged', {
pageNumber.addEventListener('change', function () {
self.eventBus.dispatch('pagenumberchanged', {
source: self,
value: this.value
});
});
items.scaleSelect.addEventListener('change', function () {
scaleSelect.addEventListener('change', function () {
if (this.value === 'custom') {
return;
}
eventBus.dispatch('scalechanged', {
self.eventBus.dispatch('scalechanged', {
source: self,
value: this.value
});
});
items.presentationModeButton.addEventListener('click', function () {
eventBus.dispatch('presentationmode', {
source: self
});
});
items.openFile.addEventListener('click', function () {
eventBus.dispatch('openfile', {
source: self
});
});
items.print.addEventListener('click', function () {
eventBus.dispatch('print', {
source: self
});
});
items.download.addEventListener('click', function () {
eventBus.dispatch('download', {
source: self
});
});
items.scaleSelect.oncontextmenu = _ui_utils.noContextMenuHandler;
eventBus.on('localized', () => {
this._localized();
});
}
scaleSelect.oncontextmenu = _ui_utils.noContextMenuHandler;
this.eventBus.on('localized', () => {
this._wasLocalized = true;
_localized() {
this._wasLocalized = true;
this._adjustScaleWidth();
this._adjustScaleWidth();
this._updateUIState(true);
this._updateUIState(true);
});
}
_updateUIState(resetNumPages = false) {
@ -11036,12 +11045,9 @@ class Toolbar {
this.l10n.get('page_scale_percent', {
scale: customScale
}, '{{scale}}%').then(msg => {
let options = items.scaleSelect.options;
let predefinedValueFound = false;
for (let i = 0, ii = options.length; i < ii; i++) {
let option = options[i];
for (const option of items.scaleSelect.options) {
if (option.value !== pageScaleValue) {
option.selected = false;
continue;

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

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