aboutsummaryrefslogtreecommitdiff
path: root/ext/js/background/request-builder.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-11-27 14:55:27 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-11-27 14:55:27 -0500
commit7aed9a371b0d74c0d75179a08068e8935b76d780 (patch)
tree2d895b20e31cb03c8200e4429d987c6d253b1da7 /ext/js/background/request-builder.js
parent5dc16745468c229e7c31f6cddaad83fb9c36b98f (diff)
Update types
Diffstat (limited to 'ext/js/background/request-builder.js')
-rw-r--r--ext/js/background/request-builder.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/ext/js/background/request-builder.js b/ext/js/background/request-builder.js
index 48fe2dd9..5ae7fbf5 100644
--- a/ext/js/background/request-builder.js
+++ b/ext/js/background/request-builder.js
@@ -22,12 +22,6 @@
*/
export class RequestBuilder {
/**
- * A progress callback for a fetch read.
- * @callback ProgressCallback
- * @param {boolean} complete Whether or not the data has been completely read.
- */
-
- /**
* Creates a new instance.
*/
constructor() {
@@ -109,14 +103,17 @@ export class RequestBuilder {
/**
* Reads the array buffer body of a fetch response, with an optional `onProgress` callback.
* @param {Response} response The response of a `fetch` call.
- * @param {ProgressCallback} onProgress The progress callback
+ * @param {?import('request-builder.js').ProgressCallback} onProgress The progress callback
* @returns {Promise<Uint8Array>} The resulting binary data.
*/
static async readFetchResponseArrayBuffer(response, onProgress) {
let reader;
try {
if (typeof onProgress === 'function') {
- reader = response.body.getReader();
+ const {body} = response;
+ if (body !== null) {
+ reader = body.getReader();
+ }
}
} catch (e) {
// Not supported