From 30e127d848d3a2e2cdd8f32bdb24b7394d6c7be8 Mon Sep 17 00:00:00 2001 From: Mack Duan Date: Fri, 19 Apr 2013 13:07:08 -0700 Subject: [PATCH] Do not cache content stream --- src/core.js | 13 +++++++------ test/pdfs/issue3115.pdf.link | 1 + test/test_manifest.json | 9 +++++++++ 3 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 test/pdfs/issue3115.pdf.link diff --git a/src/core.js b/src/core.js index c0b3dc287..9b0f0530d 100644 --- a/src/core.js +++ b/src/core.js @@ -84,7 +84,7 @@ var Page = (function PageClosure() { return obj; }, get content() { - return shadow(this, 'content', this.getPageProp('Contents')); + return this.getPageProp('Contents'); }, get resources() { return shadow(this, 'resources', this.inheritPageProp('Resources')); @@ -131,6 +131,7 @@ var Page = (function PageClosure() { }, getContentStream: function Page_getContentStream() { var content = this.content; + var stream; if (isArray(content)) { // fetching items var xref = this.xref; @@ -138,14 +139,14 @@ var Page = (function PageClosure() { var streams = []; for (i = 0; i < n; ++i) streams.push(xref.fetchIfRef(content[i])); - content = new StreamsSequenceStream(streams); + stream = new StreamsSequenceStream(streams); } else if (isStream(content)) { - content.reset(); - } else if (!content) { + stream = content; + } else { // replacing non-existent page content with empty one - content = new NullStream(); + stream = new NullStream(); } - return content; + return stream; }, getOperatorList: function Page_getOperatorList(handler) { var self = this; diff --git a/test/pdfs/issue3115.pdf.link b/test/pdfs/issue3115.pdf.link new file mode 100644 index 000000000..aced853d8 --- /dev/null +++ b/test/pdfs/issue3115.pdf.link @@ -0,0 +1 @@ +http://mirrors.ctan.org/info/lshort/english/lshort.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index 875c14d0b..65f01c750 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -170,6 +170,15 @@ "rounds": 1, "type": "eq" }, + { + "id": "issue3115", + "file": "pdfs/issue3115.pdf", + "md5": "ea10f4131202b9b8f2a6cb7770d3f185", + "rounds": 1, + "type": "eq", + "link": true, + "lastPage": 1 + }, { "id": "thuluthfont-text", "file": "pdfs/ThuluthFeatures.pdf", "md5": "b7e18bf7a3d6a9c82aefa12d721072fc",