From f29f15854532c0937de5d9e8910d7658b0fe87d0 Mon Sep 17 00:00:00 2001 From: Pdf Bot Date: Sat, 30 May 2015 14:36:15 +0100 Subject: [PATCH] PDF.js version 1.1.179 --- bower.json | 2 +- build/pdf.combined.js | 64 +++++++++++++++++++++++++++++++------------ build/pdf.js | 4 +-- build/pdf.worker.js | 64 +++++++++++++++++++++++++++++++------------ package.json | 2 +- 5 files changed, 98 insertions(+), 38 deletions(-) diff --git a/bower.json b/bower.json index e03d8f870..652fed72e 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.1.177", + "version": "1.1.179", "main": [ "build/pdf.js", "build/pdf.worker.js" diff --git a/build/pdf.combined.js b/build/pdf.combined.js index bbc1e5ac3..70f986d1e 100644 --- a/build/pdf.combined.js +++ b/build/pdf.combined.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.1.177'; -PDFJS.build = 'd3fa65e'; +PDFJS.version = '1.1.179'; +PDFJS.build = '5c3c516'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -8964,17 +8964,33 @@ var Page = (function PageClosure() { return this.pageDict.get(key); }, - getInheritedPageProp: function Page_inheritPageProp(key) { - var dict = this.pageDict; - var value = dict.get(key); - while (value === undefined) { - dict = dict.get('Parent'); - if (!dict) { + getInheritedPageProp: function Page_getInheritedPageProp(key) { + var dict = this.pageDict, valueArray = null, loopCount = 0; + var MAX_LOOP_COUNT = 100; + // Always walk up the entire parent chain, to be able to find + // e.g. \Resources placed on multiple levels of the tree. + while (dict) { + var value = dict.get(key); + if (value) { + if (!valueArray) { + valueArray = []; + } + valueArray.push(value); + } + if (++loopCount > MAX_LOOP_COUNT) { + warn('Page_getInheritedPageProp: maximum loop count exceeded.'); break; } - value = dict.get(key); + dict = dict.get('Parent'); } - return value; + if (!valueArray) { + return Dict.empty; + } + if (valueArray.length === 1 || !isDict(valueArray[0]) || + loopCount > MAX_LOOP_COUNT) { + return valueArray[0]; + } + return Dict.merge(this.xref, valueArray); }, get content() { @@ -8982,14 +8998,10 @@ var Page = (function PageClosure() { }, get resources() { - var value = this.getInheritedPageProp('Resources'); // For robustness: The spec states that a \Resources entry has to be - // present, but can be empty. Some document omit it still. In this case - // return an empty dictionary: - if (value === undefined) { - value = Dict.empty; - } - return shadow(this, 'resources', value); + // present, but can be empty. Some document omit it still, in this case + // we return an empty dictionary. + return shadow(this, 'resources', this.getInheritedPageProp('Resources')); }, get mediaBox() { @@ -9647,6 +9659,24 @@ var Dict = (function DictClosure() { Dict.empty = new Dict(null); + Dict.merge = function Dict_merge(xref, dictArray) { + var mergedDict = new Dict(xref); + + for (var i = 0, ii = dictArray.length; i < ii; i++) { + var dict = dictArray[i]; + if (!isDict(dict)) { + continue; + } + for (var keyName in dict.map) { + if (mergedDict.map[keyName]) { + continue; + } + mergedDict.map[keyName] = dict.map[keyName]; + } + } + return mergedDict; + }; + return Dict; })(); diff --git a/build/pdf.js b/build/pdf.js index 9ef72c2ae..7dd6d750a 100644 --- a/build/pdf.js +++ b/build/pdf.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.1.177'; -PDFJS.build = 'd3fa65e'; +PDFJS.version = '1.1.179'; +PDFJS.build = '5c3c516'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it diff --git a/build/pdf.worker.js b/build/pdf.worker.js index 7e7ee6155..8c7b48ab7 100644 --- a/build/pdf.worker.js +++ b/build/pdf.worker.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.1.177'; -PDFJS.build = 'd3fa65e'; +PDFJS.version = '1.1.179'; +PDFJS.build = '5c3c516'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -2611,17 +2611,33 @@ var Page = (function PageClosure() { return this.pageDict.get(key); }, - getInheritedPageProp: function Page_inheritPageProp(key) { - var dict = this.pageDict; - var value = dict.get(key); - while (value === undefined) { - dict = dict.get('Parent'); - if (!dict) { + getInheritedPageProp: function Page_getInheritedPageProp(key) { + var dict = this.pageDict, valueArray = null, loopCount = 0; + var MAX_LOOP_COUNT = 100; + // Always walk up the entire parent chain, to be able to find + // e.g. \Resources placed on multiple levels of the tree. + while (dict) { + var value = dict.get(key); + if (value) { + if (!valueArray) { + valueArray = []; + } + valueArray.push(value); + } + if (++loopCount > MAX_LOOP_COUNT) { + warn('Page_getInheritedPageProp: maximum loop count exceeded.'); break; } - value = dict.get(key); + dict = dict.get('Parent'); } - return value; + if (!valueArray) { + return Dict.empty; + } + if (valueArray.length === 1 || !isDict(valueArray[0]) || + loopCount > MAX_LOOP_COUNT) { + return valueArray[0]; + } + return Dict.merge(this.xref, valueArray); }, get content() { @@ -2629,14 +2645,10 @@ var Page = (function PageClosure() { }, get resources() { - var value = this.getInheritedPageProp('Resources'); // For robustness: The spec states that a \Resources entry has to be - // present, but can be empty. Some document omit it still. In this case - // return an empty dictionary: - if (value === undefined) { - value = Dict.empty; - } - return shadow(this, 'resources', value); + // present, but can be empty. Some document omit it still, in this case + // we return an empty dictionary. + return shadow(this, 'resources', this.getInheritedPageProp('Resources')); }, get mediaBox() { @@ -3294,6 +3306,24 @@ var Dict = (function DictClosure() { Dict.empty = new Dict(null); + Dict.merge = function Dict_merge(xref, dictArray) { + var mergedDict = new Dict(xref); + + for (var i = 0, ii = dictArray.length; i < ii; i++) { + var dict = dictArray[i]; + if (!isDict(dict)) { + continue; + } + for (var keyName in dict.map) { + if (mergedDict.map[keyName]) { + continue; + } + mergedDict.map[keyName] = dict.map[keyName]; + } + } + return mergedDict; + }; + return Dict; })(); diff --git a/package.json b/package.json index 2e9b4b564..72ffb13ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.1.177", + "version": "1.1.179", "description": "Generic build of Mozilla's PDF.js library.", "keywords": [ "Mozilla",