Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: LayoutTests/fast/encoding/api/end-of-file.html

Issue 23532016: Handle odd data lengths in UTF-16 decoder (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Simplify Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/encoding/api/end-of-file-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/encoding/api/end-of-file-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698