Bug 1592804 - Update pdf.js to version 2.4.91. r=bdahl

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ryan VanderMeulen 2019-11-01 15:34:06 +00:00
parent 3d0252d00b
commit 055a35a2e2
5 changed files with 110 additions and 83 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.4.71
Current extension version is: 2.4.91
Taken from upstream commit: d7f651aa
Taken from upstream commit: 72bd8e8b

View File

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
var pdfjsVersion = '2.4.71';
var pdfjsBuild = 'd7f651aa';
var pdfjsVersion = '2.4.91';
var pdfjsBuild = '72bd8e8b';
var pdfjsSharedUtil = __w_pdfjs_require__(1);
@ -1271,7 +1271,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId,
apiVersion: '2.4.71',
apiVersion: '2.4.91',
source: {
data: source.data,
url: source.url,
@ -1518,7 +1518,7 @@ class PDFPageProxy {
this.pageIndex = pageIndex;
this._pageInfo = pageInfo;
this._transport = transport;
this._stats = pdfBug ? new _display_utils.StatTimer() : _display_utils.DummyStatTimer;
this._stats = pdfBug ? new _display_utils.StatTimer() : null;
this._pdfBug = pdfBug;
this.commonObjs = transport.commonObjs;
this.objs = new PDFObjects();
@ -1551,12 +1551,16 @@ class PDFPageProxy {
getViewport({
scale,
rotation = this.rotate,
offsetX = 0,
offsetY = 0,
dontFlip = false
} = {}) {
return new _display_utils.PageViewport({
viewBox: this.view,
scale,
rotation,
offsetX,
offsetY,
dontFlip
});
}
@ -1583,8 +1587,10 @@ class PDFPageProxy {
canvasFactory = null,
background = null
}) {
const stats = this._stats;
stats.time('Overall');
if (this._stats) {
this._stats.time('Overall');
}
const renderingIntent = intent === 'print' ? 'print' : 'display';
this.pendingCleanup = false;
@ -1611,7 +1617,10 @@ class PDFPageProxy {
argsArray: [],
lastChunk: false
};
stats.time('Page Request');
if (this._stats) {
this._stats.time('Page Request');
}
this._pumpOperatorList({
pageIndex: this.pageNumber - 1,
@ -1644,8 +1653,11 @@ class PDFPageProxy {
internalRenderTask.capability.resolve();
}
stats.timeEnd('Rendering');
stats.timeEnd('Overall');
if (this._stats) {
this._stats.timeEnd('Rendering');
this._stats.timeEnd('Overall');
}
};
const internalRenderTask = new InternalRenderTask({
@ -1679,7 +1691,10 @@ class PDFPageProxy {
return;
}
stats.time('Rendering');
if (this._stats) {
this._stats.time('Rendering');
}
internalRenderTask.initializeGraphics(transparency);
internalRenderTask.operatorListChanged();
}).catch(complete);
@ -1719,7 +1734,9 @@ class PDFPageProxy {
lastChunk: false
};
this._stats.time('Page Request');
if (this._stats) {
this._stats.time('Page Request');
}
this._pumpOperatorList({
pageIndex: this.pageIndex,
@ -1826,7 +1843,7 @@ class PDFPageProxy {
this.objs.clear();
this.annotationsPromise = null;
if (resetStats && this._stats instanceof _display_utils.StatTimer) {
if (resetStats && this._stats) {
this._stats = new _display_utils.StatTimer();
}
@ -1840,7 +1857,9 @@ class PDFPageProxy {
return;
}
this._stats.timeEnd('Page Request');
if (this._stats) {
this._stats.timeEnd('Page Request');
}
if (intentState.displayReadyCapability) {
intentState.displayReadyCapability.resolve(transparency);
@ -1969,7 +1988,7 @@ class PDFPageProxy {
}
get stats() {
return this._stats instanceof _display_utils.StatTimer ? this._stats : null;
return this._stats;
}
}
@ -3186,9 +3205,9 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
return InternalRenderTask;
}();
const version = '2.4.71';
const version = '2.4.91';
exports.version = version;
const build = 'd7f651aa';
const build = '72bd8e8b';
exports.build = build;
/***/ }),
@ -3208,7 +3227,7 @@ exports.isValidFetchUrl = isValidFetchUrl;
exports.loadScript = loadScript;
exports.deprecated = deprecated;
exports.releaseImageResources = releaseImageResources;
exports.PDFDateString = exports.DummyStatTimer = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.RenderingCancelledException = exports.PageViewport = void 0;
exports.PDFDateString = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.RenderingCancelledException = exports.PageViewport = void 0;
var _util = __w_pdfjs_require__(1);
@ -3407,14 +3426,16 @@ class PageViewport {
clone({
scale = this.scale,
rotation = this.rotation,
offsetX = this.offsetX,
offsetY = this.offsetY,
dontFlip = false
} = {}) {
return new PageViewport({
viewBox: this.viewBox.slice(),
scale,
rotation,
offsetX: this.offsetX,
offsetY: this.offsetY,
offsetX,
offsetY,
dontFlip
});
}
@ -3492,31 +3513,22 @@ function getFilenameFromUrl(url) {
}
class StatTimer {
constructor(enable = true) {
this.enabled = !!enable;
constructor() {
this.started = Object.create(null);
this.times = [];
}
time(name) {
if (!this.enabled) {
return;
}
if (name in this.started) {
(0, _util.warn)('Timer is already running for ' + name);
(0, _util.warn)(`Timer is already running for ${name}`);
}
this.started[name] = Date.now();
}
timeEnd(name) {
if (!this.enabled) {
return;
}
if (!(name in this.started)) {
(0, _util.warn)('Timer has not been started for ' + name);
(0, _util.warn)(`Timer has not been started for ${name}`);
}
this.times.push({
@ -3528,7 +3540,7 @@ class StatTimer {
}
toString() {
let out = '',
let outBuf = [],
longest = 0;
for (const time of this.times) {
@ -3541,33 +3553,16 @@ class StatTimer {
for (const time of this.times) {
const duration = time.end - time.start;
out += `${time.name.padEnd(longest)} ${duration}ms\n`;
outBuf.push(`${time.name.padEnd(longest)} ${duration}ms\n`);
}
return out;
return outBuf.join('');
}
}
exports.StatTimer = StatTimer;
class DummyStatTimer {
constructor() {
(0, _util.unreachable)('Cannot initialize DummyStatTimer.');
}
static time(name) {}
static timeEnd(name) {}
static toString() {
return '';
}
}
exports.DummyStatTimer = DummyStatTimer;
function isFetchSupported() {
return typeof fetch !== 'undefined' && typeof Response !== 'undefined' && 'body' in Response.prototype && typeof ReadableStream !== 'undefined';
}

View File

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
const pdfjsVersion = '2.4.71';
const pdfjsBuild = 'd7f651aa';
const pdfjsVersion = '2.4.91';
const pdfjsBuild = '72bd8e8b';
const pdfjsCoreWorker = __w_pdfjs_require__(1);
@ -225,7 +225,7 @@ var WorkerMessageHandler = {
var WorkerTasks = [];
const verbosity = (0, _util.getVerbosityLevel)();
const apiVersion = docParams.apiVersion;
const workerVersion = '2.4.71';
const workerVersion = '2.4.91';
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
@ -2345,6 +2345,14 @@ class ChunkedStream {
return missingChunks;
};
ChunkedStreamSubstream.prototype.allChunksLoaded = function () {
if (this.numChunksLoaded === this.numChunks) {
return true;
}
return this.getMissingChunks().length === 0;
};
const subStream = new ChunkedStreamSubstream();
subStream.pos = subStream.start = start;
subStream.end = start + length || this.end;
@ -3480,8 +3488,6 @@ var _parser = __w_pdfjs_require__(12);
var _core_utils = __w_pdfjs_require__(9);
var _chunked_stream = __w_pdfjs_require__(8);
var _crypto = __w_pdfjs_require__(23);
var _colorspace = __w_pdfjs_require__(24);
@ -5570,12 +5576,12 @@ exports.FileSpec = FileSpec;
let ObjectLoader = function () {
function mayHaveChildren(value) {
return (0, _primitives.isRef)(value) || (0, _primitives.isDict)(value) || Array.isArray(value) || (0, _primitives.isStream)(value);
return value instanceof _primitives.Ref || value instanceof _primitives.Dict || Array.isArray(value) || (0, _primitives.isStream)(value);
}
function addChildren(node, nodesToVisit) {
if ((0, _primitives.isDict)(node) || (0, _primitives.isStream)(node)) {
let dict = (0, _primitives.isDict)(node) ? node : node.dict;
if (node instanceof _primitives.Dict || (0, _primitives.isStream)(node)) {
let dict = node instanceof _primitives.Dict ? node : node.dict;
let dictKeys = dict.getKeys();
for (let i = 0, ii = dictKeys.length; i < ii; i++) {
@ -5605,14 +5611,12 @@ let ObjectLoader = function () {
}
ObjectLoader.prototype = {
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;
async load() {
if (!this.xref.stream.allChunksLoaded || this.xref.stream.allChunksLoaded()) {
return undefined;
}
this.capability = (0, _util.createPromiseCapability)();
let {
keys,
dict
@ -5640,7 +5644,7 @@ let ObjectLoader = function () {
while (nodesToVisit.length) {
let currentNode = nodesToVisit.pop();
if ((0, _primitives.isRef)(currentNode)) {
if (currentNode instanceof _primitives.Ref) {
if (this.refSet.has(currentNode)) {
continue;
}
@ -5668,7 +5672,7 @@ let ObjectLoader = function () {
for (let i = 0, ii = baseStreams.length; i < ii; i++) {
let stream = baseStreams[i];
if (stream.getMissingChunks && stream.getMissingChunks().length) {
if (stream.allChunksLoaded && !stream.allChunksLoaded()) {
foundMissingData = true;
pendingRequests.push({
begin: stream.start,
@ -5690,7 +5694,7 @@ let ObjectLoader = function () {
for (let i = 0, ii = nodesToRevisit.length; i < ii; i++) {
let node = nodesToRevisit[i];
if ((0, _primitives.isRef)(node)) {
if (node instanceof _primitives.Ref) {
this.refSet.remove(node);
}
}
@ -19894,8 +19898,25 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
};
function normalizeBlendMode(value) {
function normalizeBlendMode(value, parsingArray = false) {
if (Array.isArray(value)) {
for (let i = 0, ii = value.length; i < ii; i++) {
const maybeBM = normalizeBlendMode(value[i], true);
if (maybeBM) {
return maybeBM;
}
}
(0, _util.warn)(`Unsupported blend mode Array: ${value}`);
return 'source-over';
}
if (!(0, _primitives.isName)(value)) {
if (parsingArray) {
return null;
}
return 'source-over';
}
@ -19950,7 +19971,11 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return 'luminosity';
}
(0, _util.warn)('Unsupported blend mode: ' + value.name);
if (parsingArray) {
return null;
}
(0, _util.warn)(`Unsupported blend mode: ${value.name}`);
return 'source-over';
}
@ -20005,10 +20030,22 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
processed[graphicState.objId] = true;
}
var bm = graphicState.get('BM');
const bm = graphicState.get('BM');
if (bm instanceof _primitives.Name && bm.name !== 'Normal') {
return true;
if (bm instanceof _primitives.Name) {
if (bm.name !== 'Normal') {
return true;
}
continue;
}
if (bm !== undefined && Array.isArray(bm)) {
for (let j = 0, jj = bm.length; j < jj; j++) {
if (bm[j] instanceof _primitives.Name && bm[j].name !== 'Normal') {
return true;
}
}
}
}
}

View File

@ -1375,12 +1375,12 @@ html[dir='rtl'] .verticalToolbarSeparator {
.toolbarField {
padding: 3px 6px;
margin: 4px 0 4px 0;
border: 1px solid transparent;
border-radius: 2px;
background-color: hsla(0,0%,100%,.09);
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
background-clip: padding-box;
border: 1px solid hsla(0,0%,0%,.35);
border-width: 1px;
border-style: solid;
border-color: hsla(0,0%,0%,.32) hsla(0,0%,0%,.38) hsla(0,0%,0%,.42);
box-shadow: 0 1px 0 hsla(0,0%,0%,.05) inset,
0 1px 0 hsla(0,0%,100%,.05);
@ -1718,11 +1718,6 @@ html[dir='rtl'] .outlineItemToggler::before {
background-color: #474747; /* fallback */
background-image: url(images/texture.png),
linear-gradient(hsla(0,0%,32%,.99), hsla(0,0%,27%,.95));
box-shadow: inset 1px 0 0 hsla(0,0%,100%,.08),
inset 0 1px 1px hsla(0,0%,0%,.15),
inset 0 -1px 0 hsla(0,0%,100%,.05),
0 1px 0 hsla(0,0%,0%,.15),
0 1px 1px hsla(0,0%,0%,.1);
border: 1px solid hsla(0,0%,0%,.5);
border-radius: 4px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);

View File

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