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