• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// META: title=Encoding API: invalid label
2// META: timeout=long
3// META: script=resources/encodings.js
4
5var tests = ["invalid-invalidLabel"];
6setup(function() {
7  encodings_table.forEach(function(section) {
8    section.encodings.forEach(function(encoding) {
9      encoding.labels.forEach(function(label) {
10        ["\u0000", "\u000b", "\u00a0", "\u2028", "\u2029"].forEach(function(ws) {
11          tests.push(ws + label);
12          tests.push(label + ws);
13          tests.push(ws + label + ws);
14        });
15      });
16    });
17  });
18});
19
20tests.forEach(function(input) {
21  test(function() {
22    assert_throws(new RangeError(), function() { new TextDecoder(input); });
23  }, 'Invalid label ' + format_value(input) + ' should be rejected by TextDecoder.');
24});
25