Make the passwordCapability
field, in WorkerTransport
, actually private as intended
This commit is contained in:
parent
81dfa61777
commit
930cbc4d27
@ -2367,6 +2367,8 @@ class WorkerTransport {
|
|||||||
|
|
||||||
#pagePromises = new Map();
|
#pagePromises = new Map();
|
||||||
|
|
||||||
|
#passwordCapability = null;
|
||||||
|
|
||||||
constructor(messageHandler, loadingTask, networkStream, params, factory) {
|
constructor(messageHandler, loadingTask, networkStream, params, factory) {
|
||||||
this.messageHandler = messageHandler;
|
this.messageHandler = messageHandler;
|
||||||
this.loadingTask = loadingTask;
|
this.loadingTask = loadingTask;
|
||||||
@ -2384,7 +2386,6 @@ class WorkerTransport {
|
|||||||
|
|
||||||
this.destroyed = false;
|
this.destroyed = false;
|
||||||
this.destroyCapability = null;
|
this.destroyCapability = null;
|
||||||
this._passwordCapability = null;
|
|
||||||
|
|
||||||
this._networkStream = networkStream;
|
this._networkStream = networkStream;
|
||||||
this._fullReader = null;
|
this._fullReader = null;
|
||||||
@ -2495,11 +2496,9 @@ class WorkerTransport {
|
|||||||
this.destroyed = true;
|
this.destroyed = true;
|
||||||
this.destroyCapability = new PromiseCapability();
|
this.destroyCapability = new PromiseCapability();
|
||||||
|
|
||||||
if (this._passwordCapability) {
|
this.#passwordCapability?.reject(
|
||||||
this._passwordCapability.reject(
|
|
||||||
new Error("Worker was destroyed during onPassword callback")
|
new Error("Worker was destroyed during onPassword callback")
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
const waitOn = [];
|
const waitOn = [];
|
||||||
// We need to wait for all renderings to be completed, e.g.
|
// We need to wait for all renderings to be completed, e.g.
|
||||||
@ -2702,27 +2701,27 @@ class WorkerTransport {
|
|||||||
});
|
});
|
||||||
|
|
||||||
messageHandler.on("PasswordRequest", exception => {
|
messageHandler.on("PasswordRequest", exception => {
|
||||||
this._passwordCapability = new PromiseCapability();
|
this.#passwordCapability = new PromiseCapability();
|
||||||
|
|
||||||
if (loadingTask.onPassword) {
|
if (loadingTask.onPassword) {
|
||||||
const updatePassword = password => {
|
const updatePassword = password => {
|
||||||
if (password instanceof Error) {
|
if (password instanceof Error) {
|
||||||
this._passwordCapability.reject(password);
|
this.#passwordCapability.reject(password);
|
||||||
} else {
|
} else {
|
||||||
this._passwordCapability.resolve({ password });
|
this.#passwordCapability.resolve({ password });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
loadingTask.onPassword(updatePassword, exception.code);
|
loadingTask.onPassword(updatePassword, exception.code);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
this._passwordCapability.reject(ex);
|
this.#passwordCapability.reject(ex);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this._passwordCapability.reject(
|
this.#passwordCapability.reject(
|
||||||
new PasswordException(exception.message, exception.code)
|
new PasswordException(exception.message, exception.code)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return this._passwordCapability.promise;
|
return this.#passwordCapability.promise;
|
||||||
});
|
});
|
||||||
|
|
||||||
messageHandler.on("DataLoaded", data => {
|
messageHandler.on("DataLoaded", data => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user