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

Unified Diff: LayoutTests/fast/dom/Range/deleteData-replaceData-count-overflow.html

Issue 229793004: Add CharacterData.deleteData()/replaceData() overflow handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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
Index: LayoutTests/fast/dom/Range/deleteData-replaceData-count-overflow.html
diff --git a/LayoutTests/fast/dom/Range/deleteData-replaceData-count-overflow.html b/LayoutTests/fast/dom/Range/deleteData-replaceData-count-overflow.html
new file mode 100644
index 0000000000000000000000000000000000000000..c96b30db52c08c6357cf86d6a5121438c9dc25a6
--- /dev/null
+++ b/LayoutTests/fast/dom/Range/deleteData-replaceData-count-overflow.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src="../../../resources/js-test.js"></script>
+</head>
+<body>
+<script>
+description("Test deleteData() + replaceData() overflow handling.");
+
+var textNode;
+var range;
+
+shouldBeNonNull("textNode = new Text('chopped off and then some'); textNode");
+document.body.appendChild(textNode);
+document.getSelection().extend(textNode, textNode.length);
+range = document.getSelection().getRangeAt(0);
+
+shouldBeEqualToString("textNode.deleteData(11, 0xfffffff7); textNode.data", "chopped off");
+shouldBe("range.endOffset", "11");
+document.body.removeChild(textNode);
+
+shouldBeNonNull("textNode = new Text('hello world'); textNode");
+document.body.appendChild(textNode);
+document.getSelection().extend(textNode, textNode.length);
+range = document.getSelection().getRangeAt(0);
+
+shouldBeEqualToString("textNode.replaceData(6, 0xfffffffe, 'bob'); textNode.data", "hello bob");
+shouldBe("range.endOffset", "6");
+document.body.removeChild(textNode);
+
+shouldBeNonNull("textNode = new Text('hello world'); textNode");
+shouldBeEqualToString("textNode.replaceData(6, -1, 'bob'); textNode.data", "hello bob");
+shouldBeNonNull("textNode = new Text('hello world'); textNode");
+shouldBeEqualToString("textNode.replaceData(6, -2, 'bob'); textNode.data", "hello bob");
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698