| OLD | NEW | 
|   1 <!DOCTYPE html> |   1 <!DOCTYPE html> | 
|   2 <script src="../../../resources/js-test.js"></script> |   2 <script src="../../../resources/js-test.js"></script> | 
|   3 <script> |   3 <script> | 
|   4  |   4  | 
|   5 description("Edge cases around non-fatal errors at EOF"); |   5 description("Edge cases around non-fatal errors at EOF"); | 
|   6  |   6  | 
|   7 shouldThrow("new TextDecoder('utf-8', {fatal: true}).decode(new Uint8Array([0xff
    ]))"); |   7 shouldThrow("new TextDecoder('utf-8', {fatal: true}).decode(new Uint8Array([0xff
    ]))"); | 
|   8  |   8  | 
|   9 debug(""); |   9 debug(""); | 
|  10 debug("Should not throw or hang:"); |  10 shouldBe("new TextDecoder('utf-8').decode(new Uint8Array([0xff]))", "'\uFFFD'"); | 
|  11 evalAndLog("new TextDecoder('utf-8').decode(new Uint8Array([0xff]))"); |  | 
|  12  |  11  | 
|  13 debug(""); |  12 debug(""); | 
|  14 shouldThrow("new TextDecoder('utf-16le', {fatal: true}).decode(new Uint8Array([0
    x00]))"); |  13 shouldThrow("new TextDecoder('utf-16le', {fatal: true}).decode(new Uint8Array([0
    x00]))"); | 
|  15  |  14  | 
|  16 debug(""); |  15 debug(""); | 
|  17 debug("Should not throw or hang:"); |  16 shouldBe("new TextDecoder('utf-16le').decode(new Uint8Array([0x00]))", "'\uFFFD'
    "); | 
|  18 evalAndLog("new TextDecoder('utf-16le').decode(new Uint8Array([0x00]))"); |  | 
|  19  |  17  | 
|  20 debug(""); |  18 debug(""); | 
|  21 shouldThrow("new TextDecoder('utf-16be', {fatal: true}).decode(new Uint8Array([0
    x00]))"); |  19 shouldThrow("new TextDecoder('utf-16be', {fatal: true}).decode(new Uint8Array([0
    x00]))"); | 
|  22  |  20  | 
|  23 debug(""); |  21 debug(""); | 
|  24 debug("Should not throw or hang:"); |  22 shouldBe("new TextDecoder('utf-16be').decode(new Uint8Array([0x00]))", "'\uFFFD'
    "); | 
|  25 evalAndLog("new TextDecoder('utf-16be').decode(new Uint8Array([0x00]));"); |  23  | 
 |  24 debug(""); | 
 |  25 debug("Streaming cases:"); | 
 |  26 evalAndLog("decoder = new TextDecoder('utf-16le', {fatal: true})"); | 
 |  27 evalAndLog("odd = new Uint8Array([0x00])"); | 
 |  28 evalAndLog("even = new Uint8Array([0x00, 0x00])"); | 
 |  29  | 
 |  30 debug(""); | 
 |  31 shouldNotThrow("decoder.decode(odd, {stream: true}); decoder.decode(odd)"); | 
 |  32 shouldThrow("decoder.decode(even, {stream: true}); decoder.decode(odd)"); | 
 |  33 shouldThrow("decoder.decode(odd, {stream: true}); decoder.decode(even)"); | 
 |  34 shouldNotThrow("decoder.decode(even, {stream: true}); decoder.decode(even)"); | 
|  26  |  35  | 
|  27 </script> |  36 </script> | 
| OLD | NEW |