Bug 1135021 - Update pdf.js to version 1.0.1147. r=bdahl

This commit is contained in:
Ryan VanderMeulen 2015-02-20 14:35:27 -05:00
parent 5568729a32
commit ff199590d8
4 changed files with 83 additions and 65 deletions

View File

@ -1,4 +1,4 @@
This is the pdf.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 1.0.1130
Current extension version is: 1.0.1147

View File

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {};
}
PDFJS.version = '1.0.1130';
PDFJS.build = 'e4f0ae2';
PDFJS.version = '1.0.1147';
PDFJS.build = '6bb0a48';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it
@ -356,6 +356,7 @@ function shadow(obj, prop, value) {
writable: false });
return value;
}
PDFJS.shadow = shadow;
var PasswordResponses = PDFJS.PasswordResponses = {
NEED_PASSWORD: 1,

View File

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {};
}
PDFJS.version = '1.0.1130';
PDFJS.build = 'e4f0ae2';
PDFJS.version = '1.0.1147';
PDFJS.build = '6bb0a48';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it
@ -356,6 +356,7 @@ function shadow(obj, prop, value) {
writable: false });
return value;
}
PDFJS.shadow = shadow;
var PasswordResponses = PDFJS.PasswordResponses = {
NEED_PASSWORD: 1,
@ -4800,7 +4801,7 @@ var LinkAnnotation = (function LinkAnnotationClosure() {
data.annotationType = AnnotationType.LINK;
var action = dict.get('A');
if (action) {
if (action && isDict(action)) {
var linkType = action.get('S').name;
if (linkType === 'URI') {
var url = action.get('URI');
@ -15743,6 +15744,10 @@ var ToUnicodeMap = (function ToUnicodeMapClosure() {
}
},
has: function(i) {
return this._map[i] !== undefined;
},
get: function(i) {
return this._map[i];
},
@ -15772,6 +15777,10 @@ var IdentityToUnicodeMap = (function IdentityToUnicodeMapClosure() {
}
},
has: function (i) {
return this.firstChar <= i && i <= this.lastChar;
},
get: function (i) {
if (this.firstChar <= i && i <= this.lastChar) {
return String.fromCharCode(i);
@ -16204,7 +16213,6 @@ var Font = (function FontClosure() {
var isSymbolic = !!(properties.flags & FontFlags.Symbolic);
var isIdentityUnicode =
properties.toUnicode instanceof IdentityToUnicodeMap;
var isCidFontType2 = (properties.type === 'CIDFontType2');
var newMap = Object.create(null);
var toFontChar = [];
var usedFontCharCodes = [];
@ -16215,17 +16223,11 @@ var Font = (function FontClosure() {
var fontCharCode = originalCharCode;
// First try to map the value to a unicode position if a non identity map
// was created.
if (!isIdentityUnicode) {
if (toUnicode.get(originalCharCode) !== undefined) {
var unicode = toUnicode.get(fontCharCode);
// TODO: Try to map ligatures to the correct spot.
if (unicode.length === 1) {
fontCharCode = unicode.charCodeAt(0);
}
} else if (isCidFontType2) {
// For CIDFontType2, move characters not present in toUnicode
// to the private use area (fixes bug 1028735 and issue 4881).
fontCharCode = nextAvailableFontCharCode;
if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
var unicode = toUnicode.get(fontCharCode);
// TODO: Try to map ligatures to the correct spot.
if (unicode.length === 1) {
fontCharCode = unicode.charCodeAt(0);
}
}
// Try to move control characters, special characters and already mapped
@ -16715,13 +16717,19 @@ var Font = (function FontClosure() {
var offset = font.getInt32() >>> 0;
var useTable = false;
if (platformId === 1 && encodingId === 0) {
if (platformId === 0 && encodingId === 0) {
useTable = true;
// Continue the loop since there still may be a higher priority
// table.
} else if (!isSymbolicFont && platformId === 3 && encodingId === 1) {
} else if (platformId === 1 && encodingId === 0) {
useTable = true;
canBreak = true;
// Continue the loop since there still may be a higher priority
// table.
} else if (platformId === 3 && encodingId === 1) {
useTable = true;
if (!isSymbolicFont) {
canBreak = true;
}
} else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
useTable = true;
canBreak = true;
@ -17066,6 +17074,7 @@ var Font = (function FontClosure() {
var newGlyfData = new Uint8Array(oldGlyfDataLength);
var startOffset = itemDecode(locaData, 0);
var writeOffset = 0;
var missingGlyphData = {};
itemEncode(locaData, 0, writeOffset);
var i, j;
for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
@ -17083,6 +17092,10 @@ var Font = (function FontClosure() {
continue;
}
if (startOffset === endOffset) {
missingGlyphData[i] = true;
}
var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset,
newGlyfData, writeOffset, hintsValid);
writeOffset += newLength;
@ -17099,7 +17112,7 @@ var Font = (function FontClosure() {
itemEncode(locaData, j, simpleGlyph.length);
}
glyf.data = simpleGlyph;
return;
return missingGlyphData;
}
if (dupFirstEntry) {
@ -17116,6 +17129,7 @@ var Font = (function FontClosure() {
} else {
glyf.data = newGlyfData.subarray(0, writeOffset);
}
return missingGlyphData;
}
function readPostScriptTable(post, properties, maxpNumGlyphs) {
@ -17575,11 +17589,13 @@ var Font = (function FontClosure() {
sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
var missingGlyphs = {};
if (isTrueType) {
var isGlyphLocationsLong = int16(tables.head.data[50],
tables.head.data[51]);
sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs,
isGlyphLocationsLong, hintsValid, dupFirstEntry);
missingGlyphs = sanitizeGlyphLocations(tables.loca, tables.glyf,
numGlyphs, isGlyphLocationsLong,
hintsValid, dupFirstEntry);
}
if (!tables.hhea) {
@ -17601,19 +17617,33 @@ var Font = (function FontClosure() {
}
}
var charCodeToGlyphId = [], charCode;
var charCodeToGlyphId = [], charCode, toUnicode = properties.toUnicode;
function hasGlyph(glyphId, charCode) {
if (!missingGlyphs[glyphId]) {
return true;
}
if (charCode >= 0 && toUnicode.has(charCode)) {
return true;
}
return false;
}
if (properties.type === 'CIDFontType2') {
var cidToGidMap = properties.cidToGidMap || [];
var cidToGidMapLength = cidToGidMap.length;
var isCidToGidMapEmpty = cidToGidMap.length === 0;
properties.cMap.forEach(function(charCode, cid) {
assert(cid <= 0xffff, 'Max size of CID is 65,535');
var glyphId = -1;
if (cidToGidMapLength === 0) {
if (isCidToGidMapEmpty) {
glyphId = charCode;
} else if (cidToGidMap[cid] !== undefined) {
glyphId = cidToGidMap[cid];
}
if (glyphId >= 0 && glyphId < numGlyphs) {
if (glyphId >= 0 && glyphId < numGlyphs &&
hasGlyph(glyphId, charCode)) {
charCodeToGlyphId[charCode] = glyphId;
}
});
@ -17673,7 +17703,8 @@ var Font = (function FontClosure() {
var found = false;
for (i = 0; i < cmapMappingsLength; ++i) {
if (cmapMappings[i].charCode === unicodeOrCharCode) {
if (cmapMappings[i].charCode === unicodeOrCharCode &&
hasGlyph(cmapMappings[i].glyphId, unicodeOrCharCode)) {
charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
found = true;
break;
@ -17683,11 +17714,17 @@ var Font = (function FontClosure() {
// Try to map using the post table. There are currently no known
// pdfs that this fixes.
var glyphId = properties.glyphNames.indexOf(glyphName);
if (glyphId > 0) {
if (glyphId > 0 && hasGlyph(glyphId, -1)) {
charCodeToGlyphId[charCode] = glyphId;
}
}
}
} else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
// Default Unicode semantics, use the charcodes as is.
for (i = 0; i < cmapMappingsLength; ++i) {
charCodeToGlyphId[cmapMappings[i].charCode] =
cmapMappings[i].glyphId;
}
} else {
// For (3, 0) cmap tables:
// The charcode key being stored in charCodeToGlyphId is the lower
@ -32715,6 +32752,10 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
var gotEOL = false;
if (this.byteAlign) {
this.inputBits &= ~7;
}
if (!this.eoblock && this.row === this.rows - 1) {
this.eof = true;
} else {
@ -32738,10 +32779,6 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
}
}
if (this.byteAlign && !gotEOL) {
this.inputBits &= ~7;
}
if (!this.eof && this.encoding > 0) {
this.nextLine2D = !this.lookBits(1);
this.eatBits(1);

View File

@ -5481,12 +5481,8 @@ var PDFViewerApplication = {
get supportsPrinting() {
var canvas = document.createElement('canvas');
var value = 'mozPrintCallback' in canvas;
// shadow
Object.defineProperty(this, 'supportsPrinting', { value: value,
enumerable: true,
configurable: true,
writable: false });
return value;
return PDFJS.shadow(this, 'supportsPrinting', value);
},
get supportsFullscreen() {
@ -5501,50 +5497,34 @@ var PDFViewerApplication = {
support = false;
}
Object.defineProperty(this, 'supportsFullscreen', { value: support,
enumerable: true,
configurable: true,
writable: false });
return support;
return PDFJS.shadow(this, 'supportsFullscreen', support);
},
get supportsIntegratedFind() {
var support = false;
support = FirefoxCom.requestSync('supportsIntegratedFind');
Object.defineProperty(this, 'supportsIntegratedFind', { value: support,
enumerable: true,
configurable: true,
writable: false });
return support;
return PDFJS.shadow(this, 'supportsIntegratedFind', support);
},
get supportsDocumentFonts() {
var support = true;
support = FirefoxCom.requestSync('supportsDocumentFonts');
Object.defineProperty(this, 'supportsDocumentFonts', { value: support,
enumerable: true,
configurable: true,
writable: false });
return support;
return PDFJS.shadow(this, 'supportsDocumentFonts', support);
},
get supportsDocumentColors() {
var support = true;
support = FirefoxCom.requestSync('supportsDocumentColors');
Object.defineProperty(this, 'supportsDocumentColors', { value: support,
enumerable: true,
configurable: true,
writable: false });
return support;
return PDFJS.shadow(this, 'supportsDocumentColors', support);
},
get loadingBar() {
var bar = new ProgressBar('#loadingBar', {});
Object.defineProperty(this, 'loadingBar', { value: bar,
enumerable: true,
configurable: true,
writable: false });
return bar;
return PDFJS.shadow(this, 'loadingBar', bar);
},
initPassiveLoading: function pdfViewInitPassiveLoading() {