summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/js/web/blob.ts10
-rw-r--r--cli/tests/unit/blob_test.ts5
2 files changed, 14 insertions, 1 deletions
diff --git a/cli/js/web/blob.ts b/cli/js/web/blob.ts
index 546ea7e82..899c67135 100644
--- a/cli/js/web/blob.ts
+++ b/cli/js/web/blob.ts
@@ -161,7 +161,7 @@ async function readBytes(
// Ensures it does not impact garbage collection.
export const blobBytesWeakMap = new WeakMap<Blob, Uint8Array>();
-export class DenoBlob implements Blob {
+class DenoBlob implements Blob {
[bytesSymbol]: Uint8Array;
readonly size: number = 0;
readonly type: string = "";
@@ -216,3 +216,11 @@ export class DenoBlob implements Blob {
return readBytes(getStream(this[bytesSymbol]).getReader());
}
}
+
+// we want the Base class name to be the name of the class.
+Object.defineProperty(DenoBlob, "name", {
+ value: "Blob",
+ configurable: true,
+});
+
+export { DenoBlob };
diff --git a/cli/tests/unit/blob_test.ts b/cli/tests/unit/blob_test.ts
index 70f8fb3d5..79e6f1f8f 100644
--- a/cli/tests/unit/blob_test.ts
+++ b/cli/tests/unit/blob_test.ts
@@ -90,3 +90,8 @@ unitTest(async function blobStream(): Promise<void> {
await read();
assertEquals(decode(bytes), "Hello World");
});
+
+unitTest(function blobConstructorNameIsBlob(): void {
+ const blob = new Blob();
+ assertEquals(blob.constructor.name, "Blob");
+});