mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Prevent undefined error on null object when calling .destroy on a
document initialized with LocalPdfManager. Per @brendandahl's recommendation, moved the terminate function out of worker and into the PdfManager
This commit is contained in:
parent
1bcb3efd4a
commit
fb957f5c6e
2 changed files with 15 additions and 1 deletions
|
@ -63,6 +63,10 @@ var BasePdfManager = (function BasePdfManagerClosure() {
|
||||||
if (this.passwordChangedPromise) {
|
if (this.passwordChangedPromise) {
|
||||||
this.passwordChangedPromise.resolve();
|
this.passwordChangedPromise.resolve();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
terminate: function BasePdfManager_terminate() {
|
||||||
|
return new NotImplementedException();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -115,6 +119,11 @@ var LocalPdfManager = (function LocalPdfManagerClosure() {
|
||||||
return this.loadedStream;
|
return this.loadedStream;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
LocalPdfManager.prototype.terminate =
|
||||||
|
function LocalPdfManager_terminate() {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
return LocalPdfManager;
|
return LocalPdfManager;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -192,6 +201,11 @@ var NetworkPdfManager = (function NetworkPdfManagerClosure() {
|
||||||
return this.streamManager.onLoadedStream();
|
return this.streamManager.onLoadedStream();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NetworkPdfManager.prototype.terminate =
|
||||||
|
function NetworkPdfManager_terminate() {
|
||||||
|
this.streamManager.networkManager.abortAllRequests();
|
||||||
|
};
|
||||||
|
|
||||||
return NetworkPdfManager;
|
return NetworkPdfManager;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
@ -368,7 +368,7 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.on('Terminate', function wphTerminate(data, promise) {
|
handler.on('Terminate', function wphTerminate(data, promise) {
|
||||||
pdfManager.streamManager.networkManager.abortAllRequests();
|
pdfManager.terminate();
|
||||||
promise.resolve();
|
promise.resolve();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue