Skip to content

Commit e27a604

Browse files
committed
Merge pull request mozilla#3123 from mduan/issue3115
Do not cache content stream
2 parents 49ff029 + 30e127d commit e27a604

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

src/core.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ var Page = (function PageClosure() {
8484
return obj;
8585
},
8686
get content() {
87-
return shadow(this, 'content', this.getPageProp('Contents'));
87+
return this.getPageProp('Contents');
8888
},
8989
get resources() {
9090
return shadow(this, 'resources', this.inheritPageProp('Resources'));
@@ -131,21 +131,22 @@ var Page = (function PageClosure() {
131131
},
132132
getContentStream: function Page_getContentStream() {
133133
var content = this.content;
134+
var stream;
134135
if (isArray(content)) {
135136
// fetching items
136137
var xref = this.xref;
137138
var i, n = content.length;
138139
var streams = [];
139140
for (i = 0; i < n; ++i)
140141
streams.push(xref.fetchIfRef(content[i]));
141-
content = new StreamsSequenceStream(streams);
142+
stream = new StreamsSequenceStream(streams);
142143
} else if (isStream(content)) {
143-
content.reset();
144-
} else if (!content) {
144+
stream = content;
145+
} else {
145146
// replacing non-existent page content with empty one
146-
content = new NullStream();
147+
stream = new NullStream();
147148
}
148-
return content;
149+
return stream;
149150
},
150151
getOperatorList: function Page_getOperatorList(handler) {
151152
var self = this;

test/pdfs/issue3115.pdf.link

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
http://mirrors.ctan.org/info/lshort/english/lshort.pdf

test/test_manifest.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,15 @@
170170
"rounds": 1,
171171
"type": "eq"
172172
},
173+
{
174+
"id": "issue3115",
175+
"file": "pdfs/issue3115.pdf",
176+
"md5": "ea10f4131202b9b8f2a6cb7770d3f185",
177+
"rounds": 1,
178+
"type": "eq",
179+
"link": true,
180+
"lastPage": 1
181+
},
173182
{ "id": "thuluthfont-text",
174183
"file": "pdfs/ThuluthFeatures.pdf",
175184
"md5": "b7e18bf7a3d6a9c82aefa12d721072fc",

0 commit comments

Comments
 (0)