Replaces literal {} created lookup tables with Object.create
This commit is contained in:
parent
d6adf84159
commit
2edf2792dc
@ -313,9 +313,9 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
|
||||
|
||||
this.currRequestId = 0;
|
||||
|
||||
this.chunksNeededByRequest = {};
|
||||
this.requestsByChunk = {};
|
||||
this.promisesByRequest = {};
|
||||
this.chunksNeededByRequest = Object.create(null);
|
||||
this.requestsByChunk = Object.create(null);
|
||||
this.promisesByRequest = Object.create(null);
|
||||
this.progressiveDataLength = 0;
|
||||
|
||||
this._loadedStreamCapability = createPromiseCapability();
|
||||
@ -341,9 +341,9 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
|
||||
_requestChunks: function ChunkedStreamManager_requestChunks(chunks) {
|
||||
var requestId = this.currRequestId++;
|
||||
|
||||
var chunksNeeded;
|
||||
var i, ii;
|
||||
this.chunksNeededByRequest[requestId] = chunksNeeded = {};
|
||||
var chunksNeeded = Object.create(null);
|
||||
this.chunksNeededByRequest[requestId] = chunksNeeded;
|
||||
for (i = 0, ii = chunks.length; i < ii; i++) {
|
||||
if (!this.stream.hasChunk(chunks[i])) {
|
||||
chunksNeeded[chunks[i]] = true;
|
||||
|
@ -731,7 +731,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
|
||||
var self = this;
|
||||
var xref = this.xref;
|
||||
var imageCache = {};
|
||||
var imageCache = Object.create(null);
|
||||
|
||||
assert(operatorList);
|
||||
|
||||
@ -1054,7 +1054,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
|
||||
// The xobj is parsed iff it's needed, e.g. if there is a `DO` cmd.
|
||||
var xobjs = null;
|
||||
var xobjsCache = {};
|
||||
var xobjsCache = Object.create(null);
|
||||
|
||||
var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
|
||||
|
||||
@ -2093,7 +2093,7 @@ var TranslatedFont = (function TranslatedFontClosure() {
|
||||
var charProcs = this.dict.get('CharProcs').getAll();
|
||||
var fontResources = this.dict.get('Resources') || resources;
|
||||
var charProcKeys = Object.keys(charProcs);
|
||||
var charProcOperatorList = {};
|
||||
var charProcOperatorList = Object.create(null);
|
||||
for (var i = 0, n = charProcKeys.length; i < n; ++i) {
|
||||
loadCharProcsPromise = loadCharProcsPromise.then(function (key) {
|
||||
var glyphStream = charProcs[key];
|
||||
@ -2147,7 +2147,7 @@ var OperatorList = (function OperatorListClosure() {
|
||||
this.messageHandler = messageHandler;
|
||||
this.fnArray = [];
|
||||
this.argsArray = [];
|
||||
this.dependencies = {};
|
||||
this.dependencies = Object.create(null);
|
||||
this._totalLength = 0;
|
||||
this.pageIndex = pageIndex;
|
||||
this.intent = intent;
|
||||
@ -2227,7 +2227,7 @@ var OperatorList = (function OperatorListClosure() {
|
||||
pageIndex: this.pageIndex,
|
||||
intent: this.intent
|
||||
}, transfers);
|
||||
this.dependencies = {};
|
||||
this.dependencies = Object.create(null);
|
||||
this.fnArray.length = 0;
|
||||
this.argsArray.length = 0;
|
||||
}
|
||||
|
@ -609,7 +609,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
||||
var noop = '';
|
||||
|
||||
function CompiledFont(fontMatrix) {
|
||||
this.compiledGlyphs = {};
|
||||
this.compiledGlyphs = Object.create(null);
|
||||
this.fontMatrix = fontMatrix;
|
||||
}
|
||||
CompiledFont.prototype = {
|
||||
|
@ -469,7 +469,7 @@ var Font = (function FontClosure() {
|
||||
this.isType3Font = properties.isType3Font;
|
||||
this.sizes = [];
|
||||
|
||||
this.glyphCache = {};
|
||||
this.glyphCache = Object.create(null);
|
||||
|
||||
var names = name.split('+');
|
||||
names = names.length > 1 ? names[1] : names[0];
|
||||
@ -1218,6 +1218,7 @@ var Font = (function FontClosure() {
|
||||
},
|
||||
|
||||
exportData: function Font_exportData() {
|
||||
// TODO remove enumerating of the properties, e.g. hardcode exact names.
|
||||
var data = {};
|
||||
for (var i in this) {
|
||||
if (this.hasOwnProperty(i)) {
|
||||
@ -1668,7 +1669,7 @@ var Font = (function FontClosure() {
|
||||
var newGlyfData = new Uint8Array(oldGlyfDataLength);
|
||||
var startOffset = itemDecode(locaData, 0);
|
||||
var writeOffset = 0;
|
||||
var missingGlyphData = {};
|
||||
var missingGlyphData = Object.create(null);
|
||||
itemEncode(locaData, 0, writeOffset);
|
||||
var i, j;
|
||||
for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
|
||||
@ -2100,8 +2101,16 @@ var Font = (function FontClosure() {
|
||||
var numTables = header.numTables;
|
||||
var cff, cffFile;
|
||||
|
||||
var tables = { 'OS/2': null, cmap: null, head: null, hhea: null,
|
||||
hmtx: null, maxp: null, name: null, post: null };
|
||||
var tables = Object.create(null);
|
||||
tables['OS/2'] = null;
|
||||
tables['cmap'] = null;
|
||||
tables['head'] = null;
|
||||
tables['hhea'] = null;
|
||||
tables['hmtx'] = null;
|
||||
tables['maxp'] = null;
|
||||
tables['name'] = null;
|
||||
tables['post'] = null;
|
||||
|
||||
var table;
|
||||
for (var i = 0; i < numTables; i++) {
|
||||
table = readTableEntry(font);
|
||||
@ -2118,7 +2127,8 @@ var Font = (function FontClosure() {
|
||||
if (!isTrueType) {
|
||||
// OpenType font
|
||||
if ((header.version === 'OTTO' && properties.type !== 'CIDFontType2') ||
|
||||
!tables.head || !tables.hhea || !tables.maxp || !tables.post) {
|
||||
!tables['head'] || !tables['hhea'] || !tables['maxp'] ||
|
||||
!tables['post']) {
|
||||
// no major tables: throwing everything at CFFFont
|
||||
cffFile = new Stream(tables['CFF '].data);
|
||||
cff = new CFFFont(cffFile, properties);
|
||||
@ -2128,20 +2138,20 @@ var Font = (function FontClosure() {
|
||||
return this.convert(name, cff, properties);
|
||||
}
|
||||
|
||||
delete tables.glyf;
|
||||
delete tables.loca;
|
||||
delete tables.fpgm;
|
||||
delete tables.prep;
|
||||
delete tables['glyf'];
|
||||
delete tables['loca'];
|
||||
delete tables['fpgm'];
|
||||
delete tables['prep'];
|
||||
delete tables['cvt '];
|
||||
this.isOpenType = true;
|
||||
} else {
|
||||
if (!tables.loca) {
|
||||
if (!tables['loca']) {
|
||||
error('Required "loca" table is not found');
|
||||
}
|
||||
if (!tables.glyf) {
|
||||
if (!tables['glyf']) {
|
||||
warn('Required "glyf" table is not found -- trying to recover.');
|
||||
// Note: We use `sanitizeGlyphLocations` to add dummy glyf data below.
|
||||
tables.glyf = {
|
||||
tables['glyf'] = {
|
||||
tag: 'glyf',
|
||||
data: new Uint8Array(0),
|
||||
};
|
||||
@ -2149,21 +2159,21 @@ var Font = (function FontClosure() {
|
||||
this.isOpenType = false;
|
||||
}
|
||||
|
||||
if (!tables.maxp) {
|
||||
if (!tables['maxp']) {
|
||||
error('Required "maxp" table is not found');
|
||||
}
|
||||
|
||||
font.pos = (font.start || 0) + tables.maxp.offset;
|
||||
font.pos = (font.start || 0) + tables['maxp'].offset;
|
||||
var version = font.getInt32();
|
||||
var numGlyphs = font.getUint16();
|
||||
var maxFunctionDefs = 0;
|
||||
if (version >= 0x00010000 && tables.maxp.length >= 22) {
|
||||
if (version >= 0x00010000 && tables['maxp'].length >= 22) {
|
||||
// maxZones can be invalid
|
||||
font.pos += 8;
|
||||
var maxZones = font.getUint16();
|
||||
if (maxZones > 2) { // reset to 2 if font has invalid maxZones
|
||||
tables.maxp.data[14] = 0;
|
||||
tables.maxp.data[15] = 2;
|
||||
tables['maxp'].data[14] = 0;
|
||||
tables['maxp'].data[15] = 2;
|
||||
}
|
||||
font.pos += 4;
|
||||
maxFunctionDefs = font.getUint16();
|
||||
@ -2175,56 +2185,57 @@ var Font = (function FontClosure() {
|
||||
// oracle's defect (see 3427), duplicating first entry
|
||||
dupFirstEntry = true;
|
||||
numGlyphs++;
|
||||
tables.maxp.data[4] = numGlyphs >> 8;
|
||||
tables.maxp.data[5] = numGlyphs & 255;
|
||||
tables['maxp'].data[4] = numGlyphs >> 8;
|
||||
tables['maxp'].data[5] = numGlyphs & 255;
|
||||
}
|
||||
|
||||
var hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep,
|
||||
var hintsValid = sanitizeTTPrograms(tables['fpgm'], tables['prep'],
|
||||
tables['cvt '], maxFunctionDefs);
|
||||
if (!hintsValid) {
|
||||
delete tables.fpgm;
|
||||
delete tables.prep;
|
||||
delete tables['fpgm'];
|
||||
delete tables['prep'];
|
||||
delete tables['cvt '];
|
||||
}
|
||||
|
||||
// Ensure the hmtx table contains the advance width and
|
||||
// sidebearings information for numGlyphs in the maxp table
|
||||
sanitizeMetrics(font, tables.hhea, tables.hmtx, numGlyphs);
|
||||
sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphs);
|
||||
|
||||
if (!tables.head) {
|
||||
if (!tables['head']) {
|
||||
error('Required "head" table is not found');
|
||||
}
|
||||
|
||||
sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
|
||||
sanitizeHead(tables['head'], numGlyphs,
|
||||
isTrueType ? tables['loca'].length : 0);
|
||||
|
||||
var missingGlyphs = {};
|
||||
var missingGlyphs = Object.create(null);
|
||||
if (isTrueType) {
|
||||
var isGlyphLocationsLong = int16(tables.head.data[50],
|
||||
tables.head.data[51]);
|
||||
missingGlyphs = sanitizeGlyphLocations(tables.loca, tables.glyf,
|
||||
var isGlyphLocationsLong = int16(tables['head'].data[50],
|
||||
tables['head'].data[51]);
|
||||
missingGlyphs = sanitizeGlyphLocations(tables['loca'], tables['glyf'],
|
||||
numGlyphs, isGlyphLocationsLong,
|
||||
hintsValid, dupFirstEntry);
|
||||
}
|
||||
|
||||
if (!tables.hhea) {
|
||||
if (!tables['hhea']) {
|
||||
error('Required "hhea" table is not found');
|
||||
}
|
||||
|
||||
// Sanitizer reduces the glyph advanceWidth to the maxAdvanceWidth
|
||||
// Sometimes it's 0. That needs to be fixed
|
||||
if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
|
||||
tables.hhea.data[10] = 0xFF;
|
||||
tables.hhea.data[11] = 0xFF;
|
||||
if (tables['hhea'].data[10] === 0 && tables['hhea'].data[11] === 0) {
|
||||
tables['hhea'].data[10] = 0xFF;
|
||||
tables['hhea'].data[11] = 0xFF;
|
||||
}
|
||||
|
||||
// Extract some more font properties from the OpenType head and
|
||||
// hhea tables; yMin and descent value are always negative.
|
||||
var metricsOverride = {
|
||||
unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
|
||||
yMax: int16(tables.head.data[42], tables.head.data[43]),
|
||||
yMin: int16(tables.head.data[38], tables.head.data[39]) - 0x10000,
|
||||
ascent: int16(tables.hhea.data[4], tables.hhea.data[5]),
|
||||
descent: int16(tables.hhea.data[6], tables.hhea.data[7]) - 0x10000
|
||||
unitsPerEm: int16(tables['head'].data[18], tables['head'].data[19]),
|
||||
yMax: int16(tables['head'].data[42], tables['head'].data[43]),
|
||||
yMin: int16(tables['head'].data[38], tables['head'].data[39]) - 0x10000,
|
||||
ascent: int16(tables['hhea'].data[4], tables['hhea'].data[5]),
|
||||
descent: int16(tables['hhea'].data[6], tables['hhea'].data[7]) - 0x10000
|
||||
};
|
||||
|
||||
// PDF FontDescriptor metrics lie -- using data from actual font.
|
||||
@ -2232,10 +2243,10 @@ var Font = (function FontClosure() {
|
||||
this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
|
||||
|
||||
// The 'post' table has glyphs names.
|
||||
if (tables.post) {
|
||||
var valid = readPostScriptTable(tables.post, properties, numGlyphs);
|
||||
if (tables['post']) {
|
||||
var valid = readPostScriptTable(tables['post'], properties, numGlyphs);
|
||||
if (!valid) {
|
||||
tables.post = null;
|
||||
tables['post'] = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2287,7 +2298,7 @@ var Font = (function FontClosure() {
|
||||
var hasEncoding =
|
||||
properties.differences.length > 0 || !!properties.baseEncodingName;
|
||||
var cmapTable =
|
||||
readCmapTable(tables.cmap, font, this.isSymbolicFont, hasEncoding);
|
||||
readCmapTable(tables['cmap'], font, this.isSymbolicFont, hasEncoding);
|
||||
var cmapPlatformId = cmapTable.platformId;
|
||||
var cmapEncodingId = cmapTable.encodingId;
|
||||
var cmapMappings = cmapTable.mappings;
|
||||
@ -2394,7 +2405,7 @@ var Font = (function FontClosure() {
|
||||
// Converting glyphs and ids into font's cmap table
|
||||
var newMapping = adjustMapping(charCodeToGlyphId, properties);
|
||||
this.toFontChar = newMapping.toFontChar;
|
||||
tables.cmap = {
|
||||
tables['cmap'] = {
|
||||
tag: 'cmap',
|
||||
data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)
|
||||
};
|
||||
@ -2408,8 +2419,8 @@ var Font = (function FontClosure() {
|
||||
}
|
||||
|
||||
// Rewrite the 'post' table if needed
|
||||
if (!tables.post) {
|
||||
tables.post = {
|
||||
if (!tables['post']) {
|
||||
tables['post'] = {
|
||||
tag: 'post',
|
||||
data: createPostTable(properties)
|
||||
};
|
||||
@ -2429,15 +2440,15 @@ var Font = (function FontClosure() {
|
||||
}
|
||||
|
||||
// Re-creating 'name' table
|
||||
if (!tables.name) {
|
||||
tables.name = {
|
||||
if (!tables['name']) {
|
||||
tables['name'] = {
|
||||
tag: 'name',
|
||||
data: createNameTable(this.name)
|
||||
};
|
||||
} else {
|
||||
// ... using existing 'name' table as prototype
|
||||
var namePrototype = readNameTable(tables.name);
|
||||
tables.name.data = createNameTable(name, namePrototype);
|
||||
var namePrototype = readNameTable(tables['name']);
|
||||
tables['name'].data = createNameTable(name, namePrototype);
|
||||
}
|
||||
|
||||
var builder = new OpenTypeFileBuilder(header.version);
|
||||
@ -2855,7 +2866,7 @@ var Font = (function FontClosure() {
|
||||
if (this.cMap) {
|
||||
// composite fonts have multi-byte strings convert the string from
|
||||
// single-byte to multi-byte
|
||||
var c = {};
|
||||
var c = Object.create(null);
|
||||
while (i < chars.length) {
|
||||
this.cMap.readCharCode(chars, i, c);
|
||||
charcode = c.charcode;
|
||||
@ -3442,13 +3453,13 @@ var Type1Parser = (function Type1ParserClosure() {
|
||||
var stream = this.stream;
|
||||
|
||||
var subrs = [], charstrings = [];
|
||||
var privateData = Object.create(null);
|
||||
privateData['lenIV'] = 4;
|
||||
var program = {
|
||||
subrs: [],
|
||||
charstrings: [],
|
||||
properties: {
|
||||
'privateData': {
|
||||
'lenIV': 4
|
||||
}
|
||||
'privateData': privateData
|
||||
}
|
||||
};
|
||||
var token, length, data, lenIV, encoded;
|
||||
@ -3770,7 +3781,7 @@ Type1Font.prototype = {
|
||||
}
|
||||
var encoding = properties.builtInEncoding;
|
||||
if (encoding) {
|
||||
var builtInEncoding = {};
|
||||
var builtInEncoding = Object.create(null);
|
||||
for (var charCode in encoding) {
|
||||
glyphId = glyphNames.indexOf(encoding[charCode]);
|
||||
if (glyphId >= 0) {
|
||||
@ -3904,7 +3915,7 @@ Type1Font.prototype = {
|
||||
];
|
||||
for (i = 0, ii = fields.length; i < ii; i++) {
|
||||
var field = fields[i];
|
||||
if (!properties.privateData.hasOwnProperty(field)) {
|
||||
if (!(field in properties.privateData)) {
|
||||
continue;
|
||||
}
|
||||
var value = properties.privateData[field];
|
||||
@ -4655,7 +4666,7 @@ var CFFParser = (function CFFParserClosure() {
|
||||
properties,
|
||||
strings,
|
||||
charset) {
|
||||
var encoding = {};
|
||||
var encoding = Object.create(null);
|
||||
var bytes = this.bytes;
|
||||
var predefined = false;
|
||||
var hasSupplement = false;
|
||||
@ -4851,7 +4862,7 @@ var CFFDict = (function CFFDictClosure() {
|
||||
this.opcodes = tables.opcodes;
|
||||
this.order = tables.order;
|
||||
this.strings = strings;
|
||||
this.values = {};
|
||||
this.values = Object.create(null);
|
||||
}
|
||||
CFFDict.prototype = {
|
||||
// value should always be an array
|
||||
@ -5048,7 +5059,7 @@ var CFFFDSelect = (function CFFFDSelectClosure() {
|
||||
// filling in that offset once it's known.
|
||||
var CFFOffsetTracker = (function CFFOffsetTrackerClosure() {
|
||||
function CFFOffsetTracker() {
|
||||
this.offsets = {};
|
||||
this.offsets = Object.create(null);
|
||||
}
|
||||
CFFOffsetTracker.prototype = {
|
||||
isTracking: function CFFOffsetTracker_isTracking(key) {
|
||||
|
@ -434,7 +434,7 @@ var PDFFunction = (function PDFFunctionClosure() {
|
||||
var evaluator = new PostScriptEvaluator(code);
|
||||
// Cache the values for a big speed up, the cache size is limited though
|
||||
// since the number of possible values can be huge from a PS function.
|
||||
var cache = {};
|
||||
var cache = Object.create(null);
|
||||
// The MAX_CACHE_SIZE is set to ~4x the maximum number of distinct values
|
||||
// seen in our tests.
|
||||
var MAX_CACHE_SIZE = 2048 * 4;
|
||||
|
@ -52,8 +52,8 @@ var NetworkManager = (function NetworkManagerClosure() {
|
||||
};
|
||||
|
||||
this.currXhrId = 0;
|
||||
this.pendingRequests = {};
|
||||
this.loadedRequests = {};
|
||||
this.pendingRequests = Object.create(null);
|
||||
this.loadedRequests = Object.create(null);
|
||||
}
|
||||
|
||||
function getArrayBuffer(xhr) {
|
||||
|
@ -229,9 +229,6 @@ var Catalog = (function CatalogClosure() {
|
||||
var nameTree = new NameTree(nameTreeRef, xref);
|
||||
var names = nameTree.getAll();
|
||||
for (var name in names) {
|
||||
if (!names.hasOwnProperty(name)) {
|
||||
continue;
|
||||
}
|
||||
dests[name] = fetchDestination(names[name]);
|
||||
}
|
||||
}
|
||||
@ -291,7 +288,7 @@ var Catalog = (function CatalogClosure() {
|
||||
var currentLabel = '', currentIndex = 1;
|
||||
|
||||
for (var i = 0, ii = this.numPages; i < ii; i++) {
|
||||
if (nums.hasOwnProperty(i)) {
|
||||
if (i in nums) {
|
||||
var labelDict = nums[i];
|
||||
assert(isDict(labelDict), 'The PageLabel is not a dictionary.');
|
||||
|
||||
@ -365,12 +362,9 @@ var Catalog = (function CatalogClosure() {
|
||||
var nameTree = new NameTree(nameTreeRef, xref);
|
||||
var names = nameTree.getAll();
|
||||
for (var name in names) {
|
||||
if (!names.hasOwnProperty(name)) {
|
||||
continue;
|
||||
}
|
||||
var fs = new FileSpec(names[name], xref);
|
||||
if (!attachments) {
|
||||
attachments = {};
|
||||
attachments = Object.create(null);
|
||||
}
|
||||
attachments[stringToPDFString(name)] = fs.serializable;
|
||||
}
|
||||
@ -399,9 +393,6 @@ var Catalog = (function CatalogClosure() {
|
||||
var nameTree = new NameTree(obj.getRaw('JavaScript'), xref);
|
||||
var names = nameTree.getAll();
|
||||
for (var name in names) {
|
||||
if (!names.hasOwnProperty(name)) {
|
||||
continue;
|
||||
}
|
||||
// We don't really use the JavaScript right now. This code is
|
||||
// defensive so we don't cause errors on document load.
|
||||
var jsDict = names[name];
|
||||
@ -602,7 +593,7 @@ var XRef = (function XRefClosure() {
|
||||
function XRef(stream, password) {
|
||||
this.stream = stream;
|
||||
this.entries = [];
|
||||
this.xrefstms = {};
|
||||
this.xrefstms = Object.create(null);
|
||||
// prepare the XRef cache
|
||||
this.cache = [];
|
||||
this.password = password;
|
||||
@ -1239,7 +1230,7 @@ var NameOrNumberTree = (function NameOrNumberTreeClosure() {
|
||||
|
||||
NameOrNumberTree.prototype = {
|
||||
getAll: function NameOrNumberTree_getAll() {
|
||||
var dict = {};
|
||||
var dict = Object.create(null);
|
||||
if (!this.root) {
|
||||
return dict;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ var Parser = (function ParserClosure() {
|
||||
this.lexer = lexer;
|
||||
this.allowStreams = allowStreams;
|
||||
this.xref = xref;
|
||||
this.imageCache = {};
|
||||
this.imageCache = Object.create(null);
|
||||
this.refill();
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ var Name = (function NameClosure() {
|
||||
|
||||
Name.prototype = {};
|
||||
|
||||
var nameCache = {};
|
||||
var nameCache = Object.create(null);
|
||||
|
||||
Name.get = function Name_get(name) {
|
||||
var nameValue = nameCache[name];
|
||||
@ -52,7 +52,7 @@ var Cmd = (function CmdClosure() {
|
||||
|
||||
Cmd.prototype = {};
|
||||
|
||||
var cmdCache = {};
|
||||
var cmdCache = Object.create(null);
|
||||
|
||||
Cmd.get = function Cmd_get(cmd) {
|
||||
var cmdValue = cmdCache[cmd];
|
||||
@ -281,7 +281,7 @@ var Ref = (function RefClosure() {
|
||||
// This structure stores only one instance of the reference.
|
||||
var RefSet = (function RefSetClosure() {
|
||||
function RefSet() {
|
||||
this.dict = {};
|
||||
this.dict = Object.create(null);
|
||||
}
|
||||
|
||||
RefSet.prototype = {
|
||||
|
@ -126,7 +126,7 @@ var PostScriptToken = (function PostScriptTokenClosure() {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
var opCache = {};
|
||||
var opCache = Object.create(null);
|
||||
|
||||
PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
|
||||
var opValue = opCache[op];
|
||||
|
@ -873,7 +873,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
||||
this.objs = new PDFObjects();
|
||||
this.cleanupAfterRender = false;
|
||||
this.pendingCleanup = false;
|
||||
this.intentStates = {};
|
||||
this.intentStates = Object.create(null);
|
||||
this.destroyed = false;
|
||||
}
|
||||
PDFPageProxy.prototype = /** @lends PDFPageProxy.prototype */ {
|
||||
@ -948,7 +948,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
||||
var renderingIntent = (params.intent === 'print' ? 'print' : 'display');
|
||||
|
||||
if (!this.intentStates[renderingIntent]) {
|
||||
this.intentStates[renderingIntent] = {};
|
||||
this.intentStates[renderingIntent] = Object.create(null);
|
||||
}
|
||||
var intentState = this.intentStates[renderingIntent];
|
||||
|
||||
@ -1040,7 +1040,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
||||
|
||||
var renderingIntent = 'oplist';
|
||||
if (!this.intentStates[renderingIntent]) {
|
||||
this.intentStates[renderingIntent] = {};
|
||||
this.intentStates[renderingIntent] = Object.create(null);
|
||||
}
|
||||
var intentState = this.intentStates[renderingIntent];
|
||||
|
||||
@ -1871,7 +1871,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
|
||||
*/
|
||||
var PDFObjects = (function PDFObjectsClosure() {
|
||||
function PDFObjects() {
|
||||
this.objs = {};
|
||||
this.objs = Object.create(null);
|
||||
}
|
||||
|
||||
PDFObjects.prototype = {
|
||||
@ -1962,7 +1962,7 @@ var PDFObjects = (function PDFObjectsClosure() {
|
||||
},
|
||||
|
||||
clear: function PDFObjects_clear() {
|
||||
this.objs = {};
|
||||
this.objs = Object.create(null);
|
||||
}
|
||||
};
|
||||
return PDFObjects;
|
||||
|
@ -39,7 +39,7 @@ var CustomStyle = (function CustomStyleClosure() {
|
||||
// in some versions of IE9 it is critical that ms appear in this list
|
||||
// before Moz
|
||||
var prefixes = ['ms', 'Moz', 'Webkit', 'O'];
|
||||
var _cache = {};
|
||||
var _cache = Object.create(null);
|
||||
|
||||
function CustomStyle() {}
|
||||
|
||||
|
@ -340,7 +340,7 @@ Object.defineProperty(FontLoader, 'isSyncFontLoadingSupported', {
|
||||
|
||||
var FontFaceObject = (function FontFaceObjectClosure() {
|
||||
function FontFaceObject(translatedData) {
|
||||
this.compiledGlyphs = {};
|
||||
this.compiledGlyphs = Object.create(null);
|
||||
// importing translated data
|
||||
for (var i in translatedData) {
|
||||
this[i] = translatedData[i];
|
||||
|
@ -58,7 +58,7 @@ var Metadata = PDFJS.Metadata = (function MetadataClosure() {
|
||||
}
|
||||
|
||||
this.metaDocument = meta;
|
||||
this.metadata = {};
|
||||
this.metadata = Object.create(null);
|
||||
this.parse();
|
||||
}
|
||||
|
||||
|
@ -385,7 +385,7 @@ var SVGGraphics = (function SVGGraphicsClosure() {
|
||||
this.pendingEOFill = false;
|
||||
|
||||
this.embedFonts = false;
|
||||
this.embeddedFonts = {};
|
||||
this.embeddedFonts = Object.create(null);
|
||||
this.cssStyle = null;
|
||||
}
|
||||
|
||||
|
@ -1466,7 +1466,7 @@ var StatTimer = (function StatTimerClosure() {
|
||||
return str;
|
||||
}
|
||||
function StatTimer() {
|
||||
this.started = {};
|
||||
this.started = Object.create(null);
|
||||
this.times = [];
|
||||
this.enabled = true;
|
||||
}
|
||||
@ -1560,8 +1560,8 @@ function MessageHandler(sourceName, targetName, comObj) {
|
||||
this.comObj = comObj;
|
||||
this.callbackIndex = 1;
|
||||
this.postMessageTransfers = true;
|
||||
var callbacksCapabilities = this.callbacksCapabilities = {};
|
||||
var ah = this.actionHandler = {};
|
||||
var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
|
||||
var ah = this.actionHandler = Object.create(null);
|
||||
|
||||
this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) {
|
||||
var data = event.data;
|
||||
|
@ -165,7 +165,7 @@ var StepperManager = (function StepperManagerClosure() {
|
||||
var stepperDiv = null;
|
||||
var stepperControls = null;
|
||||
var stepperChooser = null;
|
||||
var breakPoints = {};
|
||||
var breakPoints = Object.create(null);
|
||||
return {
|
||||
// Properties/functions needed by PDFBug.
|
||||
id: 'Stepper',
|
||||
|
@ -34,7 +34,7 @@ var PDFFindController = (function PDFFindControllerClosure() {
|
||||
function PDFFindController(options) {
|
||||
this.startedTextExtraction = false;
|
||||
this.extractTextPromises = [];
|
||||
this.pendingFindMatches = {};
|
||||
this.pendingFindMatches = Object.create(null);
|
||||
this.active = false; // If active, find results will be highlighted.
|
||||
this.pageContents = []; // Stores the text for each page.
|
||||
this.pageMatches = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user