| OLD | NEW |
| (Empty) | |
| 1 B<!DOCTYPE html> |
| 2 <script src="../../js/resources/js-test-pre.js"></script> |
| 3 <script src="resources/shared.js"></script> |
| 4 <script> |
| 5 |
| 6 description("Verify that Latin-1 decoders (windows-1252, iso-8859-1, us-ascii, e
tc) decode identically."); |
| 7 |
| 8 // Blink uses separate decoder object intances for these encoding aliases, |
| 9 // so test that they are behaving identically. |
| 10 |
| 11 var labels; |
| 12 encodings_table.forEach(function(section) { |
| 13 section.encodings.forEach(function(encoding) { |
| 14 if (encoding.name === "windows-1252") |
| 15 labels = encoding.labels; |
| 16 }); |
| 17 }); |
| 18 labels = labels.filter(function(label) { return label !== 'windows-1252'; }); |
| 19 |
| 20 evalAndLog("array = new Uint8Array(256)"); |
| 21 debug("initialize array to 0...255"); |
| 22 for (var cp = 0; cp <= 255; ++cp) { |
| 23 array[cp] = cp; |
| 24 } |
| 25 |
| 26 evalAndLog("windows1252 = new TextDecoder('windows-1252')"); |
| 27 |
| 28 labels.forEach(function(label) { |
| 29 decoder = null; |
| 30 evalAndLog("decoder = new TextDecoder(" + JSON.stringify(label) + ")"); |
| 31 // Above may throw if encoding unsupported. |
| 32 if (decoder) { |
| 33 shouldBe("decoder.decode(array)", "windows1252.decode(array)"); |
| 34 } |
| 35 }); |
| 36 |
| 37 </script> |
| 38 <script src="../../js/resources/js-test-post.js"></script> |
| OLD | NEW |