Bug 1542737 - Update pdf.js to version 2.2.129. r=bdahl

This commit is contained in:
Ryan VanderMeulen 2019-04-08 08:51:19 -04:00
Родитель ec150294ab
Коммит f880e3efca
5 изменённых файлов: 88 добавлений и 20 удалений

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

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.2.117
Current extension version is: 2.2.129
Taken from upstream commit: 57abddc9
Taken from upstream commit: 725a6959

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

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
var pdfjsVersion = '2.2.117';
var pdfjsBuild = '57abddc9';
var pdfjsVersion = '2.2.129';
var pdfjsBuild = '725a6959';
var pdfjsSharedUtil = __w_pdfjs_require__(1);
@ -1303,7 +1303,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId,
apiVersion: '2.2.117',
apiVersion: '2.2.129',
source: {
data: source.data,
url: source.url,
@ -1406,10 +1406,10 @@ class PDFDataRangeTransport {
}
}
onDataProgress(loaded) {
onDataProgress(loaded, total) {
this._readyCapability.promise.then(() => {
for (const listener of this._progressListeners) {
listener(loaded);
listener(loaded, total);
}
});
}
@ -1478,6 +1478,10 @@ class PDFDocumentProxy {
return this._transport.getPageLabels();
}
getPageLayout() {
return this._transport.getPageLayout();
}
getPageMode() {
return this._transport.getPageMode();
}
@ -2761,6 +2765,10 @@ class WorkerTransport {
return this.messageHandler.sendWithPromise('GetPageLabels', null);
}
getPageLayout() {
return this.messageHandler.sendWithPromise('GetPageLayout', null);
}
getPageMode() {
return this.messageHandler.sendWithPromise('GetPageMode', null);
}
@ -3075,9 +3083,9 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
return InternalRenderTask;
}();
const version = '2.2.117';
const version = '2.2.129';
exports.version = version;
const build = '57abddc9';
const build = '725a6959';
exports.build = build;
/***/ }),
@ -4591,8 +4599,11 @@ var CanvasGraphics = function CanvasGraphicsClosure() {
ctx.lineDashOffset = dashPhase;
}
},
setRenderingIntent: function CanvasGraphics_setRenderingIntent(intent) {},
setFlatness: function CanvasGraphics_setFlatness(flatness) {},
setRenderingIntent(intent) {},
setFlatness(flatness) {},
setGState: function CanvasGraphics_setGState(states) {
for (var i = 0, ii = states.length; i < ii; i++) {
var state = states[i];
@ -7337,9 +7348,10 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
});
});
this._pdfDataRangeTransport.addProgressListener(loaded => {
this._pdfDataRangeTransport.addProgressListener((loaded, total) => {
this._onProgress({
loaded
loaded,
total
});
});
@ -7381,15 +7393,25 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
}
},
_onProgress: function PDFDataTransportStream_onDataProgress(evt) {
if (this._rangeReaders.length > 0) {
if (evt.total === undefined && this._rangeReaders.length > 0) {
var firstReader = this._rangeReaders[0];
if (firstReader.onProgress) {
firstReader.onProgress({
loaded: evt.loaded
});
return;
}
}
let fullReader = this._fullRequestReader;
if (fullReader && fullReader.onProgress) {
fullReader.onProgress({
loaded: evt.loaded,
total: evt.total
});
}
},
_onProgressiveDone() {
@ -9730,7 +9752,7 @@ var _is_node = _interopRequireDefault(__w_pdfjs_require__(21));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var SVGGraphics = function () {
let SVGGraphics = function () {
throw new Error('Not implemented: SVGGraphics');
};

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

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
const pdfjsVersion = '2.2.117';
const pdfjsBuild = '57abddc9';
const pdfjsVersion = '2.2.129';
const pdfjsBuild = '725a6959';
const pdfjsCoreWorker = __w_pdfjs_require__(1);
@ -378,7 +378,7 @@ var WorkerMessageHandler = {
var WorkerTasks = [];
const verbosity = (0, _util.getVerbosityLevel)();
let apiVersion = docParams.apiVersion;
let workerVersion = '2.2.117';
let workerVersion = '2.2.129';
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
@ -644,6 +644,9 @@ var WorkerMessageHandler = {
handler.on('GetPageLabels', function wphSetupGetPageLabels(data) {
return pdfManager.ensureCatalog('pageLabels');
});
handler.on('GetPageLayout', function wphSetupGetPageLayout(data) {
return pdfManager.ensureCatalog('pageLayout');
});
handler.on('GetPageMode', function wphSetupGetPageMode(data) {
return pdfManager.ensureCatalog('pageMode');
});
@ -3747,6 +3750,25 @@ class Catalog {
return pageLabels;
}
get pageLayout() {
const obj = this.catDict.get('PageLayout');
let pageLayout = '';
if ((0, _primitives.isName)(obj)) {
switch (obj.name) {
case 'SinglePage':
case 'OneColumn':
case 'TwoColumnLeft':
case 'TwoColumnRight':
case 'TwoPageLeft':
case 'TwoPageRight':
pageLayout = obj.name;
}
}
return (0, _util.shadow)(this, 'pageLayout', pageLayout);
}
get pageMode() {
const obj = this.catDict.get('PageMode');
let pageMode = 'UseNone';

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

@ -1017,6 +1017,7 @@ let PDFViewerApplication = {
});
});
});
const pageLayoutPromise = pdfDocument.getPageLayout().catch(function () {});
const pageModePromise = pdfDocument.getPageMode().catch(function () {});
const openActionDestPromise = pdfDocument.getOpenActionDestination().catch(function () {});
this.toolbar.setPagesCount(pdfDocument.numPages, false);
@ -1045,7 +1046,7 @@ let PDFViewerApplication = {
scrollMode: _ui_utils.ScrollMode.UNKNOWN,
spreadMode: _ui_utils.SpreadMode.UNKNOWN
}).catch(() => {});
Promise.all([storePromise, pageModePromise, openActionDestPromise]).then(async ([values = {}, pageMode, openActionDest]) => {
Promise.all([storePromise, pageLayoutPromise, pageModePromise, openActionDestPromise]).then(async ([values = {}, pageLayout, pageMode, openActionDest]) => {
const viewOnLoad = _app_options.AppOptions.get('viewOnLoad');
this._initializePdfHistory({
@ -1088,6 +1089,10 @@ let PDFViewerApplication = {
sidebarView = apiPageModeToSidebarView(pageMode);
}
if (pageLayout && spreadMode === _ui_utils.SpreadMode.UNKNOWN) {
spreadMode = apiPageLayoutToSpreadMode(pageLayout);
}
this.setInitialView(hash, {
rotation,
sidebarView,
@ -2340,6 +2345,24 @@ function webViewerKeyDown(evt) {
}
}
function apiPageLayoutToSpreadMode(layout) {
switch (layout) {
case 'SinglePage':
case 'OneColumn':
return _ui_utils.SpreadMode.NONE;
case 'TwoColumnLeft':
case 'TwoPageLeft':
return _ui_utils.SpreadMode.ODD;
case 'TwoColumnRight':
case 'TwoPageRight':
return _ui_utils.SpreadMode.EVEN;
}
return _ui_utils.SpreadMode.NONE;
}
function apiPageModeToSidebarView(mode) {
switch (mode) {
case 'UseNone':
@ -11405,6 +11428,7 @@ _app.PDFViewerApplication.externalServices = {
case 'progressiveRead':
pdfDataRangeTransport.onDataProgressiveRead(args.chunk);
pdfDataRangeTransport.onDataProgress(args.loaded, args.total);
break;
case 'progressiveDone':

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

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