Bug 1485014 - Update pdf.js to version 2.0.775. r=bdahl

--HG--
extra : amend_source : 1a0a50252b281f43ecc9aff45f1f693deaa92ea2
This commit is contained in:
Ryan VanderMeulen 2018-08-21 10:10:16 -04:00
parent 9966e32859
commit 3fbc856a30
5 changed files with 74 additions and 123 deletions

View File

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.0.760
Current extension version is: 2.0.775
Taken from upstream commit: 1268aea2
Taken from upstream commit: 20cd1b35

View File

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
var pdfjsVersion = '2.0.760';
var pdfjsBuild = '1268aea2';
var pdfjsVersion = '2.0.775';
var pdfjsBuild = '20cd1b35';
var pdfjsSharedUtil = __w_pdfjs_require__(1);
var pdfjsDisplayAPI = __w_pdfjs_require__(7);
var pdfjsDisplayTextLayer = __w_pdfjs_require__(19);
@ -156,7 +156,6 @@ exports.createValidAbsoluteUrl = pdfjsSharedUtil.createValidAbsoluteUrl;
exports.createObjectURL = pdfjsSharedUtil.createObjectURL;
exports.removeNullCharacters = pdfjsSharedUtil.removeNullCharacters;
exports.shadow = pdfjsSharedUtil.shadow;
exports.createBlob = pdfjsSharedUtil.createBlob;
exports.Util = pdfjsSharedUtil.Util;
exports.ReadableStream = pdfjsSharedUtil.ReadableStream;
exports.URL = pdfjsSharedUtil.URL;
@ -178,7 +177,7 @@ exports.apiCompatibilityParams = pdfjsDisplayAPICompatibility.apiCompatibilityPa
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.URL = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.getInheritableProperty = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.toRomanNumerals = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined;
exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.URL = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.getInheritableProperty = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.toRomanNumerals = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined;
__w_pdfjs_require__(2);
@ -874,17 +873,11 @@ function createPromiseCapability() {
});
return capability;
}
var createBlob = function createBlob(data, contentType) {
if (typeof Blob !== 'undefined') {
return new Blob([data], { type: contentType });
}
throw new Error('The "Blob" constructor is not supported.');
};
var createObjectURL = function createObjectURLClosure() {
var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
return function createObjectURL(data, contentType, forceDataSchema = false) {
if (!forceDataSchema && _url_polyfill.URL.createObjectURL) {
var blob = createBlob(data, contentType);
const blob = new Blob([data], { type: contentType });
return _url_polyfill.URL.createObjectURL(blob);
}
var buffer = 'data:' + contentType + ';base64,';
@ -932,7 +925,6 @@ exports.arrayByteLength = arrayByteLength;
exports.arraysToBytes = arraysToBytes;
exports.assert = assert;
exports.bytesToString = bytesToString;
exports.createBlob = createBlob;
exports.createPromiseCapability = createPromiseCapability;
exports.createObjectURL = createObjectURL;
exports.deprecated = deprecated;
@ -4223,7 +4215,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
}
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId,
apiVersion: '2.0.760',
apiVersion: '2.0.775',
source: {
data: source.data,
url: source.url,
@ -5566,8 +5558,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.760';
exports.build = build = '1268aea2';
exports.version = version = '2.0.775';
exports.build = build = '20cd1b35';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -8182,13 +8174,11 @@ exports.MessageHandler = undefined;
var _util = __w_pdfjs_require__(1);
function resolveCall(fn, args, thisArg = null) {
async function resolveCall(fn, args, thisArg = null) {
if (!fn) {
return Promise.resolve(undefined);
return;
}
return new Promise((resolve, reject) => {
resolve(fn.apply(thisArg, args));
});
return fn.apply(thisArg, args);
}
function wrapReason(reason) {
if (typeof reason !== 'object') {
@ -9130,19 +9120,19 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
get contentLength() {
return this._stream._contentLength;
},
read: function PDFDataTransportStreamReader_read() {
async read() {
if (this._queuedChunks.length > 0) {
var chunk = this._queuedChunks.shift();
return Promise.resolve({
return {
value: chunk,
done: false
});
};
}
if (this._done) {
return Promise.resolve({
return {
value: undefined,
done: true
});
};
}
var requestCapability = (0, _util.createPromiseCapability)();
this._requests.push(requestCapability);
@ -9195,20 +9185,20 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
get isStreamingSupported() {
return false;
},
read: function PDFDataTransportStreamRangeReader_read() {
async read() {
if (this._queuedChunk) {
let chunk = this._queuedChunk;
this._queuedChunk = null;
return Promise.resolve({
return {
value: chunk,
done: false
});
};
}
if (this._done) {
return Promise.resolve({
return {
value: undefined,
done: true
});
};
}
var requestCapability = (0, _util.createPromiseCapability)();
this._requests.push(requestCapability);

View File

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
var pdfjsVersion = '2.0.760';
var pdfjsBuild = '1268aea2';
var pdfjsVersion = '2.0.775';
var pdfjsBuild = '20cd1b35';
var pdfjsCoreWorker = __w_pdfjs_require__(1);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
@ -327,7 +327,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
let apiVersion = docParams.apiVersion;
let workerVersion = '2.0.760';
let workerVersion = '2.0.775';
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
}
@ -715,7 +715,7 @@ exports.WorkerMessageHandler = WorkerMessageHandler;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.URL = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.getInheritableProperty = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.toRomanNumerals = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined;
exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.URL = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.getInheritableProperty = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.toRomanNumerals = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined;
__w_pdfjs_require__(3);
@ -1411,17 +1411,11 @@ function createPromiseCapability() {
});
return capability;
}
var createBlob = function createBlob(data, contentType) {
if (typeof Blob !== 'undefined') {
return new Blob([data], { type: contentType });
}
throw new Error('The "Blob" constructor is not supported.');
};
var createObjectURL = function createObjectURLClosure() {
var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
return function createObjectURL(data, contentType, forceDataSchema = false) {
if (!forceDataSchema && _url_polyfill.URL.createObjectURL) {
var blob = createBlob(data, contentType);
const blob = new Blob([data], { type: contentType });
return _url_polyfill.URL.createObjectURL(blob);
}
var buffer = 'data:' + contentType + ';base64,';
@ -1469,7 +1463,6 @@ exports.arrayByteLength = arrayByteLength;
exports.arraysToBytes = arraysToBytes;
exports.assert = assert;
exports.bytesToString = bytesToString;
exports.createBlob = createBlob;
exports.createPromiseCapability = createPromiseCapability;
exports.createObjectURL = createObjectURL;
exports.deprecated = deprecated;
@ -4636,7 +4629,7 @@ class BasePdfManager {
cleanup() {
return this.pdfDocument.cleanup();
}
ensure(obj, prop, args) {
async ensure(obj, prop, args) {
(0, _util.unreachable)('Abstract method `ensure` called');
}
requestRange(begin, end) {
@ -4666,15 +4659,12 @@ class LocalPdfManager extends BasePdfManager {
this.pdfDocument = new _document.PDFDocument(this, stream);
this._loadedStreamPromise = Promise.resolve(stream);
}
ensure(obj, prop, args) {
return new Promise(function (resolve) {
const value = obj[prop];
if (typeof value === 'function') {
resolve(value.apply(obj, args));
} else {
resolve(value);
}
});
async ensure(obj, prop, args) {
const value = obj[prop];
if (typeof value === 'function') {
return value.apply(obj, args);
}
return value;
}
requestRange(begin, end) {
return Promise.resolve();
@ -4702,28 +4692,20 @@ class NetworkPdfManager extends BasePdfManager {
});
this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
}
ensure(obj, prop, args) {
return new Promise((resolve, reject) => {
let ensureHelper = () => {
try {
const value = obj[prop];
let result;
if (typeof value === 'function') {
result = value.apply(obj, args);
} else {
result = value;
}
resolve(result);
} catch (ex) {
if (!(ex instanceof _util.MissingDataException)) {
reject(ex);
return;
}
this.streamManager.requestRange(ex.begin, ex.end).then(ensureHelper, reject);
}
};
ensureHelper();
});
async ensure(obj, prop, args) {
try {
const value = obj[prop];
if (typeof value === 'function') {
return value.apply(obj, args);
}
return value;
} catch (ex) {
if (!(ex instanceof _util.MissingDataException)) {
throw ex;
}
await this.requestRange(ex.begin, ex.end);
return this.ensure(obj, prop, args);
}
}
requestRange(begin, end) {
return this.streamManager.requestRange(begin, end);
@ -5609,14 +5591,6 @@ var PDFDocument = function PDFDocumentClosure() {
}
return (0, _util.shadow)(this, 'startXRef', startXRef);
},
get mainXRefEntriesOffset() {
var mainXRefEntriesOffset = 0;
var linearization = this.linearization;
if (linearization) {
mainXRefEntriesOffset = linearization.mainXRefEntriesOffset;
}
return (0, _util.shadow)(this, 'mainXRefEntriesOffset', mainXRefEntriesOffset);
},
checkHeader: function PDFDocument_checkHeader() {
var stream = this.stream;
stream.reset();
@ -6968,28 +6942,22 @@ var XRef = function XRefClosure() {
}
return xrefEntry;
},
fetchIfRefAsync: function XRef_fetchIfRefAsync(obj, suppressEncryption) {
async fetchIfRefAsync(obj, suppressEncryption) {
if (!(0, _primitives.isRef)(obj)) {
return Promise.resolve(obj);
return obj;
}
return this.fetchAsync(obj, suppressEncryption);
},
fetchAsync: function XRef_fetchAsync(ref, suppressEncryption) {
var streamManager = this.stream.manager;
var xref = this;
return new Promise(function tryFetch(resolve, reject) {
try {
resolve(xref.fetch(ref, suppressEncryption));
} catch (e) {
if (e instanceof _util.MissingDataException) {
streamManager.requestRange(e.begin, e.end).then(function () {
tryFetch(resolve, reject);
}, reject);
return;
}
reject(e);
async fetchAsync(ref, suppressEncryption) {
try {
return this.fetch(ref, suppressEncryption);
} catch (ex) {
if (!(ex instanceof _util.MissingDataException)) {
throw ex;
}
});
await this.pdfManager.requestRange(ex.begin, ex.end);
return this.fetchAsync(ref, suppressEncryption);
}
},
getCatalogObj: function XRef_getCatalogObj() {
return this.root;
@ -18482,7 +18450,7 @@ var QueueOptimizer = function QueueOptimizerClosure() {
}
var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
var imgData = new Uint8Array(imgWidth * imgHeight * 4);
var imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4);
var imgRowSize = imgWidth << 2;
for (q = 0; q < count; q++) {
var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
@ -18821,6 +18789,7 @@ var OperatorList = function OperatorListClosure() {
case _util.OPS.paintInlineImageXObjectGroup:
case _util.OPS.paintImageMaskXObject:
var arg = argsArray[i][0];
;
if (!arg.cached) {
transfers.push(arg.data.buffer);
}
@ -19018,16 +18987,15 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
this.builtInCMapCache = builtInCMapCache;
this.options = options || DefaultPartialEvaluatorOptions;
this.pdfFunctionFactory = pdfFunctionFactory;
this.fetchBuiltInCMap = name => {
this.fetchBuiltInCMap = async name => {
if (this.builtInCMapCache.has(name)) {
return Promise.resolve(this.builtInCMapCache.get(name));
return this.builtInCMapCache.get(name);
}
return this.handler.sendWithPromise('FetchBuiltInCMap', { name }).then(data => {
if (data.compressionType !== _util.CMapCompressionType.NONE) {
this.builtInCMapCache.set(name, data);
}
return data;
});
const data = await this.handler.sendWithPromise('FetchBuiltInCMap', { name });
if (data.compressionType !== _util.CMapCompressionType.NONE) {
this.builtInCMapCache.set(name, data);
}
return data;
};
}
var TIME_SLOT_DURATION_MS = 20;
@ -40886,13 +40854,11 @@ exports.MessageHandler = undefined;
var _util = __w_pdfjs_require__(2);
function resolveCall(fn, args, thisArg = null) {
async function resolveCall(fn, args, thisArg = null) {
if (!fn) {
return Promise.resolve(undefined);
return;
}
return new Promise((resolve, reject) => {
resolve(fn.apply(thisArg, args));
});
return fn.apply(thisArg, args);
}
function wrapReason(reason) {
if (typeof reason !== 'object') {

View File

@ -816,7 +816,7 @@ let PDFViewerApplication = {
return;
}
this.pdfDocument.getData().then(function (data) {
let blob = (0, _pdfjsLib.createBlob)(data, 'application/pdf');
const blob = new Blob([data], { type: 'application/pdf' });
downloadManager.download(blob, url, filename);
}).catch(downloadByUrl);
},
@ -6468,7 +6468,6 @@ class BaseViewer {
this.downloadManager = options.downloadManager || null;
this.removePageBorders = options.removePageBorders || false;
this.textLayerMode = Number.isInteger(options.textLayerMode) ? options.textLayerMode : _ui_utils.TextLayerMode.ENABLE;
this.enhanceTextSelection = options.enhanceTextSelection || false;
this.imageResourcesPath = options.imageResourcesPath || '';
this.renderInteractiveForms = options.renderInteractiveForms || false;
this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
@ -6800,9 +6799,7 @@ class BaseViewer {
let hPadding = noPadding ? 0 : _ui_utils.SCROLLBAR_PADDING;
let vPadding = noPadding ? 0 : _ui_utils.VERTICAL_PADDING;
if (!noPadding && this._isScrollModeHorizontal) {
const temp = hPadding;
hPadding = vPadding;
vPadding = temp;
[hPadding, vPadding] = [vPadding, hPadding];
}
let pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale;
let pageHeightScale = (this.container.clientHeight - vPadding) / currentPage.height * currentPage.scale;
@ -7136,7 +7133,6 @@ class BaseViewer {
this.scrollPageIntoView({ pageNumber });
this.update();
}
setScrollMode(mode) {}
get spreadMode() {
return this._spreadMode;
}
@ -7186,7 +7182,6 @@ class BaseViewer {
this.scrollPageIntoView({ pageNumber });
this.update();
}
setSpreadMode(mode) {}
}
exports.BaseViewer = BaseViewer;
exports.ScrollMode = ScrollMode;

View File

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