1// META: title=Encoding API: invalid label
2// META: timeout=long
3// META: variant=?1-1000
4// META: variant=?1001-2000
5// META: variant=?2001-3000
6// META: variant=?3001-last
7// META: script=resources/encodings.js
8// META: script=/common/subset-tests.js
9
10var tests = ["invalid-invalidLabel"];
11setup(function() {
12  encodings_table.forEach(function(section) {
13    section.encodings.forEach(function(encoding) {
14      encoding.labels.forEach(function(label) {
15        ["\u0000", "\u000b", "\u00a0", "\u2028", "\u2029"].forEach(function(ws) {
16          tests.push(ws + label);
17          tests.push(label + ws);
18          tests.push(ws + label + ws);
19        });
20      });
21    });
22  });
23});
24
25tests.forEach(function(input) {
26  subsetTest(test, function() {
27    assert_throws_js(RangeError, function() { new TextDecoder(input); });
28  }, 'Invalid label ' + format_value(input) + ' should be rejected by TextDecoder.');
29});
30