1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Merge pull request #6915 from yurydelendik/lookuptables

Refactor lookup hash tables/objects
This commit is contained in:
Yury Delendik 2016-01-28 15:01:06 -06:00
commit 825a2225ab
23 changed files with 9970 additions and 9667 deletions

View file

@ -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.');
@ -358,12 +355,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;
}
@ -392,9 +386,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];
@ -595,7 +586,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;
@ -1232,7 +1223,7 @@ var NameOrNumberTree = (function NameOrNumberTreeClosure() {
NameOrNumberTree.prototype = {
getAll: function NameOrNumberTree_getAll() {
var dict = {};
var dict = Object.create(null);
if (!this.root) {
return dict;
}