Merge pull request #13822 from Snuffleupagus/ReadableStreams-cancel-no-Uncaught_promise
Prevent "Uncaught promise" messages in the console when cancelling (some) `ReadableStream`s
This commit is contained in:
commit
67f4c34f63
@ -1772,7 +1772,11 @@ class PDFPageProxy {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
intentState.streamReader.cancel(new AbortException(reason?.message));
|
intentState.streamReader
|
||||||
|
.cancel(new AbortException(reason?.message))
|
||||||
|
.catch(() => {
|
||||||
|
// Avoid "Uncaught promise" messages in the console.
|
||||||
|
});
|
||||||
intentState.streamReader = null;
|
intentState.streamReader = null;
|
||||||
|
|
||||||
if (this._transport.destroyed) {
|
if (this._transport.destroyed) {
|
||||||
|
@ -597,7 +597,7 @@ class TextLayerRenderTask {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
/* Avoid "Uncaught promise" messages in the console. */
|
// Avoid "Uncaught promise" messages in the console.
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,7 +615,11 @@ class TextLayerRenderTask {
|
|||||||
cancel() {
|
cancel() {
|
||||||
this._canceled = true;
|
this._canceled = true;
|
||||||
if (this._reader) {
|
if (this._reader) {
|
||||||
this._reader.cancel(new AbortException("TextLayer task cancelled."));
|
this._reader
|
||||||
|
.cancel(new AbortException("TextLayer task cancelled."))
|
||||||
|
.catch(() => {
|
||||||
|
// Avoid "Uncaught promise" messages in the console.
|
||||||
|
});
|
||||||
this._reader = null;
|
this._reader = null;
|
||||||
}
|
}
|
||||||
if (this._renderTimer !== null) {
|
if (this._renderTimer !== null) {
|
||||||
@ -741,8 +745,7 @@ class TextLayerRenderTask {
|
|||||||
pump();
|
pump();
|
||||||
} else {
|
} else {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Neither "textContent" nor "textContentStream"' +
|
'Neither "textContent" nor "textContentStream" parameters specified.'
|
||||||
" parameters specified."
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user