Merge pull request #16815 from Snuffleupagus/more-optional-chaining-3

Introduce even more optional chaining in the code-base
This commit is contained in:
Jonas Jenwald 2023-08-10 13:33:20 +02:00 committed by GitHub
commit 4962d005f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 12 deletions

View File

@ -546,9 +546,8 @@ class ChunkedStreamManager {
abort(reason) {
this.aborted = true;
if (this.pdfNetworkStream) {
this.pdfNetworkStream.cancelAllRequests(reason);
}
this.pdfNetworkStream?.cancelAllRequests(reason);
for (const capability of this._promisesByRequest.values()) {
capability.reject(reason);
}

View File

@ -2533,11 +2533,9 @@ class WorkerTransport {
this.#methodPromises.clear();
this.filterFactory.destroy();
if (this._networkStream) {
this._networkStream.cancelAllRequests(
new AbortException("Worker was terminated.")
);
}
this._networkStream?.cancelAllRequests(
new AbortException("Worker was terminated.")
);
if (this.messageHandler) {
this.messageHandler.destroy();

View File

@ -878,10 +878,8 @@ class AnnotationEditorUIManager {
copy(event) {
event.preventDefault();
if (this.#activeEditor) {
// An editor is being edited so just commit it.
this.#activeEditor.commitOrRemove();
}
// An editor is being edited so just commit it.
this.#activeEditor?.commitOrRemove();
if (!this.hasSelection) {
return;