| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Encoding API: Fatal flag</title> | 2 <title>Encoding API: Fatal flag</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/shared.js"></script> | 5 <script src="resources/shared.js"></script> |
| 6 <script> | 6 <script> |
| 7 | 7 |
| 8 var bad = [ | 8 var bad = [ |
| 9 { encoding: 'utf-8', input: [0xFF], name: 'invalid code' }, | 9 { encoding: 'utf-8', input: [0xFF], name: 'invalid code' }, |
| 10 { encoding: 'utf-8', input: [0xC0], name: 'ends early' }, | 10 { encoding: 'utf-8', input: [0xC0], name: 'ends early' }, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 ]; | 55 ]; |
| 56 | 56 |
| 57 bad.forEach(function(t) { | 57 bad.forEach(function(t) { |
| 58 test(function() { | 58 test(function() { |
| 59 assert_throws({name: 'EncodingError'}, function() { | 59 assert_throws({name: 'EncodingError'}, function() { |
| 60 new TextDecoder(t.encoding, {fatal: true}).decode(new Uint8Array(t.i
nput)) | 60 new TextDecoder(t.encoding, {fatal: true}).decode(new Uint8Array(t.i
nput)) |
| 61 }); | 61 }); |
| 62 }, 'Fatal flag: ' + t.encoding + ' - ' + t.name); | 62 }, 'Fatal flag: ' + t.encoding + ' - ' + t.name); |
| 63 }); | 63 }); |
| 64 | 64 |
| 65 test(function() { |
| 66 assert_true('fatal' in new TextDecoder(), 'The fatal attribute should exist
on TextDecoder.'); |
| 67 assert_equals(typeof new TextDecoder().fatal, 'boolean', 'The type of the f
atal attribute should be boolean.'); |
| 68 assert_false(new TextDecoder().fatal, 'The fatal attribute should default to
false.'); |
| 69 assert_true(new TextDecoder('utf-8', {fatal: true}).fatal, 'The fatal attrib
ute can be set using an option.'); |
| 70 |
| 71 }, 'The fatal attribute of TextDecoder'); |
| 72 |
| 65 </script> | 73 </script> |
| OLD | NEW |