fix(op_crates/web): TextEncoder should throw RangeError (#8039)

This commit changes error type thrown by TextEncoder, when
provided encoding is not supported matching Chromium behavior.
This commit is contained in:
Leonard Ginters 2020-10-19 23:56:29 +02:00 committed by GitHub
parent 1474d5d76d
commit 623ac9e6df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 3 deletions

View file

@ -981,7 +981,7 @@
);
}
if (!decoders.has(encoding) && encoding !== "utf-8") {
throw new TypeError(`Internal decoder ('${encoding}') not found.`);
throw new RangeError(`Internal decoder ('${encoding}') not found.`);
}
this.#encoding = encoding;
}