mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
[api-minor] Ensure that the getDocument
Promise is rejected if the loadingTask
is destroyed, or an Error
is thrown, inside of the onPassword
callback (issue 7806)
This patch also removes the `UpdatePassword` message, in favour of using the `sendWithPromise` method of `MessageHandler`. Furthermore, the patch also refactors the `BasePdfManager_updatePassword`/`BasePdfManager_passwordChanged` methods (in pdf_manager.js), and the `pdfManagerReady` function (in worker.js).
This commit is contained in:
parent
59afb4b9f0
commit
27513cd23b
4 changed files with 112 additions and 71 deletions
|
@ -107,14 +107,6 @@ var BasePdfManager = (function BasePdfManagerClosure() {
|
|||
|
||||
updatePassword: function BasePdfManager_updatePassword(password) {
|
||||
this.pdfDocument.xref.password = this.password = password;
|
||||
if (this._passwordChangedCapability) {
|
||||
this._passwordChangedCapability.resolve();
|
||||
}
|
||||
},
|
||||
|
||||
passwordChanged: function BasePdfManager_passwordChanged() {
|
||||
this._passwordChangedCapability = createPromiseCapability();
|
||||
return this._passwordChangedCapability.promise;
|
||||
},
|
||||
|
||||
terminate: function BasePdfManager_terminate() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue