Merge pull request #16875 from Snuffleupagus/more-optional-chaining-4

Introduce more optional chaining in the code-base
This commit is contained in:
Tim van der Meij 2023-08-27 11:16:56 +02:00 committed by GitHub
commit e142baecb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 11 deletions

View File

@ -40,9 +40,8 @@ class PDFWorkerStream {
}
cancelAllRequests(reason) {
if (this._fullRequestReader) {
this._fullRequestReader.cancel(reason);
}
this._fullRequestReader?.cancel(reason);
for (const reader of this._rangeRequestReaders.slice(0)) {
reader.cancel(reason);
}

View File

@ -3153,11 +3153,7 @@ class PDFObjects {
* @returns {Object}
*/
#ensureObj(objId) {
const obj = this.#objs[objId];
if (obj) {
return obj;
}
return (this.#objs[objId] = {
return (this.#objs[objId] ||= {
capability: new PromiseCapability(),
data: null,
});

View File

@ -107,9 +107,7 @@ class Sandbox {
}
dumpMemoryUse() {
if (this._module) {
this._module.ccall("dumpMemoryUse", null, []);
}
this._module?.ccall("dumpMemoryUse", null, []);
}
nukeSandbox() {