diff options
author | Leonard Ginters <leonard@linters.de> | 2020-10-19 23:56:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-19 23:56:29 +0200 |
commit | 623ac9e6df660b758aa3da281b6ff2b4db265ef0 (patch) | |
tree | 09749c4a1189d5b1a9edd95e5cf42d7248e2d2dc /op_crates/web/text_encoding_test.js | |
parent | 1474d5d76d38c094c6c551bcd23a61f8328bb258 (diff) |
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.
Diffstat (limited to 'op_crates/web/text_encoding_test.js')
-rw-r--r-- | op_crates/web/text_encoding_test.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/op_crates/web/text_encoding_test.js b/op_crates/web/text_encoding_test.js index b51122f90..7f6774ed4 100644 --- a/op_crates/web/text_encoding_test.js +++ b/op_crates/web/text_encoding_test.js @@ -171,6 +171,17 @@ function textDecoderErrorEncoding() { assert(didThrow); } +function textDecoderHandlesNotFoundInternalDecoder() { + let didThrow = false; + try { + new TextDecoder("gbk"); + } catch (e) { + didThrow = true; + assert(e instanceof RangeError); + } + assert(didThrow); +} + function textDecoderHandlesUndefined() { const fixture = undefined; const decoder = new TextDecoder(); @@ -948,8 +959,8 @@ function singleByteEncodings() { 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 8992, 9632, 8729, 8730, 8776, - 8804, 8805, 160, 8993, 176, 178, 183, 247, - 9552, 9553, 9554, 1105, 9555, 9556, 9557, 9558, + 8804, 8805, 160, 8993, 176, 178, 183, 247, + 9552, 9553, 9554, 1105, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 1025, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 169, @@ -1256,6 +1267,7 @@ function main() { textDecoderSharedInt32Array(); toStringShouldBeWebCompatibility(); singleByteEncodings(); + textDecoderHandlesNotFoundInternalDecoder(); } main(); |