Commit df44a5ec authored by Ryan VanderMeulen's avatar Ryan VanderMeulen
Browse files

Bug 1600994 - Update pdf.js to version 2.4.163. r=bdahl

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

--HG--
extra : moz-landing-system : lando
parent 99c554d8
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.4.152
Current extension version is: 2.4.163
Taken from upstream commit: 827eb64b
Taken from upstream commit: 514b500a
......@@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
var pdfjsVersion = '2.4.152';
var pdfjsBuild = '827eb64b';
var pdfjsVersion = '2.4.163';
var pdfjsBuild = '514b500a';
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.152',
apiVersion: '2.4.163',
source: {
data: source.data,
url: source.url,
......@@ -3214,9 +3214,9 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
return InternalRenderTask;
}();
const version = '2.4.152';
const version = '2.4.163';
exports.version = version;
const build = '827eb64b';
const build = '514b500a';
exports.build = build;
/***/ }),
......
......@@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
 
 
const pdfjsVersion = '2.4.152';
const pdfjsBuild = '827eb64b';
const pdfjsVersion = '2.4.163';
const pdfjsBuild = '514b500a';
 
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.152';
const workerVersion = '2.4.163';
 
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
......@@ -5157,9 +5157,9 @@ var XRef = function XRefClosure() {
 
const num = ref.num;
 
if (this._cacheMap.has(num)) {
const cacheEntry = this._cacheMap.get(num);
const cacheEntry = this._cacheMap.get(num);
 
if (cacheEntry !== undefined) {
if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
cacheEntry.objId = ref.toString();
}
......@@ -5208,14 +5208,6 @@ var XRef = function XRefClosure() {
var obj2 = parser.getObj();
var obj3 = parser.getObj();
 
if (!Number.isInteger(obj1)) {
obj1 = parseInt(obj1, 10);
}
if (!Number.isInteger(obj2)) {
obj2 = parseInt(obj2, 10);
}
if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
}
......@@ -5246,15 +5238,15 @@ var XRef = function XRefClosure() {
},
 
fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
var tableOffset = xrefEntry.offset;
var stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
const tableOffset = xrefEntry.offset;
const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
 
if (!(0, _primitives.isStream)(stream)) {
throw new _util.FormatError('bad ObjStm stream');
}
 
var first = stream.dict.get('First');
var n = stream.dict.get('N');
const first = stream.dict.get('First');
const n = stream.dict.get('N');
 
if (!Number.isInteger(first) || !Number.isInteger(n)) {
throw new _util.FormatError('invalid first and n parameters for ObjStm stream');
......@@ -5265,38 +5257,43 @@ var XRef = function XRefClosure() {
xref: this,
allowStreams: true
});
var i,
entries = [],
num,
nums = [];
const nums = new Array(n);
 
for (i = 0; i < n; ++i) {
num = parser.getObj();
for (let i = 0; i < n; ++i) {
const num = parser.getObj();
 
if (!Number.isInteger(num)) {
throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
}
 
nums.push(num);
var offset = parser.getObj();
const offset = parser.getObj();
 
if (!Number.isInteger(offset)) {
throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
}
nums[i] = num;
}
 
for (i = 0; i < n; ++i) {
entries.push(parser.getObj());
const entries = new Array(n);
for (let i = 0; i < n; ++i) {
const obj = parser.getObj();
entries[i] = obj;
 
if ((0, _primitives.isCmd)(parser.buf1, 'endobj')) {
if (parser.buf1 instanceof _primitives.Cmd && parser.buf1.cmd === 'endobj') {
parser.shift();
}
 
num = nums[i];
var entry = this.entries[num];
if ((0, _primitives.isStream)(obj)) {
continue;
}
const num = nums[i],
entry = this.entries[num];
 
if (entry && entry.offset === tableOffset && entry.gen === i) {
this._cacheMap.set(num, entries[i]);
this._cacheMap.set(num, obj);
}
}
 
......@@ -7709,9 +7709,9 @@ class PDFThumbnailViewer {
return;
}
pdfDocument.getPage(1).then(firstPage => {
pdfDocument.getPage(1).then(firstPdfPage => {
let pagesCount = pdfDocument.numPages;
let viewport = firstPage.getViewport({
const viewport = firstPdfPage.getViewport({
scale: 1
});
......@@ -7729,6 +7729,12 @@ class PDFThumbnailViewer {
this._thumbnails.push(thumbnail);
}
const firstThumbnailView = this._thumbnails[0];
if (firstThumbnailView) {
firstThumbnailView.setPdfPage(firstPdfPage);
}
const thumbnailView = this._thumbnails[this._currentPageNumber - 1];
thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);
}).catch(reason => {
......@@ -7775,7 +7781,9 @@ class PDFThumbnailViewer {
}
const promise = this.pdfDocument.getPage(thumbView.id).then(pdfPage => {
thumbView.setPdfPage(pdfPage);
if (!thumbView.pdfPage) {
thumbView.setPdfPage(pdfPage);
}
this._pagesRequests.delete(thumbView);
......@@ -8639,9 +8647,9 @@ class BaseViewer {
};
this.eventBus.on('pagerendered', this._onAfterDraw);
firstPagePromise.then(pdfPage => {
firstPagePromise.then(firstPdfPage => {
let scale = this.currentScale;
let viewport = pdfPage.getViewport({
const viewport = firstPdfPage.getViewport({
scale: scale * _ui_utils.CSS_UNITS
});
......@@ -8674,6 +8682,13 @@ class BaseViewer {
this._pages.push(pageView);
}
const firstPageView = this._pages[0];
if (firstPageView) {
firstPageView.setPdfPage(firstPdfPage);
this.linkService.cachePageRef(1, firstPdfPage.ref);
}
if (this._spreadMode !== _ui_utils.SpreadMode.NONE) {
this._updateSpreadMode();
}
......@@ -8688,9 +8703,14 @@ class BaseViewer {
return;
}
let getPagesLeft = pagesCount;
let getPagesLeft = pagesCount - 1;
if (getPagesLeft <= 0) {
pagesCapability.resolve();
return;
}
for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {
for (let pageNum = 2; pageNum <= pagesCount; ++pageNum) {
pdfDocument.getPage(pageNum).then(pdfPage => {
let pageView = this._pages[pageNum - 1];
......
......@@ -20,7 +20,7 @@ origin:
# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
release: version 2.4.152
release: version 2.4.163
# The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment