summaryrefslogtreecommitdiff
path: root/op_crates
diff options
context:
space:
mode:
authoraca <acadx0@gmail.com>2020-10-20 20:47:38 +0900
committerGitHub <noreply@github.com>2020-10-20 13:47:38 +0200
commit9cf06f76fdeb4b8cff4a47e269984d3b9a64a9be (patch)
tree99a43391f0c10d3ad77b7128d83e838fe37f01dd /op_crates
parentd9ae74019ef6982acb45d2688d71b99f2191b38d (diff)
fix(op_crates/web): TextEncoder should return error message with original input (#8005)
Diffstat (limited to 'op_crates')
-rw-r--r--op_crates/web/08_text_encoding.js4
-rw-r--r--op_crates/web/text_encoding_test.js4
2 files changed, 4 insertions, 4 deletions
diff --git a/op_crates/web/08_text_encoding.js b/op_crates/web/08_text_encoding.js
index 5a84ea8a4..d93319758 100644
--- a/op_crates/web/08_text_encoding.js
+++ b/op_crates/web/08_text_encoding.js
@@ -973,8 +973,8 @@
if (options.fatal) {
this.fatal = true;
}
- label = String(label).trim().toLowerCase();
- const encoding = encodings.get(label);
+ const _label = String(label).trim().toLowerCase();
+ const encoding = encodings.get(_label);
if (!encoding) {
throw new RangeError(
`The encoding label provided ('${label}') is invalid.`,
diff --git a/op_crates/web/text_encoding_test.js b/op_crates/web/text_encoding_test.js
index 7f6774ed4..9a4bb492b 100644
--- a/op_crates/web/text_encoding_test.js
+++ b/op_crates/web/text_encoding_test.js
@@ -163,10 +163,10 @@ function textDecoderASCII() {
function textDecoderErrorEncoding() {
let didThrow = false;
try {
- new TextDecoder("foo");
+ new TextDecoder("Foo");
} catch (e) {
didThrow = true;
- assert(e.message === "The encoding label provided ('foo') is invalid.");
+ assert(e.message === "The encoding label provided ('Foo') is invalid.");
}
assert(didThrow);
}