| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../js/resources/js-test-pre.js"></script> | 2 <script src="../../js/resources/js-test-pre.js"></script> |
| 3 <script> | 3 <script> |
| 4 | 4 |
| 5 description("Test the Encoding API's 'fatal' flag"); | 5 description("Test the Encoding API's 'fatal' flag"); |
| 6 | 6 |
| 7 var bad = [ | 7 var bad = [ |
| 8 { encoding: 'utf-8', input: "[0xC0]" }, // ends early | 8 { encoding: 'utf-8', input: "[0xC0]" }, // ends early |
| 9 { encoding: 'utf-8', input: "[0xC0, 0x00]" }, // invalid trail | 9 { encoding: 'utf-8', input: "[0xC0, 0x00]" }, // invalid trail |
| 10 { encoding: 'utf-8', input: "[0xC0, 0xC0]" }, // invalid trail | 10 { encoding: 'utf-8', input: "[0xC0, 0xC0]" }, // invalid trail |
| 11 { encoding: 'utf-8', input: "[0xE0]" }, // ends early | 11 { encoding: 'utf-8', input: "[0xE0]" }, // ends early |
| 12 { encoding: 'utf-8', input: "[0xE0, 0x00]" }, // invalid trail | 12 { encoding: 'utf-8', input: "[0xE0, 0x00]" }, // invalid trail |
| 13 { encoding: 'utf-8', input: "[0xE0, 0xC0]" }, // invalid trail | 13 { encoding: 'utf-8', input: "[0xE0, 0xC0]" }, // invalid trail |
| 14 { encoding: 'utf-8', input: "[0xE0, 0x80, 0x00]" }, // invalid trail | 14 { encoding: 'utf-8', input: "[0xE0, 0x80, 0x00]" }, // invalid trail |
| 15 { encoding: 'utf-8', input: "[0xE0, 0x80, 0xC0]" }, // invalid trail | 15 { encoding: 'utf-8', input: "[0xE0, 0x80, 0xC0]" }, // invalid trail |
| 16 { encoding: 'utf-8', input: "[0xFC, 0x80, 0x80, 0x80, 0x80, 0x80]" }, // > 0
x10FFFF | 16 { encoding: 'utf-8', input: "[0xFC, 0x80, 0x80, 0x80, 0x80, 0x80]" }, // > 0
x10FFFF |
| 17 { encoding: 'utf-16le', input: "[0x00]" }, // truncated code unit | 17 { encoding: 'utf-16le', input: "[0x00]" }, // truncated code unit |
| 18 { encoding: 'utf-16le', input: "[0x00, 0xd8]" }, // surrogate half | 18 { encoding: 'utf-16le', input: "[0x00, 0xd8]" }, // surrogate half |
| 19 { encoding: 'utf-16le', input: "[0x00, 0xd8, 0x00, 0x00]" }, // surrogate ha
lf | 19 { encoding: 'utf-16le', input: "[0x00, 0xd8, 0x00, 0x00]" }, // surrogate ha
lf |
| 20 { encoding: 'utf-16le', input: "[0x00, 0xdc, 0x00, 0x00]" }, // trail surrog
ate | 20 { encoding: 'utf-16le', input: "[0x00, 0xdc, 0x00, 0x00]" }, // trail surrog
ate |
| 21 { encoding: 'utf-16le', input: "[0x00, 0xdc, 0x00, 0xd8]" } // swapped surr
ogates | 21 { encoding: 'utf-16le', input: "[0x00, 0xdc, 0x00, 0xd8]" } // swapped surr
ogates |
| 22 // FIXME: Legacy encoding cases | 22 // FIXME: Legacy encoding cases |
| 23 ]; | 23 ]; |
| 24 | 24 |
| 25 bad.forEach(function(t) { | 25 bad.forEach(function(t) { |
| 26 shouldThrow("new TextDecoder('" + t.encoding + "', {fatal: true}).decode(new
Uint8Array(" + t.input + "))"); | 26 shouldThrow("new TextDecoder('" + t.encoding + "', {fatal: true}).decode(new
Uint8Array(" + t.input + "))"); |
| 27 }); | 27 }); |
| 28 | 28 |
| 29 </script> | 29 </script> |
| 30 <script src="../../js/resources/js-test-post.js"></script> | |
| OLD | NEW |