mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 10:15:37 +02:00
Remove caching of stream data and fix object loader for streams.
This commit is contained in:
parent
81fa4a0d93
commit
09aafa830b
3 changed files with 48 additions and 23 deletions
32
src/obj.js
32
src/obj.js
|
@ -960,14 +960,7 @@ var XRef = (function XRefClosure() {
|
|||
} else {
|
||||
e = parser.getObj();
|
||||
}
|
||||
if (!isStream(e) || e instanceof JpegStream) {
|
||||
this.cache[num] = e;
|
||||
} else if (e instanceof Stream) {
|
||||
e = e.makeSubStream(e.start, e.length, e.dict);
|
||||
this.cache[num] = e;
|
||||
} else if ('readBlock' in e) {
|
||||
e.getBytes();
|
||||
e = e.makeSubStream(0, e.bufferLength, e.dict);
|
||||
if (!isStream(e)) {
|
||||
this.cache[num] = e;
|
||||
}
|
||||
return e;
|
||||
|
@ -1296,13 +1289,22 @@ var ObjectLoader = (function() {
|
|||
pendingRequests.push({ begin: e.begin, end: e.end });
|
||||
}
|
||||
}
|
||||
if (currentNode instanceof ChunkedStream &&
|
||||
currentNode.getMissingChunks().length) {
|
||||
nodesToRevisit.push(currentNode);
|
||||
pendingRequests.push({
|
||||
begin: currentNode.start,
|
||||
end: currentNode.end
|
||||
});
|
||||
if (currentNode && currentNode.getBaseStreams) {
|
||||
var baseStreams = currentNode.getBaseStreams();
|
||||
var foundMissingData = false;
|
||||
for (var i = 0; i < baseStreams.length; i++) {
|
||||
var stream = baseStreams[i];
|
||||
if (stream.getMissingChunks && stream.getMissingChunks().length) {
|
||||
foundMissingData = true;
|
||||
pendingRequests.push({
|
||||
begin: stream.start,
|
||||
end: stream.end
|
||||
});
|
||||
}
|
||||
}
|
||||
if (foundMissingData) {
|
||||
nodesToRevisit.push(currentNode);
|
||||
}
|
||||
}
|
||||
|
||||
addChildren(currentNode, nodesToVisit);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue