| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/js-test.js"></script> |
| 3 <script src="resources/shared.js"></script> |
| 4 <script> |
| 5 |
| 6 description("Verify replacement encoding behavior"); |
| 7 |
| 8 shouldThrow("new TextEncoder('replacement')"); |
| 9 shouldThrow("new TextDecoder('replacement')"); |
| 10 |
| 11 encodings_table.forEach(function(section) { |
| 12 section.encodings.forEach(function(encoding) { |
| 13 if (encoding.name !== "replacement") |
| 14 return; |
| 15 |
| 16 encoding.labels.forEach(function(label) { |
| 17 |
| 18 debug(""); |
| 19 debug("label: " + label); |
| 20 debug(""); |
| 21 |
| 22 shouldThrow("new TextEncoder('" + label + "')"); |
| 23 |
| 24 evalAndLog("decoder = new TextDecoder('" + label + "')"); |
| 25 shouldBeEqualToString("decoder.encoding", "replacement"); |
| 26 shouldBeEqualToString("decoder.decode(new Uint8Array([0x41,0x42,0x43
]))", ""); |
| 27 |
| 28 evalAndLog("decoder = new TextDecoder('" + label + "', {fatal: true}
)"); |
| 29 shouldBeEqualToString("decoder.encoding", "replacement"); |
| 30 shouldThrow("decoder.decode(new Uint8Array([0x41,0x42,0x43]))"); |
| 31 }); |
| 32 }); |
| 33 }); |
| 34 |
| 35 </script> |
| OLD | NEW |