зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1288803 - Update pdf.js to version 1.5.345. r=bdahl
--HG-- extra : rebase_source : e5ba3899c1254ef7d318c5df83bc87e4d1f3fb4f
This commit is contained in:
Родитель
5989b201c1
Коммит
db1a1d4d21
|
@ -1,3 +1,3 @@
|
|||
This is the pdf.js project output, https://github.com/mozilla/pdf.js
|
||||
|
||||
Current extension version is: 1.5.337
|
||||
Current extension version is: 1.5.345
|
||||
|
|
|
@ -277,7 +277,7 @@ var PdfJs = {
|
|||
/**
|
||||
* pdf.js is only enabled if it is both selected as the pdf viewer and if the
|
||||
* global switch enabling it is true.
|
||||
* @return {boolean} Wether or not it's enabled.
|
||||
* @return {boolean} Whether or not it's enabled.
|
||||
*/
|
||||
get enabled() {
|
||||
var disabled = getBoolPref(PREF_DISABLED, true);
|
||||
|
|
|
@ -334,7 +334,7 @@ ChromeActions.prototype = {
|
|||
var result = this.localizedStrings[data];
|
||||
return JSON.stringify(result || null);
|
||||
} catch (e) {
|
||||
log('Unable to retrive localized strings: ' + e);
|
||||
log('Unable to retrieve localized strings: ' + e);
|
||||
return 'null';
|
||||
}
|
||||
},
|
||||
|
|
|
@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {}));
|
|||
// Use strict in our context only - users might not want it
|
||||
'use strict';
|
||||
|
||||
var pdfjsVersion = '1.5.337';
|
||||
var pdfjsBuild = '11381cd';
|
||||
var pdfjsVersion = '1.5.345';
|
||||
var pdfjsBuild = '10f9f11';
|
||||
|
||||
var pdfjsFilePath =
|
||||
typeof document !== 'undefined' && document.currentScript ?
|
||||
|
@ -1080,7 +1080,7 @@ function isSpace(ch) {
|
|||
*
|
||||
* @typedef {Object} PromiseCapability
|
||||
* @property {Promise} promise - A promise object.
|
||||
* @property {function} resolve - Fullfills the promise.
|
||||
* @property {function} resolve - Fulfills the promise.
|
||||
* @property {function} reject - Rejects the promise.
|
||||
*/
|
||||
|
||||
|
@ -1103,8 +1103,8 @@ function createPromiseCapability() {
|
|||
/**
|
||||
* Polyfill for Promises:
|
||||
* The following promise implementation tries to generally implement the
|
||||
* Promise/A+ spec. Some notable differences from other promise libaries are:
|
||||
* - There currently isn't a seperate deferred and promise object.
|
||||
* Promise/A+ spec. Some notable differences from other promise libraries are:
|
||||
* - There currently isn't a separate deferred and promise object.
|
||||
* - Unhandled rejections eventually show an error if they aren't handled.
|
||||
*
|
||||
* Based off of the work in:
|
||||
|
@ -3615,7 +3615,7 @@ var createMeshCanvas = (function createMeshCanvasClosure() {
|
|||
// MAX_PATTERN_SIZE is used to avoid OOM situation.
|
||||
var MAX_PATTERN_SIZE = 3000; // 10in @ 300dpi shall be enough
|
||||
// We need to keep transparent border around our pattern for fill():
|
||||
// createPattern with 'no-repeat' will bleed edges accross entire area.
|
||||
// createPattern with 'no-repeat' will bleed edges across entire area.
|
||||
var BORDER_SIZE = 2;
|
||||
|
||||
var offsetX = Math.floor(bounds[0]);
|
||||
|
@ -5688,7 +5688,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||
var currentCtx = this.ctx;
|
||||
// TODO non-isolated groups - according to Rik at adobe non-isolated
|
||||
// group results aren't usually that different and they even have tools
|
||||
// that ignore this setting. Notes from Rik on implmenting:
|
||||
// that ignore this setting. Notes from Rik on implementing:
|
||||
// - When you encounter an transparency group, create a new canvas with
|
||||
// the dimensions of the bbox
|
||||
// - copy the content from the previous canvas to the new canvas
|
||||
|
|
|
@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {}));
|
|||
// Use strict in our context only - users might not want it
|
||||
'use strict';
|
||||
|
||||
var pdfjsVersion = '1.5.337';
|
||||
var pdfjsBuild = '11381cd';
|
||||
var pdfjsVersion = '1.5.345';
|
||||
var pdfjsBuild = '10f9f11';
|
||||
|
||||
var pdfjsFilePath =
|
||||
typeof document !== 'undefined' && document.currentScript ?
|
||||
|
@ -3101,7 +3101,7 @@ function isSpace(ch) {
|
|||
*
|
||||
* @typedef {Object} PromiseCapability
|
||||
* @property {Promise} promise - A promise object.
|
||||
* @property {function} resolve - Fullfills the promise.
|
||||
* @property {function} resolve - Fulfills the promise.
|
||||
* @property {function} reject - Rejects the promise.
|
||||
*/
|
||||
|
||||
|
@ -3124,8 +3124,8 @@ function createPromiseCapability() {
|
|||
/**
|
||||
* Polyfill for Promises:
|
||||
* The following promise implementation tries to generally implement the
|
||||
* Promise/A+ spec. Some notable differences from other promise libaries are:
|
||||
* - There currently isn't a seperate deferred and promise object.
|
||||
* Promise/A+ spec. Some notable differences from other promise libraries are:
|
||||
* - There currently isn't a separate deferred and promise object.
|
||||
* - Unhandled rejections eventually show an error if they aren't handled.
|
||||
*
|
||||
* Based off of the work in:
|
||||
|
@ -4298,7 +4298,7 @@ var CFFParser = (function CFFParserClosure() {
|
|||
break;
|
||||
|
||||
default:
|
||||
error('Unknow encoding format: ' + format + ' in CFF');
|
||||
error('Unknown encoding format: ' + format + ' in CFF');
|
||||
break;
|
||||
}
|
||||
var dataEnd = pos;
|
||||
|
@ -4771,7 +4771,7 @@ var CFFCompiler = (function CFFCompilerClosure() {
|
|||
var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
|
||||
output.add(globalSubrIndex);
|
||||
|
||||
// Now start on the other entries that have no specfic order.
|
||||
// Now start on the other entries that have no specific order.
|
||||
if (cff.encoding && cff.topDict.hasName('Encoding')) {
|
||||
if (cff.encoding.predefined) {
|
||||
topDictTracker.setEntryLocation('Encoding', [cff.encoding.format],
|
||||
|
@ -12533,13 +12533,13 @@ var JpxImage = (function JpxImageClosure() {
|
|||
var subband = resolution.subbands[j];
|
||||
var gainLog2 = SubbandsGainLog2[subband.type];
|
||||
|
||||
// calulate quantization coefficient (Section E.1.1.1)
|
||||
// calculate quantization coefficient (Section E.1.1.1)
|
||||
var delta = (reversible ? 1 :
|
||||
Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048));
|
||||
var mb = (guardBits + epsilon - 1);
|
||||
|
||||
// In the first resolution level, copyCoefficients will fill the
|
||||
// whole array with coefficients. In the succeding passes,
|
||||
// whole array with coefficients. In the succeeding passes,
|
||||
// copyCoefficients will consecutively fill in the values that belong
|
||||
// to the interleaved positions of the HL, LH, and HH coefficients.
|
||||
// The LL coefficients will then be interleaved in Transform.iterate().
|
||||
|
@ -16378,7 +16378,7 @@ exports.getMetrics = getMetrics;
|
|||
var Uint32ArrayView = sharedUtil.Uint32ArrayView;
|
||||
|
||||
var MurmurHash3_64 = (function MurmurHash3_64Closure (seed) {
|
||||
// Workaround for missing math precison in JS.
|
||||
// Workaround for missing math precision in JS.
|
||||
var MASK_HIGH = 0xffff0000;
|
||||
var MASK_LOW = 0xffff;
|
||||
|
||||
|
@ -24781,7 +24781,7 @@ var Lexer = (function LexerClosure() {
|
|||
} else if (ch === 0x2D) { // '-'
|
||||
// ignore minus signs in the middle of numbers to match
|
||||
// Adobe's behavior
|
||||
warn('Badly formated number');
|
||||
warn('Badly formatted number');
|
||||
} else if (ch === 0x45 || ch === 0x65) { // 'E', 'e'
|
||||
// 'E' can be either a scientific notation or the beginning of a new
|
||||
// operator
|
||||
|
@ -25862,9 +25862,11 @@ exports.Type1Parser = Type1Parser;
|
|||
|
||||
var Util = sharedUtil.Util;
|
||||
var assert = sharedUtil.assert;
|
||||
var warn = sharedUtil.warn;
|
||||
var error = sharedUtil.error;
|
||||
var isInt = sharedUtil.isInt;
|
||||
var isString = sharedUtil.isString;
|
||||
var MissingDataException = sharedUtil.MissingDataException;
|
||||
var isName = corePrimitives.isName;
|
||||
var isCmd = corePrimitives.isCmd;
|
||||
var isStream = corePrimitives.isStream;
|
||||
|
@ -26712,41 +26714,49 @@ var CMapFactory = (function CMapFactoryClosure() {
|
|||
var previous;
|
||||
var embededUseCMap;
|
||||
objLoop: while (true) {
|
||||
var obj = lexer.getObj();
|
||||
if (isEOF(obj)) {
|
||||
break;
|
||||
} else if (isName(obj)) {
|
||||
if (obj.name === 'WMode') {
|
||||
parseWMode(cMap, lexer);
|
||||
} else if (obj.name === 'CMapName') {
|
||||
parseCMapName(cMap, lexer);
|
||||
try {
|
||||
var obj = lexer.getObj();
|
||||
if (isEOF(obj)) {
|
||||
break;
|
||||
} else if (isName(obj)) {
|
||||
if (obj.name === 'WMode') {
|
||||
parseWMode(cMap, lexer);
|
||||
} else if (obj.name === 'CMapName') {
|
||||
parseCMapName(cMap, lexer);
|
||||
}
|
||||
previous = obj;
|
||||
} else if (isCmd(obj)) {
|
||||
switch (obj.cmd) {
|
||||
case 'endcmap':
|
||||
break objLoop;
|
||||
case 'usecmap':
|
||||
if (isName(previous)) {
|
||||
embededUseCMap = previous.name;
|
||||
}
|
||||
break;
|
||||
case 'begincodespacerange':
|
||||
parseCodespaceRange(cMap, lexer);
|
||||
break;
|
||||
case 'beginbfchar':
|
||||
parseBfChar(cMap, lexer);
|
||||
break;
|
||||
case 'begincidchar':
|
||||
parseCidChar(cMap, lexer);
|
||||
break;
|
||||
case 'beginbfrange':
|
||||
parseBfRange(cMap, lexer);
|
||||
break;
|
||||
case 'begincidrange':
|
||||
parseCidRange(cMap, lexer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
previous = obj;
|
||||
} else if (isCmd(obj)) {
|
||||
switch (obj.cmd) {
|
||||
case 'endcmap':
|
||||
break objLoop;
|
||||
case 'usecmap':
|
||||
if (isName(previous)) {
|
||||
embededUseCMap = previous.name;
|
||||
}
|
||||
break;
|
||||
case 'begincodespacerange':
|
||||
parseCodespaceRange(cMap, lexer);
|
||||
break;
|
||||
case 'beginbfchar':
|
||||
parseBfChar(cMap, lexer);
|
||||
break;
|
||||
case 'begincidchar':
|
||||
parseCidChar(cMap, lexer);
|
||||
break;
|
||||
case 'beginbfrange':
|
||||
parseBfRange(cMap, lexer);
|
||||
break;
|
||||
case 'begincidrange':
|
||||
parseCidRange(cMap, lexer);
|
||||
break;
|
||||
} catch (ex) {
|
||||
if (ex instanceof MissingDataException) {
|
||||
throw ex;
|
||||
}
|
||||
warn('Invalid cMap data: ' + ex);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26757,9 +26767,8 @@ var CMapFactory = (function CMapFactoryClosure() {
|
|||
}
|
||||
if (useCMap) {
|
||||
return extendCMap(cMap, builtInCMapParams, useCMap);
|
||||
} else {
|
||||
return Promise.resolve(cMap);
|
||||
}
|
||||
return Promise.resolve(cMap);
|
||||
}
|
||||
|
||||
function extendCMap(cMap, builtInCMapParams, useCMap) {
|
||||
|
@ -26821,8 +26830,6 @@ var CMapFactory = (function CMapFactoryClosure() {
|
|||
parseCMap(cMap, lexer, builtInCMapParams, null).then(
|
||||
function (parsedCMap) {
|
||||
resolve(parsedCMap);
|
||||
}).catch(function (e) {
|
||||
reject(new Error({ message: 'Invalid CMap data', error: e }));
|
||||
});
|
||||
} else {
|
||||
reject(new Error('Unable to get cMap at: ' + url));
|
||||
|
@ -27290,6 +27297,7 @@ var ProblematicCharRanges = new Int32Array([
|
|||
0x0600, 0x0780,
|
||||
0x08A0, 0x10A0,
|
||||
0x1780, 0x1800,
|
||||
0x1C00, 0x1C50,
|
||||
// General punctuation chars.
|
||||
0x2000, 0x2010,
|
||||
0x2011, 0x2012,
|
||||
|
@ -29470,7 +29478,7 @@ var Font = (function FontClosure() {
|
|||
// Naming tables
|
||||
builder.addTable('name', createNameTable(fontName));
|
||||
|
||||
// PostScript informations
|
||||
// PostScript information
|
||||
builder.addTable('post', createPostTable(properties));
|
||||
|
||||
return builder.toArray();
|
||||
|
@ -29847,7 +29855,7 @@ var Type1Font = (function Type1FontClosure() {
|
|||
(pfbHeader[3] << 8) | pfbHeader[2];
|
||||
}
|
||||
|
||||
// Get the data block containing glyphs and subrs informations
|
||||
// Get the data block containing glyphs and subrs information
|
||||
var headerBlock = getHeaderBlock(file, headerBlockLength);
|
||||
headerBlockLength = headerBlock.length;
|
||||
var headerBlockParser = new Type1Parser(headerBlock.stream, false,
|
||||
|
@ -30714,7 +30722,7 @@ var PDFFunction = (function PDFFunctionClosure() {
|
|||
|
||||
// clip to domain
|
||||
var v = clip(src[srcOffset], domain[0], domain[1]);
|
||||
// calulate which bound the value is in
|
||||
// calculate which bound the value is in
|
||||
for (var i = 0, ii = bounds.length; i < ii; ++i) {
|
||||
if (v < bounds[i]) {
|
||||
break;
|
||||
|
@ -33157,7 +33165,7 @@ var PDFImage = (function PDFImageClosure() {
|
|||
i += 8;
|
||||
}
|
||||
|
||||
// handle remaing bits
|
||||
// handle remaining bits
|
||||
if (i < loop2End) {
|
||||
buf = buffer[bufferPos++];
|
||||
mask = 128;
|
||||
|
@ -33225,7 +33233,7 @@ var PDFImage = (function PDFImageClosure() {
|
|||
width, height);
|
||||
}
|
||||
} else if (isArray(mask)) {
|
||||
// Color key mask: if any of the compontents are outside the range
|
||||
// Color key mask: if any of the components are outside the range
|
||||
// then they should be painted.
|
||||
alphaBuf = new Uint8Array(width * height);
|
||||
var numComps = this.numComps;
|
||||
|
@ -38058,7 +38066,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
|
||||
// According to the spec if 'FontDescriptor' is declared, 'FirstChar',
|
||||
// 'LastChar' and 'Widths' should exist too, but some PDF encoders seem
|
||||
// to ignore this rule when a variant of a standart font is used.
|
||||
// to ignore this rule when a variant of a standard font is used.
|
||||
// TODO Fill the width array depending on which of the base font this is
|
||||
// a variant.
|
||||
var firstChar = (dict.get('FirstChar') || 0);
|
||||
|
|
|
@ -578,7 +578,7 @@ var PDFBug = (function PDFBugClosure() {
|
|||
} else {
|
||||
panel.textContent = tool.name + ' is disabled. To enable add ' +
|
||||
' "' + tool.id + '" to the pdfBug parameter ' +
|
||||
'and refresh (seperate multiple by commas).';
|
||||
'and refresh (separate multiple by commas).';
|
||||
}
|
||||
buttons.push(panelButton);
|
||||
}
|
||||
|
|
|
@ -5549,7 +5549,7 @@ var PDFPageView = (function PDFPageViewClosure() {
|
|||
}, function(error) {
|
||||
console.error(error);
|
||||
// Tell the printEngine that rendering this canvas/page has failed.
|
||||
// This will make the print proces stop.
|
||||
// This will make the print process stop.
|
||||
if ('abort' in obj) {
|
||||
obj.abort();
|
||||
} else {
|
||||
|
@ -6346,22 +6346,34 @@ var PDFViewer = (function pdfViewer() {
|
|||
return this._pages[index];
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
get currentPageNumber() {
|
||||
return this._currentPageNumber;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {number} val - The page number.
|
||||
*/
|
||||
set currentPageNumber(val) {
|
||||
if (!this.pdfDocument) {
|
||||
this._currentPageNumber = val;
|
||||
return;
|
||||
}
|
||||
this._setCurrentPageNumber(val);
|
||||
// The intent can be to just reset a scroll position and/or scale.
|
||||
this._resetCurrentPageView();
|
||||
this._setCurrentPageNumber(val, /* resetCurrentPageView = */ true);
|
||||
},
|
||||
|
||||
_setCurrentPageNumber: function pdfViewer_setCurrentPageNumber(val) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_setCurrentPageNumber:
|
||||
function pdfViewer_setCurrentPageNumber(val, resetCurrentPageView) {
|
||||
if (this._currentPageNumber === val) {
|
||||
if (resetCurrentPageView) {
|
||||
this._resetCurrentPageView();
|
||||
}
|
||||
return;
|
||||
}
|
||||
var arg;
|
||||
|
@ -6384,6 +6396,10 @@ var PDFViewer = (function pdfViewer() {
|
|||
this._currentPageNumber = val;
|
||||
this.eventBus.dispatch('pagechanging', arg);
|
||||
this.eventBus.dispatch('pagechange', arg);
|
||||
|
||||
if (resetCurrentPageView) {
|
||||
this._resetCurrentPageView();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -6691,6 +6707,7 @@ var PDFViewer = (function pdfViewer() {
|
|||
|
||||
/**
|
||||
* Refreshes page view: scrolls to the current page and updates the scale.
|
||||
* @private
|
||||
*/
|
||||
_resetCurrentPageView: function () {
|
||||
if (this.isInPresentationMode) {
|
||||
|
@ -6715,8 +6732,7 @@ var PDFViewer = (function pdfViewer() {
|
|||
}
|
||||
|
||||
if (this.isInPresentationMode || !dest) {
|
||||
this._setCurrentPageNumber(pageNumber);
|
||||
this._resetCurrentPageView();
|
||||
this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView */ true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче