OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Encoding API: replacement encoding</title> | 2 <title>Encoding API: replacement encoding</title> |
3 <script src="../../../resources/testharness.js"></script> | 3 <script src="../../../resources/testharness.js"></script> |
4 <script src="../../../resources/testharnessreport.js"></script> | 4 <script src="../../../resources/testharnessreport.js"></script> |
5 <script src="resources/encodings.js"></script> | 5 <script src="resources/encodings.js"></script> |
6 <script> | 6 <script> |
7 | 7 |
8 test(function() { | 8 test(function() { |
9 assert_throws(new RangeError(), function() { new TextDecoder('replacement');
}); | 9 assert_throws(new RangeError(), function() { new TextDecoder('replacement');
}); |
10 }, 'The "replacement" label should not be a known encoding.'); | 10 }, 'The "replacement" label should not be a known encoding.'); |
11 | 11 |
12 encodings_table.forEach(function(section) { | 12 encodings_table.forEach(function(section) { |
13 section.encodings.filter(function(encoding) { | 13 section.encodings.filter(function(encoding) { |
14 return encoding.name === 'replacement'; | 14 return encoding.name === 'replacement'; |
15 }).forEach(function(encoding) { | 15 }).forEach(function(encoding) { |
16 encoding.labels.forEach(function(label) { | 16 encoding.labels.forEach(function(label) { |
17 test(function() { | 17 test(function() { |
18 assert_throws(new RangeError(), function() { new TextDecoder(lab
el); }); | 18 assert_throws(new RangeError(), function() { new TextDecoder(lab
el); }); |
19 }, 'Label for "replacement" should be rejected by API: ' + label); | 19 }, 'Label for "replacement" should be rejected by API: ' + label); |
20 }); | 20 }); |
21 }); | 21 }); |
22 }); | 22 }); |
23 | 23 |
24 </script> | 24 </script> |
OLD | NEW |