Introduce more optional chaining in the code-base
Also, use logical OR assignment a bit more.
This commit is contained in:
parent
598421b11f
commit
ec3d2be761
@ -40,9 +40,8 @@ class PDFWorkerStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cancelAllRequests(reason) {
|
cancelAllRequests(reason) {
|
||||||
if (this._fullRequestReader) {
|
this._fullRequestReader?.cancel(reason);
|
||||||
this._fullRequestReader.cancel(reason);
|
|
||||||
}
|
|
||||||
for (const reader of this._rangeRequestReaders.slice(0)) {
|
for (const reader of this._rangeRequestReaders.slice(0)) {
|
||||||
reader.cancel(reason);
|
reader.cancel(reason);
|
||||||
}
|
}
|
||||||
|
@ -3153,11 +3153,7 @@ class PDFObjects {
|
|||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
#ensureObj(objId) {
|
#ensureObj(objId) {
|
||||||
const obj = this.#objs[objId];
|
return (this.#objs[objId] ||= {
|
||||||
if (obj) {
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
return (this.#objs[objId] = {
|
|
||||||
capability: new PromiseCapability(),
|
capability: new PromiseCapability(),
|
||||||
data: null,
|
data: null,
|
||||||
});
|
});
|
||||||
|
@ -107,9 +107,7 @@ class Sandbox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dumpMemoryUse() {
|
dumpMemoryUse() {
|
||||||
if (this._module) {
|
this._module?.ccall("dumpMemoryUse", null, []);
|
||||||
this._module.ccall("dumpMemoryUse", null, []);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nukeSandbox() {
|
nukeSandbox() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user