зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1374426 - Update pdf.js to version 1.8.467. r=bdahl
This commit is contained in:
Родитель
d71c865ef2
Коммит
095d515859
|
@ -1,5 +1,5 @@
|
|||
This is the PDF.js project output, https://github.com/mozilla/pdf.js
|
||||
|
||||
Current extension version is: 1.8.450
|
||||
Current extension version is: 1.8.467
|
||||
|
||||
Taken from upstream commit: 20975134
|
||||
Taken from upstream commit: 679ffc84
|
||||
|
|
|
@ -3656,8 +3656,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
|
|||
}();
|
||||
var version, build;
|
||||
{
|
||||
exports.version = version = '1.8.450';
|
||||
exports.build = build = '20975134';
|
||||
exports.version = version = '1.8.467';
|
||||
exports.build = build = '679ffc84';
|
||||
}
|
||||
exports.getDocument = getDocument;
|
||||
exports.LoopbackPort = LoopbackPort;
|
||||
|
@ -4659,8 +4659,8 @@ if (!_util.globalScope.PDFJS) {
|
|||
}
|
||||
var PDFJS = _util.globalScope.PDFJS;
|
||||
{
|
||||
PDFJS.version = '1.8.450';
|
||||
PDFJS.build = '20975134';
|
||||
PDFJS.version = '1.8.467';
|
||||
PDFJS.build = '679ffc84';
|
||||
}
|
||||
PDFJS.pdfBug = false;
|
||||
if (PDFJS.verbosity !== undefined) {
|
||||
|
@ -10007,8 +10007,8 @@ exports.TilingPattern = TilingPattern;
|
|||
"use strict";
|
||||
|
||||
|
||||
var pdfjsVersion = '1.8.450';
|
||||
var pdfjsBuild = '20975134';
|
||||
var pdfjsVersion = '1.8.467';
|
||||
var pdfjsBuild = '679ffc84';
|
||||
var pdfjsSharedUtil = __w_pdfjs_require__(0);
|
||||
var pdfjsDisplayGlobal = __w_pdfjs_require__(8);
|
||||
var pdfjsDisplayAPI = __w_pdfjs_require__(3);
|
||||
|
|
|
@ -1454,7 +1454,7 @@ var Dict = function DictClosure() {
|
|||
return nonSerializable;
|
||||
};
|
||||
function Dict(xref) {
|
||||
this.map = Object.create(null);
|
||||
this._map = Object.create(null);
|
||||
this.xref = xref;
|
||||
this.objId = null;
|
||||
this.suppressEncryption = false;
|
||||
|
@ -1468,32 +1468,32 @@ var Dict = function DictClosure() {
|
|||
var value;
|
||||
var xref = this.xref,
|
||||
suppressEncryption = this.suppressEncryption;
|
||||
if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
|
||||
if (typeof (value = this._map[key1]) !== 'undefined' || key1 in this._map || typeof key2 === 'undefined') {
|
||||
return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
|
||||
}
|
||||
if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
|
||||
if (typeof (value = this._map[key2]) !== 'undefined' || key2 in this._map || typeof key3 === 'undefined') {
|
||||
return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
|
||||
}
|
||||
value = this.map[key3] || null;
|
||||
value = this._map[key3] || null;
|
||||
return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
|
||||
},
|
||||
getAsync: function Dict_getAsync(key1, key2, key3) {
|
||||
var value;
|
||||
var xref = this.xref,
|
||||
suppressEncryption = this.suppressEncryption;
|
||||
if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
|
||||
if (typeof (value = this._map[key1]) !== 'undefined' || key1 in this._map || typeof key2 === 'undefined') {
|
||||
if (xref) {
|
||||
return xref.fetchIfRefAsync(value, suppressEncryption);
|
||||
}
|
||||
return Promise.resolve(value);
|
||||
}
|
||||
if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
|
||||
if (typeof (value = this._map[key2]) !== 'undefined' || key2 in this._map || typeof key3 === 'undefined') {
|
||||
if (xref) {
|
||||
return xref.fetchIfRefAsync(value, suppressEncryption);
|
||||
}
|
||||
return Promise.resolve(value);
|
||||
}
|
||||
value = this.map[key3] || null;
|
||||
value = this._map[key3] || null;
|
||||
if (xref) {
|
||||
return xref.fetchIfRefAsync(value, suppressEncryption);
|
||||
}
|
||||
|
@ -1516,36 +1516,36 @@ var Dict = function DictClosure() {
|
|||
return value;
|
||||
},
|
||||
getRaw: function Dict_getRaw(key) {
|
||||
return this.map[key];
|
||||
return this._map[key];
|
||||
},
|
||||
getKeys: function Dict_getKeys() {
|
||||
return Object.keys(this.map);
|
||||
return Object.keys(this._map);
|
||||
},
|
||||
set: function Dict_set(key, value) {
|
||||
this.map[key] = value;
|
||||
this._map[key] = value;
|
||||
},
|
||||
has: function Dict_has(key) {
|
||||
return key in this.map;
|
||||
return key in this._map;
|
||||
},
|
||||
forEach: function Dict_forEach(callback) {
|
||||
for (var key in this.map) {
|
||||
for (var key in this._map) {
|
||||
callback(key, this.get(key));
|
||||
}
|
||||
}
|
||||
};
|
||||
Dict.empty = new Dict(null);
|
||||
Dict.merge = function Dict_merge(xref, dictArray) {
|
||||
var mergedDict = new Dict(xref);
|
||||
for (var i = 0, ii = dictArray.length; i < ii; i++) {
|
||||
var dict = dictArray[i];
|
||||
Dict.merge = function (xref, dictArray) {
|
||||
let mergedDict = new Dict(xref);
|
||||
for (let i = 0, ii = dictArray.length; i < ii; i++) {
|
||||
let dict = dictArray[i];
|
||||
if (!isDict(dict)) {
|
||||
continue;
|
||||
}
|
||||
for (var keyName in dict.map) {
|
||||
if (mergedDict.map[keyName]) {
|
||||
for (let keyName in dict._map) {
|
||||
if (mergedDict._map[keyName] !== undefined) {
|
||||
continue;
|
||||
}
|
||||
mergedDict.map[keyName] = dict.map[keyName];
|
||||
mergedDict._map[keyName] = dict._map[keyName];
|
||||
}
|
||||
}
|
||||
return mergedDict;
|
||||
|
@ -22751,86 +22751,83 @@ var FileSpec = function FileSpecClosure() {
|
|||
};
|
||||
return FileSpec;
|
||||
}();
|
||||
var ObjectLoader = function () {
|
||||
let ObjectLoader = function () {
|
||||
function mayHaveChildren(value) {
|
||||
return (0, _primitives.isRef)(value) || (0, _primitives.isDict)(value) || (0, _util.isArray)(value) || (0, _primitives.isStream)(value);
|
||||
}
|
||||
function addChildren(node, nodesToVisit) {
|
||||
var value;
|
||||
if ((0, _primitives.isDict)(node) || (0, _primitives.isStream)(node)) {
|
||||
var map;
|
||||
if ((0, _primitives.isDict)(node)) {
|
||||
map = node.map;
|
||||
} else {
|
||||
map = node.dict.map;
|
||||
}
|
||||
for (var key in map) {
|
||||
value = map[key];
|
||||
if (mayHaveChildren(value)) {
|
||||
nodesToVisit.push(value);
|
||||
let dict = (0, _primitives.isDict)(node) ? node : node.dict;
|
||||
let dictKeys = dict.getKeys();
|
||||
for (let i = 0, ii = dictKeys.length; i < ii; i++) {
|
||||
let rawValue = dict.getRaw(dictKeys[i]);
|
||||
if (mayHaveChildren(rawValue)) {
|
||||
nodesToVisit.push(rawValue);
|
||||
}
|
||||
}
|
||||
} else if ((0, _util.isArray)(node)) {
|
||||
for (var i = 0, ii = node.length; i < ii; i++) {
|
||||
value = node[i];
|
||||
for (let i = 0, ii = node.length; i < ii; i++) {
|
||||
let value = node[i];
|
||||
if (mayHaveChildren(value)) {
|
||||
nodesToVisit.push(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function ObjectLoader(obj, keys, xref) {
|
||||
this.obj = obj;
|
||||
function ObjectLoader(dict, keys, xref) {
|
||||
this.dict = dict;
|
||||
this.keys = keys;
|
||||
this.xref = xref;
|
||||
this.refSet = null;
|
||||
this.capability = null;
|
||||
}
|
||||
ObjectLoader.prototype = {
|
||||
load: function ObjectLoader_load() {
|
||||
var keys = this.keys;
|
||||
load() {
|
||||
this.capability = (0, _util.createPromiseCapability)();
|
||||
if (!(this.xref.stream instanceof _chunked_stream.ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) {
|
||||
this.capability.resolve();
|
||||
return this.capability.promise;
|
||||
}
|
||||
let { keys, dict } = this;
|
||||
this.refSet = new _primitives.RefSet();
|
||||
var nodesToVisit = [];
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
nodesToVisit.push(this.obj[keys[i]]);
|
||||
let nodesToVisit = [];
|
||||
for (let i = 0, ii = keys.length; i < ii; i++) {
|
||||
let rawValue = dict.getRaw(keys[i]);
|
||||
if (rawValue !== undefined) {
|
||||
nodesToVisit.push(rawValue);
|
||||
}
|
||||
}
|
||||
this._walk(nodesToVisit);
|
||||
return this.capability.promise;
|
||||
},
|
||||
_walk: function ObjectLoader_walk(nodesToVisit) {
|
||||
var nodesToRevisit = [];
|
||||
var pendingRequests = [];
|
||||
_walk(nodesToVisit) {
|
||||
let nodesToRevisit = [];
|
||||
let pendingRequests = [];
|
||||
while (nodesToVisit.length) {
|
||||
var currentNode = nodesToVisit.pop();
|
||||
let currentNode = nodesToVisit.pop();
|
||||
if ((0, _primitives.isRef)(currentNode)) {
|
||||
if (this.refSet.has(currentNode)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
var ref = currentNode;
|
||||
this.refSet.put(ref);
|
||||
this.refSet.put(currentNode);
|
||||
currentNode = this.xref.fetch(currentNode);
|
||||
} catch (e) {
|
||||
if (!(e instanceof _util.MissingDataException)) {
|
||||
throw e;
|
||||
} catch (ex) {
|
||||
if (!(ex instanceof _util.MissingDataException)) {
|
||||
throw ex;
|
||||
}
|
||||
nodesToRevisit.push(currentNode);
|
||||
pendingRequests.push({
|
||||
begin: e.begin,
|
||||
end: e.end
|
||||
begin: ex.begin,
|
||||
end: ex.end
|
||||
});
|
||||
}
|
||||
}
|
||||
if (currentNode && currentNode.getBaseStreams) {
|
||||
var baseStreams = currentNode.getBaseStreams();
|
||||
var foundMissingData = false;
|
||||
for (var i = 0; i < baseStreams.length; i++) {
|
||||
var stream = baseStreams[i];
|
||||
let baseStreams = currentNode.getBaseStreams();
|
||||
let foundMissingData = false;
|
||||
for (let i = 0, ii = baseStreams.length; i < ii; i++) {
|
||||
let stream = baseStreams[i];
|
||||
if (stream.getMissingChunks && stream.getMissingChunks().length) {
|
||||
foundMissingData = true;
|
||||
pendingRequests.push({
|
||||
|
@ -22847,14 +22844,13 @@ var ObjectLoader = function () {
|
|||
}
|
||||
if (pendingRequests.length) {
|
||||
this.xref.stream.manager.requestRanges(pendingRequests).then(() => {
|
||||
nodesToVisit = nodesToRevisit;
|
||||
for (var i = 0; i < nodesToRevisit.length; i++) {
|
||||
var node = nodesToRevisit[i];
|
||||
for (let i = 0, ii = nodesToRevisit.length; i < ii; i++) {
|
||||
let node = nodesToRevisit[i];
|
||||
if ((0, _primitives.isRef)(node)) {
|
||||
this.refSet.remove(node);
|
||||
}
|
||||
}
|
||||
this._walk(nodesToVisit);
|
||||
this._walk(nodesToRevisit);
|
||||
}, this.capability.reject);
|
||||
return;
|
||||
}
|
||||
|
@ -27469,7 +27465,7 @@ var Annotation = function AnnotationClosure() {
|
|||
if (!resources) {
|
||||
return;
|
||||
}
|
||||
var objectLoader = new _obj.ObjectLoader(resources.map, keys, resources.xref);
|
||||
let objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref);
|
||||
return objectLoader.load().then(function () {
|
||||
return resources;
|
||||
});
|
||||
|
@ -29006,7 +29002,7 @@ var Page = function PageClosure() {
|
|||
this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
|
||||
}
|
||||
return this.resourcesPromise.then(() => {
|
||||
var objectLoader = new _obj.ObjectLoader(this.resources.map, keys, this.xref);
|
||||
let objectLoader = new _obj.ObjectLoader(this.resources, keys, this.xref);
|
||||
return objectLoader.load();
|
||||
});
|
||||
},
|
||||
|
@ -39780,8 +39776,8 @@ exports.Type1Parser = Type1Parser;
|
|||
"use strict";
|
||||
|
||||
|
||||
var pdfjsVersion = '1.8.450';
|
||||
var pdfjsBuild = '20975134';
|
||||
var pdfjsVersion = '1.8.467';
|
||||
var pdfjsBuild = '679ffc84';
|
||||
var pdfjsCoreWorker = __w_pdfjs_require__(17);
|
||||
;
|
||||
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
|
||||
|
|
|
@ -876,6 +876,7 @@ var PDFViewerApplication = {
|
|||
l10n: null,
|
||||
pageRotation: 0,
|
||||
isInitialViewSet: false,
|
||||
downloadComplete: false,
|
||||
viewerPrefs: {
|
||||
sidebarViewOnLoad: _pdf_sidebar.SidebarView.NONE,
|
||||
pdfBugEnabled: false,
|
||||
|
@ -891,6 +892,7 @@ var PDFViewerApplication = {
|
|||
url: '',
|
||||
baseUrl: '',
|
||||
externalServices: DefaultExternalServices,
|
||||
_boundEvents: {},
|
||||
initialize: function pdfViewInitialize(appConfig) {
|
||||
this.preferences = this.externalServices.createPreferences();
|
||||
configure(_pdfjsLib.PDFJS);
|
||||
|
@ -1204,7 +1206,9 @@ var PDFViewerApplication = {
|
|||
this.pdfDocumentProperties.setDocument(null, null);
|
||||
}
|
||||
this.store = null;
|
||||
this.pageRotation = 0;
|
||||
this.isInitialViewSet = false;
|
||||
this.downloadComplete = false;
|
||||
this.pdfSidebar.reset();
|
||||
this.pdfOutlineViewer.reset();
|
||||
this.pdfAttachmentViewer.reset();
|
||||
|
@ -1247,7 +1251,6 @@ var PDFViewerApplication = {
|
|||
this.pdfDocumentProperties.setFileSize(args.length);
|
||||
}
|
||||
}
|
||||
this.downloadComplete = false;
|
||||
let loadingTask = (0, _pdfjsLib.getDocument)(parameters);
|
||||
this.pdfLoadingTask = loadingTask;
|
||||
loadingTask.onPassword = (updateCallback, reason) => {
|
||||
|
@ -1373,12 +1376,10 @@ var PDFViewerApplication = {
|
|||
this.pdfLinkService.setDocument(pdfDocument, baseDocumentUrl);
|
||||
this.pdfDocumentProperties.setDocument(pdfDocument, this.url);
|
||||
let pdfViewer = this.pdfViewer;
|
||||
pdfViewer.currentScale = scale;
|
||||
pdfViewer.setDocument(pdfDocument);
|
||||
let firstPagePromise = pdfViewer.firstPagePromise;
|
||||
let pagesPromise = pdfViewer.pagesPromise;
|
||||
let onePageRendered = pdfViewer.onePageRendered;
|
||||
this.pageRotation = 0;
|
||||
let pdfThumbnailViewer = this.pdfThumbnailViewer;
|
||||
pdfThumbnailViewer.setDocument(pdfDocument);
|
||||
firstPagePromise.then(pdfPage => {
|
||||
|
@ -1618,8 +1619,11 @@ var PDFViewerApplication = {
|
|||
}
|
||||
this.forceRendering();
|
||||
},
|
||||
rotatePages: function pdfViewRotatePages(delta) {
|
||||
var pageNumber = this.page;
|
||||
rotatePages(delta) {
|
||||
if (!this.pdfDocument) {
|
||||
return;
|
||||
}
|
||||
let pageNumber = this.page;
|
||||
this.pageRotation = (this.pageRotation + 360 + delta) % 360;
|
||||
this.pdfViewer.pagesRotation = this.pageRotation;
|
||||
this.pdfThumbnailViewer.pagesRotation = this.pageRotation;
|
||||
|
@ -1632,12 +1636,14 @@ var PDFViewerApplication = {
|
|||
}
|
||||
this.pdfPresentationMode.request();
|
||||
},
|
||||
bindEvents: function pdfViewBindEvents() {
|
||||
var eventBus = this.eventBus;
|
||||
bindEvents() {
|
||||
let eventBus = this.eventBus;
|
||||
this._boundEvents.beforePrint = this.beforePrint.bind(this);
|
||||
this._boundEvents.afterPrint = this.afterPrint.bind(this);
|
||||
eventBus.on('resize', webViewerResize);
|
||||
eventBus.on('hashchange', webViewerHashchange);
|
||||
eventBus.on('beforeprint', this.beforePrint.bind(this));
|
||||
eventBus.on('afterprint', this.afterPrint.bind(this));
|
||||
eventBus.on('beforeprint', this._boundEvents.beforePrint);
|
||||
eventBus.on('afterprint', this._boundEvents.afterPrint);
|
||||
eventBus.on('pagerendered', webViewerPageRendered);
|
||||
eventBus.on('textlayerrendered', webViewerTextLayerRendered);
|
||||
eventBus.on('updateviewarea', webViewerUpdateViewarea);
|
||||
|
@ -1665,23 +1671,75 @@ var PDFViewerApplication = {
|
|||
eventBus.on('find', webViewerFind);
|
||||
eventBus.on('findfromurlhash', webViewerFindFromUrlHash);
|
||||
},
|
||||
bindWindowEvents: function pdfViewBindWindowEvents() {
|
||||
var eventBus = this.eventBus;
|
||||
bindWindowEvents() {
|
||||
let eventBus = this.eventBus;
|
||||
this._boundEvents.windowResize = () => {
|
||||
eventBus.dispatch('resize');
|
||||
};
|
||||
this._boundEvents.windowHashChange = () => {
|
||||
eventBus.dispatch('hashchange', { hash: document.location.hash.substring(1) });
|
||||
};
|
||||
this._boundEvents.windowBeforePrint = () => {
|
||||
eventBus.dispatch('beforeprint');
|
||||
};
|
||||
this._boundEvents.windowAfterPrint = () => {
|
||||
eventBus.dispatch('afterprint');
|
||||
};
|
||||
window.addEventListener('wheel', webViewerWheel);
|
||||
window.addEventListener('click', webViewerClick);
|
||||
window.addEventListener('keydown', webViewerKeyDown);
|
||||
window.addEventListener('resize', function windowResize() {
|
||||
eventBus.dispatch('resize');
|
||||
});
|
||||
window.addEventListener('hashchange', function windowHashChange() {
|
||||
eventBus.dispatch('hashchange', { hash: document.location.hash.substring(1) });
|
||||
});
|
||||
window.addEventListener('beforeprint', function windowBeforePrint() {
|
||||
eventBus.dispatch('beforeprint');
|
||||
});
|
||||
window.addEventListener('afterprint', function windowAfterPrint() {
|
||||
eventBus.dispatch('afterprint');
|
||||
});
|
||||
window.addEventListener('resize', this._boundEvents.windowResize);
|
||||
window.addEventListener('hashchange', this._boundEvents.windowHashChange);
|
||||
window.addEventListener('beforeprint', this._boundEvents.windowBeforePrint);
|
||||
window.addEventListener('afterprint', this._boundEvents.windowAfterPrint);
|
||||
},
|
||||
unbindEvents() {
|
||||
let eventBus = this.eventBus;
|
||||
eventBus.off('resize', webViewerResize);
|
||||
eventBus.off('hashchange', webViewerHashchange);
|
||||
eventBus.off('beforeprint', this._boundEvents.beforePrint);
|
||||
eventBus.off('afterprint', this._boundEvents.afterPrint);
|
||||
eventBus.off('pagerendered', webViewerPageRendered);
|
||||
eventBus.off('textlayerrendered', webViewerTextLayerRendered);
|
||||
eventBus.off('updateviewarea', webViewerUpdateViewarea);
|
||||
eventBus.off('pagechanging', webViewerPageChanging);
|
||||
eventBus.off('scalechanging', webViewerScaleChanging);
|
||||
eventBus.off('sidebarviewchanged', webViewerSidebarViewChanged);
|
||||
eventBus.off('pagemode', webViewerPageMode);
|
||||
eventBus.off('namedaction', webViewerNamedAction);
|
||||
eventBus.off('presentationmodechanged', webViewerPresentationModeChanged);
|
||||
eventBus.off('presentationmode', webViewerPresentationMode);
|
||||
eventBus.off('openfile', webViewerOpenFile);
|
||||
eventBus.off('print', webViewerPrint);
|
||||
eventBus.off('download', webViewerDownload);
|
||||
eventBus.off('firstpage', webViewerFirstPage);
|
||||
eventBus.off('lastpage', webViewerLastPage);
|
||||
eventBus.off('nextpage', webViewerNextPage);
|
||||
eventBus.off('previouspage', webViewerPreviousPage);
|
||||
eventBus.off('zoomin', webViewerZoomIn);
|
||||
eventBus.off('zoomout', webViewerZoomOut);
|
||||
eventBus.off('pagenumberchanged', webViewerPageNumberChanged);
|
||||
eventBus.off('scalechanged', webViewerScaleChanged);
|
||||
eventBus.off('rotatecw', webViewerRotateCw);
|
||||
eventBus.off('rotateccw', webViewerRotateCcw);
|
||||
eventBus.off('documentproperties', webViewerDocumentProperties);
|
||||
eventBus.off('find', webViewerFind);
|
||||
eventBus.off('findfromurlhash', webViewerFindFromUrlHash);
|
||||
this._boundEvents.beforePrint = null;
|
||||
this._boundEvents.afterPrint = null;
|
||||
},
|
||||
unbindWindowEvents() {
|
||||
window.removeEventListener('wheel', webViewerWheel);
|
||||
window.removeEventListener('click', webViewerClick);
|
||||
window.removeEventListener('keydown', webViewerKeyDown);
|
||||
window.removeEventListener('resize', this._boundEvents.windowResize);
|
||||
window.removeEventListener('hashchange', this._boundEvents.windowHashChange);
|
||||
window.removeEventListener('beforeprint', this._boundEvents.windowBeforePrint);
|
||||
window.removeEventListener('afterprint', this._boundEvents.windowAfterPrint);
|
||||
this._boundEvents.windowResize = null;
|
||||
this._boundEvents.windowHashChange = null;
|
||||
this._boundEvents.windowBeforePrint = null;
|
||||
this._boundEvents.windowAfterPrint = null;
|
||||
}
|
||||
};
|
||||
var validateFileURL;
|
||||
|
|
Загрузка…
Ссылка в новой задаче