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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/encoding/api/end-of-file-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/encoding/api/end-of-file.html
diff --git a/LayoutTests/fast/encoding/api/end-of-file.html b/LayoutTests/fast/encoding/api/end-of-file.html
index ef4f7b81789b5e127aa6b01e1f43e4267d2685df..0e9615b23eed70fb98374ed2f4d876df768ec368 100644
--- a/LayoutTests/fast/encoding/api/end-of-file.html
+++ b/LayoutTests/fast/encoding/api/end-of-file.html
@@ -7,21 +7,30 @@ description("Edge cases around non-fatal errors at EOF");
shouldThrow("new TextDecoder('utf-8', {fatal: true}).decode(new Uint8Array([0xff]))");
debug("");
-debug("Should not throw or hang:");
-evalAndLog("new TextDecoder('utf-8').decode(new Uint8Array([0xff]))");
+shouldBe("new TextDecoder('utf-8').decode(new Uint8Array([0xff]))", "'\uFFFD'");
debug("");
shouldThrow("new TextDecoder('utf-16le', {fatal: true}).decode(new Uint8Array([0x00]))");
debug("");
-debug("Should not throw or hang:");
-evalAndLog("new TextDecoder('utf-16le').decode(new Uint8Array([0x00]))");
+shouldBe("new TextDecoder('utf-16le').decode(new Uint8Array([0x00]))", "'\uFFFD'");
debug("");
shouldThrow("new TextDecoder('utf-16be', {fatal: true}).decode(new Uint8Array([0x00]))");
debug("");
-debug("Should not throw or hang:");
-evalAndLog("new TextDecoder('utf-16be').decode(new Uint8Array([0x00]));");
+shouldBe("new TextDecoder('utf-16be').decode(new Uint8Array([0x00]))", "'\uFFFD'");
+
+debug("");
+debug("Streaming cases:");
+evalAndLog("decoder = new TextDecoder('utf-16le', {fatal: true})");
+evalAndLog("odd = new Uint8Array([0x00])");
+evalAndLog("even = new Uint8Array([0x00, 0x00])");
+
+debug("");
+shouldNotThrow("decoder.decode(odd, {stream: true}); decoder.decode(odd)");
+shouldThrow("decoder.decode(even, {stream: true}); decoder.decode(odd)");
+shouldThrow("decoder.decode(odd, {stream: true}); decoder.decode(even)");
+shouldNotThrow("decoder.decode(even, {stream: true}); decoder.decode(even)");
</script>
« 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