mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Adds destroy method to the document loading task.
Also renames PDFPageProxy.destroy method to cleanup.
This commit is contained in:
parent
ef85685803
commit
59c13b32aa
10 changed files with 243 additions and 78 deletions
|
@ -1378,9 +1378,9 @@ var XRef = (function XRefClosure() {
|
|||
resolve(xref.fetch(ref, suppressEncryption));
|
||||
} catch (e) {
|
||||
if (e instanceof MissingDataException) {
|
||||
streamManager.requestRange(e.begin, e.end, function () {
|
||||
streamManager.requestRange(e.begin, e.end).then(function () {
|
||||
tryFetch(resolve, reject);
|
||||
});
|
||||
}, reject);
|
||||
return;
|
||||
}
|
||||
reject(e);
|
||||
|
@ -1656,6 +1656,7 @@ var ObjectLoader = (function() {
|
|||
this.keys = keys;
|
||||
this.xref = xref;
|
||||
this.refSet = null;
|
||||
this.capability = null;
|
||||
}
|
||||
|
||||
ObjectLoader.prototype = {
|
||||
|
@ -1676,11 +1677,11 @@ var ObjectLoader = (function() {
|
|||
nodesToVisit.push(this.obj[keys[i]]);
|
||||
}
|
||||
|
||||
this.walk(nodesToVisit);
|
||||
this._walk(nodesToVisit);
|
||||
return this.capability.promise;
|
||||
},
|
||||
|
||||
walk: function ObjectLoader_walk(nodesToVisit) {
|
||||
_walk: function ObjectLoader_walk(nodesToVisit) {
|
||||
var nodesToRevisit = [];
|
||||
var pendingRequests = [];
|
||||
// DFS walk of the object graph.
|
||||
|
@ -1727,7 +1728,7 @@ var ObjectLoader = (function() {
|
|||
}
|
||||
|
||||
if (pendingRequests.length) {
|
||||
this.xref.stream.manager.requestRanges(pendingRequests,
|
||||
this.xref.stream.manager.requestRanges(pendingRequests).then(
|
||||
function pendingRequestCallback() {
|
||||
nodesToVisit = nodesToRevisit;
|
||||
for (var i = 0; i < nodesToRevisit.length; i++) {
|
||||
|
@ -1738,8 +1739,8 @@ var ObjectLoader = (function() {
|
|||
this.refSet.remove(node);
|
||||
}
|
||||
}
|
||||
this.walk(nodesToVisit);
|
||||
}.bind(this));
|
||||
this._walk(nodesToVisit);
|
||||
}.bind(this), this.capability.reject);
|
||||
return;
|
||||
}
|
||||
// Everything is loaded.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue